From a74bd5eee0a6afafb2ab7e77d8b81e6e05690d2a Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Mon, 6 Dec 2021 23:58:26 +0100 Subject: [PATCH] Don't bypass effects without inputs It's not really a great idea if you have long tails.. --- src/sfizz/Effects.cpp | 5 +---- src/sfizz/Effects.h | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/sfizz/Effects.cpp b/src/sfizz/Effects.cpp index 81cc3d00..2ca5b8a4 100644 --- a/src/sfizz/Effects.cpp +++ b/src/sfizz/Effects.cpp @@ -119,8 +119,6 @@ void EffectBus::addToInputs(const float* const addInput[], float addGain, unsign if (addGain == 0) return; - _hasSignal = true; - for (unsigned c = 0; c < EffectChannels; ++c) { absl::Span addIn { addInput[c], nframes }; sfz::multiplyAdd1(addGain, addIn, _inputs.getSpan(c).first(nframes)); @@ -165,8 +163,6 @@ void EffectBus::process(unsigned nframes) fx::Nothing().process( AudioSpan(_inputs), AudioSpan(_outputs), nframes); } - - _hasSignal = false; } void EffectBus::mixOutputsTo(float* const mainOutput[], float* const mixOutput[], unsigned nframes) @@ -185,6 +181,7 @@ size_t EffectBus::numEffects() const noexcept { return _effects.size(); } + void EffectBus::setSamplesPerBlock(int samplesPerBlock) noexcept { _inputs.resize(samplesPerBlock); diff --git a/src/sfizz/Effects.h b/src/sfizz/Effects.h index 25ce96e5..804bc4ad 100644 --- a/src/sfizz/Effects.h +++ b/src/sfizz/Effects.h @@ -109,7 +109,7 @@ public: /** @brief Checks whether this bus can produce output. */ - bool hasNonZeroOutput() const { return _hasSignal && (_gainToMain != 0 || _gainToMix != 0); } + bool hasNonZeroOutput() const { return (_gainToMain != 0 || _gainToMix != 0); } /** @brief Sets the amount of effect output going to the main. @@ -189,7 +189,6 @@ private: AudioBuffer _outputs { EffectChannels, config::defaultSamplesPerBlock }; float _gainToMain { Default::effect }; float _gainToMix { Default::effect }; - bool _hasSignal { false }; }; } // namespace sfz