I have some simple C code that is supposed to play a synth when A is pushed, then stop playing it when A is released.
//First, in eventHandler()
synth = pd->sound->synth->newSynth();
pd->sound->synth->setWaveform(synth, kWaveformSquare);
//Later, in update()
if (pressed & kButtonA) {
playingSound = 1;
pd->system->logToConsole("nice");
pd->sound->synth->playNote(synth, noteFreq, 1.0, -1.0, 0);
} else if (released & kButtonA) {
playingSound = 0;
pd->system->logToConsole("released");
pd->sound->synth->noteOff(synth, 0);
if (pd->sound->synth->isPlaying(synth)) {
pd->system->logToConsole("Yep, still playing.");
}
}
The problem is that noteOff() does not stop the sound. The message "Yep, still playing." always appears when taking the button released code path. The issue is reproducible both in the simulator and on real hardware.