diff --git a/src/sfizz/Effects.cpp b/src/sfizz/Effects.cpp index c31f245e..512f2b5e 100644 --- a/src/sfizz/Effects.cpp +++ b/src/sfizz/Effects.cpp @@ -138,6 +138,9 @@ void EffectBus::setSamplesPerBlock(int samplesPerBlock) noexcept { _inputs.resize(samplesPerBlock); _outputs.resize(samplesPerBlock); + + for (const auto& effectPtr : _effects) + effectPtr->setSamplesPerBlock(samplesPerBlock); } } // namespace sfz diff --git a/src/sfizz/Effects.h b/src/sfizz/Effects.h index 0ea8d195..1c1edfeb 100644 --- a/src/sfizz/Effects.h +++ b/src/sfizz/Effects.h @@ -32,6 +32,12 @@ public: */ virtual void setSampleRate(double sampleRate) = 0; + /** + * @brief Sets the maximum number of frames to render at a time. The actual + * value can be lower but should never be higher. + */ + virtual void setSamplesPerBlock(int samplesPerBlock) = 0; + /** @brief Reset the state to initial. */ diff --git a/src/sfizz/effects/Lofi.cpp b/src/sfizz/effects/Lofi.cpp index fdd511d1..1fcc3304 100644 --- a/src/sfizz/effects/Lofi.cpp +++ b/src/sfizz/effects/Lofi.cpp @@ -53,6 +53,11 @@ namespace fx { } } + void Lofi::setSamplesPerBlock(int samplesPerBlock) + { + (void)samplesPerBlock; + } + void Lofi::clear() { for (unsigned c = 0; c < EffectChannels; ++c) { diff --git a/src/sfizz/effects/Lofi.h b/src/sfizz/effects/Lofi.h index 1c745154..9b97c6e3 100644 --- a/src/sfizz/effects/Lofi.h +++ b/src/sfizz/effects/Lofi.h @@ -21,6 +21,12 @@ namespace fx { */ void setSampleRate(double sampleRate) override; + /** + * @brief Sets the maximum number of frames to render at a time. The actual + * value can be lower but should never be higher. + */ + void setSamplesPerBlock(int samplesPerBlock) override; + /** * @brief Reset the state to initial. */ diff --git a/src/sfizz/effects/Nothing.cpp b/src/sfizz/effects/Nothing.cpp index 47a3f8b0..d2101de1 100644 --- a/src/sfizz/effects/Nothing.cpp +++ b/src/sfizz/effects/Nothing.cpp @@ -15,6 +15,11 @@ namespace fx { (void)sampleRate; } + void Nothing::setSamplesPerBlock(int samplesPerBlock) + { + (void)samplesPerBlock; + } + void Nothing::clear() { } diff --git a/src/sfizz/effects/Nothing.h b/src/sfizz/effects/Nothing.h index 12326897..2ac27600 100644 --- a/src/sfizz/effects/Nothing.h +++ b/src/sfizz/effects/Nothing.h @@ -20,6 +20,12 @@ namespace fx { */ void setSampleRate(double sampleRate) override; + /** + * @brief Sets the maximum number of frames to render at a time. The actual + * value can be lower but should never be higher. + */ + void setSamplesPerBlock(int samplesPerBlock) override; + /** * @brief Reset the state to initial. */