windows 为 C++ 寻找一个简单的音频播放库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5093760/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Looking for a simple audio playback library for C++
提问by Jesse Brands
I'm working on a simple audio player, which is going quite well, using Qt and everything. But I'm in need of a solid but simple Audio library. I don't need anything fancy such as 3D sound and what do I know what else these things got nowadays. I'm just looking for something simple and efficient.
我正在开发一个简单的音频播放器,使用 Qt 和所有东西,效果很好。但我需要一个可靠但简单的音频库。我不需要任何花哨的东西,比如 3D 声音,我知道现在这些东西还有什么。我只是在寻找简单有效的东西。
A list of features I'm looking for:
我正在寻找的功能列表:
- Audio playback from files
- .ogg, .mp3 and .flac should be supported at the very least.
- Should be able to pause playback.
- I am planning to use it in C++
- 从文件播放音频
- 至少应该支持 .ogg、.mp3 和 .flac。
- 应该可以暂停播放。
- 我打算在 C++ 中使用它
See. Nothing huge or anything, but at the same time I am having a hard time finding something suitable. The platform I'm targeting is Windows 7.
看。没什么大不了的,但与此同时,我很难找到合适的东西。我的目标平台是 Windows 7。
Anyone out there that knows something that I might be looking for?
那里的任何人都知道我可能正在寻找的东西?
采纳答案by SirDarius
The best possible choice in my opinion is the BASSaudio library, which is not open source, but free for non-commercial use.
我认为最好的选择是BASS音频库,它不是开源的,但可以免费用于非商业用途。
It is used by the AIMP2 audio player, which you can use to check the sound quality, natively supports a lot of formats including MP3 and OGG, and uses plugins to support even more, including FLAC.
AIMP2 音频播放器使用它,您可以使用它来检查音质,本机支持多种格式,包括 MP3 和 OGG,并使用插件支持更多格式,包括 FLAC。
回答by Reno
How about libavcodec? Its LGPL. I'm not sure about ogg >_<
libavcodec怎么样?它的 LGPL。我不确定 ogg >_<
回答by icabod
I have used BASSbefore from a Windows C++ program, and it is very simple to use - link the DLL and call a couple of methods to specify the file to play back.
我之前在 Windows C++ 程序中使用过BASS,使用起来非常简单 - 链接 DLL 并调用几个方法来指定要播放的文件。
It certainly handles MP3 playback from a file as that's what I was doing.
它当然可以处理文件中的 MP3 播放,因为这就是我正在做的。
I wish I could verify OGG and Flac, but alas I'm behind a firewall that has the site blocked.
我希望我能验证 OGG 和 Flac,但可惜我在防火墙后面,该站点被阻止了。
回答by Jesse Brands
Came across a good answer to my own question via an answer of another. FFmpeg is almost exactly what I'm looking for. Thanks all.
通过另一个人的回答对我自己的问题给出了一个很好的答案。FFmpeg 几乎正是我正在寻找的。谢谢大家。
回答by AudioDroid
I suggest Openframeworksor use of the rtAudiolibrary - that openframeworks is using - directly. Oh, and on the side: rtAudio has pretty much no license restrictions. ;-) Correct me, if I'm wrong.
我建议直接使用Openframeworks或使用rtAudio库 - openframeworks 正在使用的库。哦,顺便说一句:rtAudio 几乎没有许可证限制。;-) 如果我错了纠正我。
回答by neuro
回答by tenfour
DirectShow is actually pretty easy to use, flexible, and comes with Windows. There are a million examples, and it can be as easy or as sophisticated as you need it to be. When I throw together something that needs to play MP3s, I use it. Note that you are targeting Windows 7, so you could consider using Media Foundationinstead.
DirectShow 实际上非常易于使用、灵活,并且随 Windows 一起提供。有一百万个例子,它可以像您需要的那样简单或复杂。当我把需要播放 MP3 的东西放在一起时,我会使用它。请注意,您的目标是 Windows 7,因此您可以考虑改用Media Foundation。