Log In  

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.

P#33599 2016-12-17 12:22 ( Edited 2016-12-17 17:22)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-12-07 08:35:03 | 0.006s | Q:6