Log In  

Cart #woruyudutu-0 | 2020-08-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

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

P#81315 2020-08-28 22:29 ( Edited 2020-08-29 00:17)

2

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.

P#81349 2020-08-29 23:27

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)

P#81389 2020-08-31 02:38

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 13:03:11 | 0.010s | Q:18