backport fix for bug #2690. (from 2.0 branch commit 9599bb0ff844). SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Sun, 07 Oct 2018 01:33:33 +0300
branchSDL-1.2
changeset 8777e3d377364e7
parent 876 fab846266822
child 878 294db2bca9b0
backport fix for bug #2690. (from 2.0 branch commit 9599bb0ff844).
mixer.c
     1.1 --- a/mixer.c	Sun Oct 07 01:20:30 2018 +0300
     1.2 +++ b/mixer.c	Sun Oct 07 01:33:33 2018 +0300
     1.3 @@ -313,8 +313,8 @@
     1.4  				_Mix_channel_done_playing(i);
     1.5  			} else if ( mix_channel[i].fading != MIX_NO_FADING ) {
     1.6  				Uint32 ticks = sdl_ticks - mix_channel[i].ticks_fade;
     1.7 -				if( ticks > mix_channel[i].fade_length ) {
     1.8 -				    Mix_Volume(i, mix_channel[i].fade_volume_reset); /* Restore the volume */
     1.9 +				if ( ticks >= mix_channel[i].fade_length ) {
    1.10 +					Mix_Volume(i, mix_channel[i].fade_volume_reset); /* Restore the volume */
    1.11  					if( mix_channel[i].fading == MIX_FADING_OUT ) {
    1.12  						mix_channel[i].playing = 0;
    1.13  						mix_channel[i].looping = 0;
    1.14 @@ -1048,7 +1048,7 @@
    1.15  			    (mix_channel[which].fading != MIX_FADING_OUT) ) {
    1.16  				mix_channel[which].fade_volume = mix_channel[which].volume;
    1.17  				mix_channel[which].fading = MIX_FADING_OUT;
    1.18 -				mix_channel[which].fade_length = ms;
    1.19 +				mix_channel[which].fade_length = (Uint32)ms;
    1.20  				mix_channel[which].ticks_fade = SDL_GetTicks();
    1.21  
    1.22  				/* only change fade_volume_reset if we're not fading. */