Backed out changeset 1eddea51f162
authorSam Lantinga <slouken@libsdl.org>
Sat, 31 Dec 2011 23:28:23 -0500
changeset 528bc0dfe8ae026
parent 527 1eddea51f162
child 529 9ca74f21d466
Backed out changeset 1eddea51f162
CHANGES
music.c
     1.1 --- a/CHANGES	Sat Dec 31 23:00:03 2011 -0500
     1.2 +++ b/CHANGES	Sat Dec 31 23:28:23 2011 -0500
     1.3 @@ -1,6 +1,4 @@
     1.4  1.2.12:
     1.5 -Sam Lantinga - Sat Dec 31 22:56:34 EST 2011
     1.6 - * Fixed looping MIDI music
     1.7  Sam Lantinga - Sat Dec 31 19:11:59 EST 2011
     1.8   * Fixed dropping audio in the FLAC audio decoding
     1.9  Sam Lantinga - Sat Dec 31 18:32:05 EST 2011
     2.1 --- a/music.c	Sat Dec 31 23:00:03 2011 -0500
     2.2 +++ b/music.c	Sat Dec 31 23:28:23 2011 -0500
     2.3 @@ -196,6 +196,7 @@
     2.4  static int music_halt_or_loop (void)
     2.5  {
     2.6  	/* Restart music if it has to loop */
     2.7 +	
     2.8  	if (!music_internal_playing()) 
     2.9  	{
    2.10  		/* Restart music if it has to loop at a high level */
    2.11 @@ -251,6 +252,10 @@
    2.12  			}
    2.13  		}
    2.14  		
    2.15 +		music_halt_or_loop();
    2.16 +		if (!music_internal_playing())
    2.17 +			return;
    2.18 +
    2.19  		switch (music_playing->type) {
    2.20  #ifdef CMD_MUSIC
    2.21  			case MUS_CMD:
    2.22 @@ -277,14 +282,14 @@
    2.23  #ifdef USE_FLUIDSYNTH_MIDI
    2.24  				if ( fluidsynth_ok ) {
    2.25  					fluidsynth_playsome(music_playing->data.fluidsynthmidi, stream, len);
    2.26 -					break;
    2.27 +					goto skip;
    2.28  				}
    2.29  #endif
    2.30  #ifdef USE_TIMIDITY_MIDI
    2.31  				if ( timidity_ok ) {
    2.32  					int samples = len / samplesize;
    2.33    					Timidity_PlaySome(stream, samples);
    2.34 -					break;
    2.35 +					goto skip;
    2.36  				}
    2.37  #endif
    2.38  				break;
    2.39 @@ -314,12 +319,14 @@
    2.40  				/* Unknown music type?? */
    2.41  				break;
    2.42  		}
    2.43 +	}
    2.44  
    2.45 -		/* Handle seamless music looping */
    2.46 +skip:
    2.47 +	/* Handle seamless music looping */
    2.48 +	if (left > 0 && left < len) {
    2.49  		music_halt_or_loop();
    2.50 -		if (left > 0 && left < len && music_internal_playing()) {
    2.51 +		if (music_internal_playing())
    2.52  			music_mixer(udata, stream+(len-left), left);
    2.53 -		}
    2.54  	}
    2.55  }
    2.56