Skip to content

Commit

Permalink
Backed out changeset 1eddea51f162
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 1, 2012
1 parent d2188c2 commit 571b2f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 0 additions & 2 deletions CHANGES
@@ -1,6 +1,4 @@
1.2.12:
Sam Lantinga - Sat Dec 31 22:56:34 EST 2011
* Fixed looping MIDI music
Sam Lantinga - Sat Dec 31 19:11:59 EST 2011
* Fixed dropping audio in the FLAC audio decoding
Sam Lantinga - Sat Dec 31 18:32:05 EST 2011
Expand Down
17 changes: 12 additions & 5 deletions music.c
Expand Up @@ -196,6 +196,7 @@ void Mix_HookMusicFinished(void (*music_finished)(void))
static int music_halt_or_loop (void)
{
/* Restart music if it has to loop */

if (!music_internal_playing())
{
/* Restart music if it has to loop at a high level */
Expand Down Expand Up @@ -251,6 +252,10 @@ void music_mixer(void *udata, Uint8 *stream, int len)
}
}

music_halt_or_loop();
if (!music_internal_playing())
return;

switch (music_playing->type) {
#ifdef CMD_MUSIC
case MUS_CMD:
Expand All @@ -277,14 +282,14 @@ void music_mixer(void *udata, Uint8 *stream, int len)
#ifdef USE_FLUIDSYNTH_MIDI
if ( fluidsynth_ok ) {
fluidsynth_playsome(music_playing->data.fluidsynthmidi, stream, len);
break;
goto skip;
}
#endif
#ifdef USE_TIMIDITY_MIDI
if ( timidity_ok ) {
int samples = len / samplesize;
Timidity_PlaySome(stream, samples);
break;
goto skip;
}
#endif
break;
Expand Down Expand Up @@ -314,12 +319,14 @@ void music_mixer(void *udata, Uint8 *stream, int len)
/* Unknown music type?? */
break;
}
}

/* Handle seamless music looping */
skip:
/* Handle seamless music looping */
if (left > 0 && left < len) {
music_halt_or_loop();
if (left > 0 && left < len && music_internal_playing()) {
if (music_internal_playing())
music_mixer(udata, stream+(len-left), left);
}
}
}

Expand Down

0 comments on commit 571b2f3

Please sign in to comment.