[c++] SDL_Mixer and MP3 not a match?

Started by
11 comments, last by Splinter of Chaos 16 years, 3 months ago
Well, I made my game, but people complained that the "music" file was outrageously huge--something like 12 MB. Anyway, I re-exported my music files into mp3s, but now the game freezes when I press any button. I have narrowed the problem down to it being the mp3, and SDL not liking them. My research backs this up. Is there anything I can do? Or is there at least another format I can work with?
Advertisement
I vaguely remember a build of SDL_mixer not working with MP3s a year ago but I can't remember if it was for the GP2X port or the PC. A bit of Google searching may bring up some mailing lists.

In the meantime, use the OGG format.

Steven Yau
[Blog] [Portfolio]

How can I convert the audio?
Use ogg vorbis files. They are supported by SDL mixer and have a similar compression size and quality to MP3s
How do I convert the audio?

Or, How do I take an MP3 or WAV and make it an oog?
I've used an application called goldwave. There is a free "nagware" version of it on their website. It supports many file formats.

I might have had to install a seperate ogg vorbis encoder to be able to play ogg vorbis in windows media player though, but Ican't remember.
I had similar problems with SDL_Mixer a year or two ago, and ended up switching to ogg vorbis. I just used oggdrop to encode to ogg, it's literally drag and drop.
There still seems to be something wrong here.

        // The game is quit when you X out or pres ESC, but this makes        // sure that pressing ESC in-game doesn't quit you automatically        // when you get back to the menu.        while( SDL_PollEvent( &SDLevent ) )        {            if( SDLevent.type == SDL_QUIT || keyStates[ SDLK_ESCAPE ] )            {                appState = QUIT; // Just a char for holding a state.                            errors << "Q has bee pressed. " << appState << endl;            }            errors << "After0\n";        }


I see no reason for it, but using ogg file formats make it so if I press escape, the program never makes it to the second testing output.

Any ideas?
Add << endl after that last call and see if you still see that.
Quote:Original post by Splinter of Chaos
How do I convert the audio?

Or, How do I take an MP3 or WAV and make it an oog?


use audacity

http://audacity.sourceforge.net/

pretty straightforward to do and its free

This topic is closed to new replies.

Advertisement