playdate.sound.synth:setSustain does not work

Edit: superceded by this more precise bug report.

I have been implementing sound effects in pulp-to-lua. It seems to me that setting the sustain in the playdate.sound.synth class has no effect. Neither playdate.sound.synth:setADSR() nor playdate.sound.synth:setSustain can modify the sustain. However, sustain does work when using an envelope to modulate the amplitude: playdate.sound.synth:setAmplitudeMod(playdate.sound.envelope.new(...)).

Edit: it seems that synth:setSustain does work, but only if an envelope is already set? I'm not sure.

Edit: OK, I think I have identified the problem. If the note is released before there is enough time to reach the sustain level after decay, then the sustain level will not be reached. This is different compared to my web browser, which accelerates the decay so that the sustain level is reached before release.

I guess there isn't really a bug. I was just confused by how ADSR works in this edge case. It might be helpful to add a note to the documentation about this.

It's definitely a bug, though a subtle one. We'll have a fix tomorrow. Sorry about that!