I think I've found a bug with how music and sfx channels are used; I've attached a cartridge that shows off the issue. Basically, if you call sfx() and then call music() afterward, the music won't be heard until the sfx() finishes, even though there are 3 available unused sound channels for the music to play on.
Am I misunderstanding how this is supposed to work? it seems like the music() command should figure out that it has 3 free channel slots to play in... I do see the channelmask parameter (https://pico-8.fandom.com/wiki/Music) but calling music(4,0,0b1111) instead of music(4) doesn't fix the issue. Even if it did, sometimes you want to start playing music after sound is already playing, so how are you supposed to set up in advance which channels the music has priority to play on?
I can see workarounds for this (e.g. call sfx(8,-2) to stop the sound, or shim in a custom version of sfx() that only ever plays sound effects on channels 2 and 3, leaving the other channels open for music... but these workarounds seem weird/awkward enough that I'm thinking this is just a bug in pico-8
It's because music tracks don't allocate new channels. When you press Z, the SFX plays on channel 0, but then the music (which plays on channel 0) takes over. If both music and SFX are playing on a single channel, then the SFX will take priority, as noted by the first half of your song cutting off.
ohhh hmm interesting. thank you, that makes sense now. Although, I guess I'm still surprised that music(4,0,0b1111) doesn't immediately overwrite the sound in channel 0 with the music's channel 0...
It seems like getting music and sound to play nicely together will take some work (probably involving re-defining sfx() to only be allowed to play on certain channels)
[Please log in to post a comment]