[SDL] possible cause for Mix_PlayMusic() crashing
James Barrett
xucaen at gmail.com
Mon Dec 24 12:32:11 PST 2007
I think I found the issue. There is a divide by zero happening in
music.c, function Mix_FadeInMusicPos()
line 870: music->fade_steps = ms/ms_per_step;
ms == 0
ms_per_step == 0
In the debugger, the above code gets executed before function
open_music() which sets the variable ms_per_step.
To fix the divide by zero crash, I added code just before the division
calculation:
//Barrett 12/24/2007
if(ms_per_step == 0)
{
ms_per_step = 1;
}
Now the program no longer crashes, but my ogg music is still not
playing. I'll do more debugging later.
For all I know, setting ms_per_step to 1 might cause no playback! ;-)
I'll have to find out why function open_music() isn't getting called
until after
Jim
More information about the SDL
mailing list