jtothebell / fake-08

A Pico-8 player/emulator for console homebrew
Other
563 stars 49 forks source link

Fix songs with looping sections being cut short. #170

Closed fringd closed 1 year ago

fringd commented 1 year ago

Hey there. This fixes a bug in some music playback. noticed it in a game I'm working on:

Without this fix the title song only plays the drumloop once and cuts short the longer section.

the Audio code didn't seem super testable... Any insight into how to unit test this would be great. I haven't coded C++ in a while and a half.

even after this change the master channel detection doesn't seem 100% correct. I'd think it should look at the longest non-looping section, or the longest looping section if there are not non-looping sections. I can try to make this more robust in a follow-up.

here's the game where the title track wasn't playing right. planet p8