Add a helper to apply a gain span to effect inputs

Used for ramping out voice data
This commit is contained in:
Paul Ferrand 2020-05-07 20:48:48 +02:00
parent 91fc783b49
commit 691c25362b
2 changed files with 16 additions and 0 deletions

View file

@ -109,6 +109,17 @@ void EffectBus::addToInputs(const float* const addInput[], float addGain, unsign
}
}
void EffectBus::applyGain(const float* gain, unsigned nframes)
{
if (!gain)
return;
absl::Span<const float> gainSpan { gain, nframes };
for (unsigned c = 0; c < EffectChannels; ++c) {
sfz::applyGain<float>(gainSpan, _inputs.getSpan(c));
}
}
void EffectBus::setSampleRate(double sampleRate)
{
for (const auto& effectPtr : _effects)

View file

@ -136,6 +136,11 @@ public:
*/
void addToInputs(const float* const addInput[], float addGain, unsigned nframes);
/**
@brief Apply a gain to the inputs
*/
void applyGain(const float* gain, unsigned nframes);
/**
@brief Initializes all effects in the bus with the given sample rate.
*/