From 546f8a583bff9f18c025047e707364b6298bff48 Mon Sep 17 00:00:00 2001 From: illegalinstruction Date: Wed, 15 Jan 2020 13:18:35 -0800 Subject: [PATCH] Don't stop and reset playing audio if we've hit what we think is the end and want to loop, but it's a tracker format (.mod, .xm), rather than a stream - this fixes the case where only half the song would play. (Fixes #989) --- src/raudio.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/raudio.c b/src/raudio.c index 9fde6e952..265786102 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -1481,8 +1481,19 @@ void UpdateMusicStream(Music music) // Reset audio stream for looping if (streamEnding) - { - StopMusicStream(music); // Stop music (and reset) + { + // is this a tracker format or a streamed one (ogg, wav, etc.) + if (!((music.ctxType == MUSIC_MODULE_XM) || (music.ctxType == MUSIC_MODULE_MOD))) + { + // streamed - stop the music and reset it. + StopMusicStream(music); + } + else + { + // tracker - don't reset it, but remember that we have hit + // the loop point and are playing normally again. + streamEnding = false; + } // Decrease loopCount to stop when required if (music.loopCount > 1)