I'm 开发者_如何学Pythonwanting 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.
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?
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.
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.
精彩评论