Skip to content
Permalink
Browse files

Various bugfixes for music looping

  • Loading branch information
Stephane Peter committed Oct 30, 1999
1 parent 0968985 commit c435e01a107108e105c1b0caf5e9ea3dc93710b0
Showing with 11 additions and 7 deletions.
  1. +11 −7 music.c
18 music.c
@@ -116,13 +116,6 @@ void music_mixer(void *udata, Uint8 *stream, int len)
lowlevel_halt(); /* This function sets music_playing to NULL */
return;
}
if ( music_playing && music_loops && !lowlevel_playing() ) {
if ( -- music_loops ) {
Mix_RewindMusic();
if ( lowlevel_play(music_playing) < 0 )
music_stopped = 1; /* Something went wrong */
}
}
if ( !music_stopped && music_playing->fading != MIX_NO_FADING ) {
Uint32 ticks = SDL_GetTicks() - music_playing->ticks_fade;
if( ticks > music_playing->fade_length ) {
@@ -149,6 +142,16 @@ void music_mixer(void *udata, Uint8 *stream, int len)
}
}
}
if ( music_loops && !lowlevel_playing() ) {
if ( -- music_loops ) {
Mix_RewindMusic();
if ( lowlevel_play(music_playing) < 0 ) {
fprintf(stderr,"Warning: Music restart failed.\n");
music_stopped = 1; /* Something went wrong */
music_playing->fading = MIX_NO_FADING;
}
}
}
switch (music_playing->type) {
#ifdef CMD_MUSIC
case MUS_CMD:
@@ -625,6 +628,7 @@ static void lowlevel_halt(void)
music_playing->fading = MIX_NO_FADING;
music_playing = 0;
music_active = 0;
music_loops = 0;
music_stopped = 0;
}

0 comments on commit c435e01

Please sign in to comment.