Pass the buffer size to effects

This commit is contained in:
Jean Pierre Cimalando 2020-03-06 23:50:11 +01:00
parent 1f91bf0f66
commit 0360dfa3b6
6 changed files with 31 additions and 0 deletions

View file

@ -138,6 +138,9 @@ void EffectBus::setSamplesPerBlock(int samplesPerBlock) noexcept
{ {
_inputs.resize(samplesPerBlock); _inputs.resize(samplesPerBlock);
_outputs.resize(samplesPerBlock); _outputs.resize(samplesPerBlock);
for (const auto& effectPtr : _effects)
effectPtr->setSamplesPerBlock(samplesPerBlock);
} }
} // namespace sfz } // namespace sfz

View file

@ -32,6 +32,12 @@ public:
*/ */
virtual void setSampleRate(double sampleRate) = 0; 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. @brief Reset the state to initial.
*/ */

View file

@ -53,6 +53,11 @@ namespace fx {
} }
} }
void Lofi::setSamplesPerBlock(int samplesPerBlock)
{
(void)samplesPerBlock;
}
void Lofi::clear() void Lofi::clear()
{ {
for (unsigned c = 0; c < EffectChannels; ++c) { for (unsigned c = 0; c < EffectChannels; ++c) {

View file

@ -21,6 +21,12 @@ namespace fx {
*/ */
void setSampleRate(double sampleRate) override; 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. * @brief Reset the state to initial.
*/ */

View file

@ -15,6 +15,11 @@ namespace fx {
(void)sampleRate; (void)sampleRate;
} }
void Nothing::setSamplesPerBlock(int samplesPerBlock)
{
(void)samplesPerBlock;
}
void Nothing::clear() void Nothing::clear()
{ {
} }

View file

@ -20,6 +20,12 @@ namespace fx {
*/ */
void setSampleRate(double sampleRate) override; 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. * @brief Reset the state to initial.
*/ */