Jump to content

  • Log In with Google      Sign In   
  • Create Account

Play mp3 sound files in C++


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Lord_Danny   Members   -  Reputation: 183

Like
0Likes
Like

Posted 28 January 2012 - 06:57 PM

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

Sponsor:

#2 RulerOfNothing   Members   -  Reputation: 1160

Like
0Likes
Like

Posted 28 January 2012 - 07:05 PM

There is no capacity in the C++ standard libraries to play mp3 files, so you will need to download a library such as SDL_sound to do so.

#3 Lord_Danny   Members   -  Reputation: 183

Like
0Likes
Like

Posted 29 January 2012 - 08:14 AM

There is no capacity in the C++ standard libraries to play mp3 files, so you will need to download a library such as SDL_sound to do so.


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?

#4 Ripiz   Members   -  Reputation: 529

Like
0Likes
Like

Posted 29 January 2012 - 08:54 AM

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.

#5 SeiryuEnder   Members   -  Reputation: 199

Like
1Likes
Like

Posted 30 January 2012 - 08:15 AM

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.

#6 FoxC   Members   -  Reputation: 100

Like
0Likes
Like

Posted 31 January 2012 - 03:24 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS