diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index f32b47fa..d141eda1 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -665,6 +665,11 @@ sfz::Voice* sfz::Synth::findFreeVoice() noexcept if (stolenVoice == nullptr) return {}; + // Never kill age 0 voices + if (stolenVoice->getAge() == 0) + return {}; + + auto tempSpan = resources.bufferPool.getStereoBuffer(samplesPerBlock); SisterVoiceRing::applyToRing(stolenVoice, [&] (Voice* v) { renderVoiceToOutputs(*v, *tempSpan); @@ -991,8 +996,9 @@ void sfz::Synth::checkNotePolyphony(const Region* region, int delay, const Trigg } } - if (notePolyphonyCounter >= *region->notePolyphony && selfMaskCandidate) + if (notePolyphonyCounter >= *region->notePolyphony && selfMaskCandidate) { SisterVoiceRing::offAllSisters(selfMaskCandidate, delay); + } } void sfz::Synth::checkGroupPolyphony(const Region* region, int delay) noexcept diff --git a/src/sfizz/VoiceStealing.cpp b/src/sfizz/VoiceStealing.cpp index 0fa4f1a7..7ea7c867 100644 --- a/src/sfizz/VoiceStealing.cpp +++ b/src/sfizz/VoiceStealing.cpp @@ -25,7 +25,7 @@ sfz::Voice* sfz::VoiceStealing::steal(absl::Span voices) noexcept // their sound, but it's reasonable for sounds with a quick attack and longer // release. const auto ageThreshold = - static_cast(voices.front()->getAge() * config::stealingAgeCoeff) + 1; + static_cast(voices.front()->getAge() * config::stealingAgeCoeff); Voice* returnedVoice = voices.front(); unsigned idx = 0;