Hi all,
How can I play MP3 files in C++? Is there any library that I can use?
Thanks,
Peyman
This is a discussion on Playing MP3 files in C++ within the C++ Programming forums, part of the General Programming Boards category; Hi all, How can I play MP3 files in C++? Is there any library that I can use? Thanks, Peyman...
Hi all,
How can I play MP3 files in C++? Is there any library that I can use?
Thanks,
Peyman
In the C++ standard library, no. SDL, however, might support such a thing.
Google for "MP3 files in C++".
I found libmpg123 to be a good library.
Also, be aware of the legal implications - MP3 is patented. Depending on what you're doing, other formats may suit you better. (In the local gamedev club, the last project I worked with used .ogg files. Supported by SDL, excellent quality, and free.)
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
FMOD, DirectSound, OpenAL. I use FMOD.
You know what date is on this coin? 1958. It's been travelling twenty two years to get here.
And now it's here.
And I'm here.
And it's either heads or tails.
And you have to say...
Call it.
Yes, libmpg123 works with Windows. They seem to have a developer zip file on the website's download page, but IIRC, I just compiled from source.
I forgot to note that libmpg123 provides only decoding support, IIRC. I don't think they have any code for playing sound. (You've got two tasks here: decoding the mp3 and playing the resulting waveform.) Some of the libraries mentioned above can help with that. (Some might be able to do both decoding/playing in one or two steps - for me, this was not needed.)
Last edited by Cactus_Hugger; 07-29-2008 at 05:29 PM.
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)