Sign in to follow this  

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

This topic is 3628 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

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Quote:
Original post by Kylotan
Add << endl after that last call and see if you still see that.


Wow, I'm baffled. That reveled that it made it all the way to "return 0;", and that's the line the error occurs on, but only when the file format is ogg. This makes no sense. Sure, I might not be surprised if an SDL subsystem makes SDL act weird, but c++ itself!

Share this post


Link to post
Share on other sites
endl both adds an end of line character and flushes the stream. If an application crashes or otherwise aborts when the stream hasn't been flushed, you may never see some of that output. The issue is probably in the surrounding code somewhere. Do you have the required .dlls for decoding the specific audio formats in the app directory?

Share this post


Link to post
Share on other sites
Goggle would lead me to believe that ogg.dll is the only ogg related dll--besides which, it comes with Windows already.

It only took a few hours to adapt my game to some feedback I got. It's taking three days to do what I thought would be the easy part.

EDIT:
Actually, rebuilding the project solved the problem...somehow.

[Edited by - Splinter of Chaos on January 11, 2008 6:08:58 PM]

Share this post


Link to post
Share on other sites

This topic is 3628 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this