foxygit / fake-08-xbox360 Log in
commit 29d9a68940a946929918e90f2399a21f3835d0b8
Author:     Ram Dobson <fringd@gmail.com>
AuthorDate: Wed Oct 5 17:40:24 2022 -0400
Commit:     Ram Dobson <fringd@gmail.com>
CommitDate: Wed Oct 5 17:40:24 2022 -0400

    made wrong assumption about master track selection
---
 source/Audio.cpp    | 3 ++-
 test/audiotests.cpp | 5 ++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/source/Audio.cpp b/source/Audio.cpp
index f080992..c53312d 100644
--- a/source/Audio.cpp
+++ b/source/Audio.cpp
@@ -179,7 +179,8 @@ void Audio::set_music_pattern(int pattern) {
 		length= sfx.loopRangeStart;
 	}
 	else if (sfx.loopRangeEnd > sfx.loopRangeStart) {
-		length = sfx.loopRangeEnd;
+		// length = sfx.loopRangeEnd;
+    // pico 8 pretends like it's length 32!
 	}

 	uint16_t timeLength = length * std::max(1, (int)sfx.speed);;
diff --git a/test/audiotests.cpp b/test/audiotests.cpp
index 0e04fcd..0aef1f3 100644
--- a/test/audiotests.cpp
+++ b/test/audiotests.cpp
@@ -121,7 +121,7 @@ TEST_CASE("audio class behaves as expected") {
         CHECK_EQ(audioState->_sfxChannels[audioState->_musicChannel.master].sfxId, 1);
     }

-    SUBCASE("api_music picks shortest/fastest looping if all looping"){
+    SUBCASE("api_music picks fastest looping if all looping ignoring loop length"){
         picoRam.songs[3].data[0]=0;
         picoRam.songs[3].data[1]=1;
         picoRam.songs[3].data[2]=2;
@@ -135,7 +135,6 @@ TEST_CASE("audio class behaves as expected") {
         picoRam.sfx[2].speed = 3;
         picoRam.sfx[3].speed = 5;
         audio->api_music(3, 0, 0);
-        CHECK_EQ(audioState->_sfxChannels[audioState->_musicChannel.master].sfxId, 3);
+        CHECK_EQ(audioState->_sfxChannels[audioState->_musicChannel.master].sfxId, 2);
     }
-
 }