I'm working on a game with separate menu music and in-game music. What I'd like to do is cache what the current music pattern is and resume each song from there, rather than constantly starting each song from the beginning.
I know I can see what SFX are currently playing on each of the channels using stat(16)-stat(19). I could cache that then peek through the music memory for a pattern with the right SFX on the right channels, but that is obviously not guaranteed to resume at the right point (or even the right song) if that set of SFX are used together in the same way in multiple patterns.
I checked all the values of stat() from 0-127 in case it was there but none of them corresponded to the music pattern.
I could manually track the pattern since I know what pattern I start the music from. With a combination of stat(16)-stat(19) for SFX and stat(20)-stat(23) for notes I should be able to tell whenever the pattern changes. If I know how many patterns long my song is (or just check for the loop flags in memory) I'll know when to reset the tracker back to the start of the song.
I say should because while it would be straightforward to write something like this that works for most music, it might be quite tricky in cases where the same SFX are used in consecutive patterns and use looping instead of a full 32 notes. It's doable but it just seems like a lot of work for what I was expecting to be a simple stat() call.
[Please log in to post a comment]