From 81fe043bb3cb2bf97f7812228ab663a21252d903 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Wed, 7 Oct 2020 09:01:48 +0200 Subject: [PATCH] No need to ramp out killed voice data --- src/sfizz/Synth.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index 2348dcb4..f4caa9a4 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -844,20 +844,20 @@ void sfz::Synth::renderBlock(AudioSpan buffer) noexcept ModMatrix& mm = resources.modMatrix; mm.beginCycle(numFrames); + { // Clear effect busses + ScopedTiming logger { callbackBreakdown.effects }; + for (auto& bus : effectBuses) { + if (bus) + bus->clearInputs(numFrames); + } + } + activeVoices = 0; { // Main render block ScopedTiming logger { callbackBreakdown.renderMethod, ScopedTiming::Operation::addToDuration }; tempMixSpan->fill(0.0f); resources.filePool.cleanupPromises(); - // Ramp out whatever is in the buffer at this point; should only be killed voice data - linearRamp(*rampSpan, 1.0f, -1.0f / static_cast(numFrames)); - for (size_t i = 0, n = effectBuses.size(); i < n; ++i) { - if (auto& bus = effectBuses[i]) { - bus->applyGain(rampSpan->data(), numFrames); - } - } - for (auto& voice : voices) { if (voice->isFree()) continue; @@ -914,14 +914,6 @@ void sfz::Synth::renderBlock(AudioSpan buffer) noexcept // Reset the dispatch counter dispatchDuration = Duration(0); - { // Clear for the next run - ScopedTiming logger { callbackBreakdown.effects }; - for (auto& bus : effectBuses) { - if (bus) - bus->clearInputs(numFrames); - } - } - ASSERT(!hasNanInf(buffer.getConstSpan(0))); ASSERT(!hasNanInf(buffer.getConstSpan(1))); SFIZZ_CHECK(isReasonableAudio(buffer.getConstSpan(0)));