From 498e1b95bbaab306c14136e5ce699ff9e0d0f0bc Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Tue, 23 Jun 2020 00:21:30 +0200 Subject: [PATCH] Correct the self-masking behavior --- src/sfizz/Synth.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index 500e4edc..90542333 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -884,6 +884,14 @@ void sfz::Synth::noteOnDispatch(int delay, int noteNumber, float velocity) noexc noteOffDispatch(delay, voice->getTriggerNumber(), voice->getTriggerValue()); } + // Polyphony reached on note_polyphony + if (region->notePolyphony && notePolyphonyCounter >= *region->notePolyphony) { + if (selfMaskCandidate != nullptr) + selfMaskCandidate->release(delay); + else // We're the lowest velocity guy here + continue; + } + auto parent = region->parent; // Polyphony reached on region @@ -910,14 +918,6 @@ void sfz::Synth::noteOnDispatch(int delay, int noteNumber, float velocity) noexc parent = parent->getParent(); } - // Polyphony reached on note_polyphony - if (region->notePolyphony && notePolyphonyCounter >= *region->notePolyphony) { - if (selfMaskCandidate == nullptr) - continue; // We're the lowest velocity guy here - selectedVoice = selfMaskCandidate; - goto render; - } - // Engine polyphony reached, we're stealing something if (selectedVoice == nullptr) { selectedVoice = stealer.steal(absl::MakeSpan(voiceViewArray));