If a player adds some notes under sostenuto pedal, then additionally uses the sustain pedal for some other notes and releases the sustain pedal, the notes under the sostenuto pedal shouldn’t be stopped.
Could you add here:
void Synthesiser::handleSustainPedal (int midiChannel, bool isDown)
this little if-addition:
if (! (voice->isKeyDown() || voice->sostenutoPedalDown)) stopVoice (voice, 1.0f, true);
instead of before:
if (! voice->isKeyDown()) stopVoice (voice, 1.0f, true);
Then it works like expected.