SDL_mixer.h

SDL plays .wav extension audio but it wont work with .mp3 files doesn't SDL support mp3 files or do i need to convert it to .wav file first , if it's not clear i will paste the code
Now after retrying i get run time error:
The program can't start because libstdc++ -6.dll is missing from your computer.Try reinstalling the program to fix this problem.


I can't find any libstdc++ -6.dll file on the system
As far as I know, SDL doesn't natively support the play back of .mp3 files. This is due to the use of an MP3 decoder requiring complicated licensing issues. See https://en.wikipedia.org/wiki/MP3#Licensing_and_patent_issues
Basically, yes, you have to convert to a WAV file first. In the future, prefer to get you audio in an open-source format such as Ogg Vorbis, as that is free of licensing issues, and thus SDL is more likely to have a decoder for it.

EDIT:
libstdc++-6.dll is a DLL that is used by MinGW as the standard library. If you go to the 'bin' folder of your MinGW folder, you should find the DLL there. If you aren't using MinGW, then you might need to rebuild SDL using your compiler to prevent errors like that.
Last edited on
Before conversion 5.29 mb after conversion 39 mb (O_O)
Lol it works but it's quality is very bad its's like 1980's sega video game audio sound XD
SDL_mixer can load mp3 files, at least if you have the right libraries. Have you tried?
Yes i did try am using sdl 1.2.5 may be the new version supports mp3 files
It looks likeSDL_mixer has supported mp3 files since version 1.0 so I don't think it's a version problem, but if you want you could upgrade and see if that makes a difference. The docs mention something about SMPEG or the MAD library so maybe you have to install one of them or something. I'm not sure.

What error message does it give you after you have failed to load the mp3 file?
1
2
3
4
5
Mix_Music *music = Mix_LoadMUS("music.mp3");
if(!music)
{
	std::cout << Mix_GetError() << std::endl;
}
If you use Windows, you will have to look in the stdout.txt file to see the output.
Last edited on
After trying to load mp3 file using your code given gives me a run time error:
The program can't start because libstdc++ -6.dll is missing from your computer.Try reinstalling the program to fix this problem.
Topic archived. No new replies allowed.