• Advertisement
Sign in to follow this  

Play mp3 sound files in C++

This topic is 2180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know this have been asked many times, but I'm new to sound programming, so I wonder if anyone can let me know is there an easy way to play sound files in c++ just to start me off?? Or do I need to download some C++ libraries to do so?

Any help will be great

Thanks

Share this post


Link to post
Share on other sites
Advertisement
[quote name='RulerOfNothing' timestamp='1327799123' post='4907195'] There is no capacity in the C++ standard libraries to play mp3 files, so you will need to download a library such as [url=http://icculus.org/SDL_sound/]SDL_sound[/url] to do so. [/quote]

Thanks for the info. Can I then ask which libraries are the most common one to download and use? I'm using OpenGL to make a game, but I take it there isn't some kind of functions or way to load in sound files using OpenGL is there?

Share this post


Link to post
Share on other sites
I don't think there is. You'll need some kind of library if you don't want to do it yourself (most likely you don't).

Also, as far as I know, MP3 requires license and it'll be illegal to use it. I'd suggest going for .wav and .ogg. Usually libraries support multiple formats, so there shouldn't be any problems.

Share this post


Link to post
Share on other sites
Just to build on this response a bit, here are some common sound APIs I've run into:

FMOD
WWISE
DirectSound
OpenAL


In my experience, FMOD is the easiest sound library to get up and running as a programmer.

WWISE is the API of choice for most audio engineers.
It gives them a lot of flexibility but will require a lot more patience to set up in code.
Fortunately, it's pretty well documented.

My knowledge on DirectSound and OpenAL are somewhat limited.
I remember OpenAL's documentation was poor and I'm not sure if it is still supported.

Share this post


Link to post
Share on other sites
If you are currently using OpenGL, then I highly recommend using OpenAL as stated above by SeiryuEnder, the syntax mimics that of opengl, and the 3d coordinate system plays off of it so you can attach audio objects to graphical objects and have them both represented in the 3d world. Makes life a lot easier :) Just my 2 cents

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement