Add a helper to apply a gain span to effect inputs
Used for ramping out voice data
This commit is contained in:
parent
91fc783b49
commit
691c25362b
2 changed files with 16 additions and 0 deletions
|
|
@ -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)
|
void EffectBus::setSampleRate(double sampleRate)
|
||||||
{
|
{
|
||||||
for (const auto& effectPtr : _effects)
|
for (const auto& effectPtr : _effects)
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void addToInputs(const float* const addInput[], float addGain, unsigned nframes);
|
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.
|
@brief Initializes all effects in the bus with the given sample rate.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue