开发者

Best way to implement audio playback

开发者 https://www.devze.com 2023-01-05 08:41 出处:网络
I\'m working on an application that will read in file paths and play audio files.I\'m trying to keep this as simple as possible--by using existing codecs and free/open utilities.I\'d like some suggest

I'm working on an application that will read in file paths and play audio files. I'm trying to keep this as simple as possible--by using existing codecs and free/open utilities. I'd like some suggestions on the best way to do this. I've had two ideas, both involving FFmpeg:

  1. Create a simple GUI that allows the user to read pass in file(s) to be played, and then a ffplay.exe process is run in the background to play the file(s).
  2. Go more in-depth by just using libavcodec and basing my project off the functionality available with that.

There are only a few main goals I have for this.

  • Be able to read in and play multiple开发者_如何学运维 files without breaks between them
  • Start playback at an arbitrary spot (based on a percent of total duration) within the track
  • Stop playback after an arbitrary amount of time, and move to the next track

Which of my two methods seem the most practical for this project? Is there a better--or perhaps less feature-intensive--alternative to FFmpeg that you would suggest.

This is for a Windows application written in C#.

Edit: One of the reasons that I started with FFmpeg is that it can handle many file types, notably MP3, AAC, Flac.

Edit2: If the use of libavcode.dll is the best option, it would also be helpful to get some info on implementing that in C#.


The BASS audio library has C# bindings and works very well with common audio formats (e.g. MP3) with plug-ins for other formats (e.g. AAC).

However, for commercial development, you require a license to use BASS.

0

精彩评论

暂无评论...
验证码 换一张
取 消