[Commits] SDL_mixer: Let the music-finished hook start a new track without...
libsdl.org revision control
commits-owner at libsdl.org
Wed Jun 15 01:18:56 PDT 2011
details: http://hg.libsdl.org/SDL_mixer/rev/777497efacaa
changeset: 509:777497efacaa
user: Ryan C. Gordon <icculus at icculus.org>
date: Wed Jun 15 03:41:31 2011 -0400
description:
Let the music-finished hook start a new track without a skip in the audio.
Previously, there'd be no more music mixed until the next SDL audio callback
fired. Now if the hook (re)starts a track, it'll start mixing right away,
into whatever space is left in the callback where the hook was called.
This is useful if you have an mp3 that, after one playthrough, is replaced
with a looping mp3 that contains the rest of the song on repeat. No more gap
between the two.
diffstat:
music.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diffs (30 lines):
diff -r de8e7a4f5936 -r 777497efacaa music.c
--- a/music.c Sun Jun 05 15:32:32 2011 +0300
+++ b/music.c Wed Jun 15 03:41:31 2011 -0400
@@ -253,10 +253,10 @@
}
}
- if (music_halt_or_loop() == 0)
+ music_halt_or_loop();
+ if (!music_internal_playing())
return;
-
-
+
switch (music_playing->type) {
#ifdef CMD_MUSIC
case MUS_CMD:
@@ -324,8 +324,10 @@
skip:
/* Handle seamless music looping */
- if (left > 0 && left < len && music_halt_or_loop()) {
- music_mixer(udata, stream+(len-left), left);
+ if (left > 0 && left < len) {
+ music_halt_or_loop();
+ if (music_internal_playing())
+ music_mixer(udata, stream+(len-left), left);
}
}
More information about the commits
mailing list