foxygit / fake-08-xbox360 Log in
commit ec7a32f21013917839563e8a95195e4038e176de
Author:     sylverb <sylver.bruneau@gmail.com>
AuthorDate: Wed Jan 24 22:12:29 2024 +0100
Commit:     sylverb <sylver.bruneau@gmail.com>
CommitDate: Wed Jan 24 22:12:29 2024 +0100

    Fix bug were a silented channel will continue to play previous content
---
 source/Audio.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/source/Audio.cpp b/source/Audio.cpp
index 5530d76..4c25f3b 100644
--- a/source/Audio.cpp
+++ b/source/Audio.cpp
@@ -215,8 +215,11 @@ void Audio::set_music_pattern(int pattern) {
             continue;

         uint8_t n = channels[i];
-        if (n & 0x40)
+        if (n & 0x40) {
+            // Make sure this channel will be silent
+            _audioState._sfxChannels[i].sfxId = -1;
             continue;
+        }

         _audioState._sfxChannels[i].sfxId = n;
         _audioState._sfxChannels[i].offset = 0.f;