[SDL] possible cause for Mix_PlayMusic() crashing
James Barrett
xucaen at gmail.com
Mon Dec 24 13:50:24 PST 2007
and the final cause is... I'm an idiot....
I debugged to find out why the open_music() wasn't getting called until
after attempting to play music. Well, I *know* I am supposed to do:
OpenAudio()
StartMusic().
but for some unknown reason Instead I had.
StartMusic()
OpenAudio()
Case closed.
Merry Christmas, Happy New Year!!
Jim
James Barrett wrote:
> 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