Solved: Music#jump

I've figured out what the problem was with my Music#jump method: SDL_mixer's Mixer_SetMusicPosition expects the time to be given in seconds (and docs say as much), but I was giving it in milliseconds. So, yes, it's pretty much my own fault. On a semi-conscious level, I knew that it wanted seconds. But, the times that SDL_mixer wants for fading are in milliseconds, so I automatically added the erroneous conversion.

So now it's working. Well, for Ogg Vorbis, it's working great. My ears are literally aching from testing jumps with an MP3 file, because of the jagged screech it makes when seeking to a new time. But I don't think there's anything I can do in Rubygame to fix that. Ogg Vorbis is cooler anyway, so just use that!

P.S. Apparently, SDL_mixer will will just crash if you try to set the position to a point after the end of an MP3 file. But, for Vorbis, it just plays from the beginning. Except when it 'locks up' the file, in which it won't play until you rewind from the beginning.

Naturally, SDL_mixer doesn't have any methods for finding out such useless items as how long the song is or the current position in the song, which makes it a wee bit difficult for me to prevent users from crashing/breaking Rubygame with invalid times.


Have something interesting to say about this post? Email your thoughtful comments to