C#从指定时间播放指定时间的MP3文件 [英] C# play MP3 file from specified time for the specified time

查看:52
本文介绍了C#从指定时间播放指定时间的MP3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个程序,您可以将 mp3 文件导入其中,并告诉它从特定位置开始播放,并播放指定的时间.

I'm wanting to create a program that you can import an mp3 file into, and tell it to play it starting at a specific position, and to play for a specified amount of time.

我查看了 NAudio,让它播放和停止 mp3 文件,但我不知道如何从特定位置开始.有人知道我该怎么做吗?

I've looked into NAudio, and got it to play and stop the mp3 file, but I can't figure out how to start at a specific position. Anybody know what I should do?

推荐答案

如果您使用 NAudio,请在输出流上查找 Seek 方法——从 Google 搜索返回的信息 http://www.google.com/search?q=seek+site:naudio.codeplex.com,应该让你开始.

If you're using NAudio, look for a Seek method on the output stream -- the information returned from this Google search, http://www.google.com/search?q=seek+site:naudio.codeplex.com, should get you started.

您还可以使用一些旧的但功能强大的 Windows API(MCI 接口),如下所示:http://forum.codecall.net/csharp-tutorials/20420-tutorial-playing-mp3-files-c.html 演示了如何从 C# 调用 MCI.MCI 使用一个非常简单的字符串接口,因此一旦您完全可以调用它,就可以很容易地使用它支持的任何命令,并且它支持使用seek [file] to [position]"命令进行查找,如下所示:http://www.codeproject.com/KB/audio-video/MP3Example.aspx.

You could also use some old but functional Windows APIs (the MCI interface) as shown here: http://forum.codecall.net/csharp-tutorials/20420-tutorial-playing-mp3-files-c.html demonstrates how to call MCI from C#. MCI uses a very simple string interface, so once you can call it at all it's pretty easy to use any command it supports, and it supports seeking, with the "seek [file] to [position]" command, as shown here: http://www.codeproject.com/KB/audio-video/MP3Example.aspx.

这篇关于C#从指定时间播放指定时间的MP3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆