0

I am looking for a portable (Linux, Windows, Mac OS X) way to play either OGG or AAC (and WAV) files.

I have tried closed source options like FMOD but the license is too costly.

I have tried open source projects like Audiere but it doesnt work well in post OSS Linux distros and has not been updated, according to the site since 2006.

I have considered trying to find a solution for each platform and just abstract them in a class, but I havent found info on the best way to do this on each platform.

I do not need any special functionality, i just want to play/stop the audio files. (In C++)

Any recommendations?

latreides
  • 379
  • 1
  • 4
  • 14

3 Answers3

2

How about OpenAL?

http://connect.creativelabs.com/openal/

lqez
  • 2,898
  • 5
  • 25
  • 55
  • I am looking into this though it appears (from what little I have read) that OpenAL (on its own) doesnt decode, it just plays. This may be my solution if i can find an open source function/package I can use to load these formats for OpenAL. – latreides Jan 20 '12 at 15:40
  • Still looking for a simple solution to load OGG (or AAC) files into OpenAL without additional binaries. Is this possible? – latreides Jan 20 '12 at 17:35
  • OpenAL is naive sound library. So, if you want to play 'encoded' streams, you have to use the decoder of it. I hope this link may helps you. http://www.gamedev.net/page/resources/_/technical/game-programming/introduction-to-ogg-vorbis-r2031 – lqez Jan 20 '12 at 17:47
  • I am trying for a self contained solution where the decoder and the audio library are either the same (single) binary (like the commercial FMOD and BASS), or where I can simply do the decoding in my application via open source 'include'-able code. Having 5-6 binaries to decode and play one format is a bit extreme and not a solution I am willing to use. I like what OpenAL has to offer, but I am having a hard time finding a solution to stream OGG or AAC files that doesn't require a town full of dependencies. – latreides Jan 20 '12 at 22:03
0

Getting audio out to the device portably can be done using PortAudio. For a fully decoding and playback solution have a look at GStreamer.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
0

Consider GStreamer, a cross-platform solution for dealing with multimedia stuff. There are C++ bindings through QtGstreamer.

This post discuss the setup on Windows.

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • Adding Qt as a dependency is not an option, and as far as I can tell the post only provides setup details for Microsoft compilers. – latreides Jan 20 '12 at 15:36
  • QtGstreamer requires Qt, indeed, but GStreamer does not. The most complex setup of Gstreamer is on Windows, that's why I added the reference. On Mac/Linux is pretty straightforward and can be installed through any of these package managers: brew (Mac), apt-get or yum (for Linux). Then, to compile a minimal application you can execute `g++ demo.cpp -o demo -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -lgstreamer-0.10 \`pkg-config --libs glib-2.0\` -lgobject-2.0` – karlphillip Jan 20 '12 at 16:23
  • It may be that I try GStreamer if OpenAL does not provide me with what I need (though it looks a little more messy than OpenAL). When I mentioned that the post only provides setup details for Microsoft compilers, I did not mean OS. I am well aware of how to do all my building on Linux and Mac (although its not quite as easy as that if you want to either build it into your app or distribute the libs with your app), it is, as you say, because the most complex setup is on Windows that it would be nice if it had information about non MS compilers. – latreides Jan 20 '12 at 16:42
  • This is the list of projects that are already using GStreamer: http://gstreamer.freedesktop.org/apps/ There's some big names in there like Amarok, Gnash, Empathy, GNOME Subtitles, Kaffeine, Rhythmbox, etc, and Songbird , which is one of coolest cross-platforms media players I've used. – karlphillip Jan 20 '12 at 16:49
  • I do not understand what the importance is in the fact that other applications use GStreamer. GStreamer is a good suggestion, though with the complex setup and its plugin design, it may not be the right solution for me. – latreides Jan 20 '12 at 16:52