37 template <
typename FloatType>
41 Gain() noexcept =
default;
59 if (rampDurationSeconds != newDurationSeconds)
61 rampDurationSeconds = newDurationSeconds;
76 sampleRate = spec.sampleRate;
84 gain.
reset (sampleRate, rampDurationSeconds);
89 template <
typename SampleType>
96 template <
typename ProcessContext>
97 void process (
const ProcessContext& context) noexcept
99 auto&& inBlock = context.getInputBlock();
100 auto&& outBlock = context.getOutputBlock();
102 jassert (inBlock.getNumChannels() == outBlock.getNumChannels());
103 jassert (inBlock.getNumSamples() == outBlock.getNumSamples());
105 auto len = inBlock.getNumSamples();
106 auto numChannels = inBlock.getNumChannels();
108 if (context.isBypassed)
110 gain.
skip (static_cast<int> (len));
112 if (context.usesSeparateInputAndOutputBlocks())
113 outBlock.copyFrom (inBlock);
118 if (numChannels == 1)
120 auto* src = inBlock.getChannelPointer (0);
121 auto* dst = outBlock.getChannelPointer (0);
123 for (
size_t i = 0; i < len; ++i)
128 auto* gains =
static_cast<FloatType*
> (alloca (
sizeof (FloatType) * len));
130 for (
size_t i = 0; i < len; ++i)
133 for (
size_t chan = 0; chan < numChannels; ++chan)
135 inBlock.getChannelPointer (chan),
136 gains,
static_cast<int> (len));
143 double sampleRate = 0, rampDurationSeconds = 0;
FloatType getNextValue() noexcept
FloatType getTargetValue() const noexcept
FloatType skip(int numSamples) noexcept
void setRampDurationSeconds(double newDurationSeconds) noexcept
void reset(double sampleRate, double rampLengthInSeconds) noexcept
static void JUCE_CALLTYPE multiply(float *dest, const float *src, int numValues) noexcept
void setGainLinear(FloatType newGain) noexcept
bool isSmoothing() const noexcept
SampleType JUCE_VECTOR_CALLTYPE processSample(SampleType s) noexcept
FloatType getGainDecibels() const noexcept
void process(const ProcessContext &context) noexcept
void prepare(const ProcessSpec &spec) noexcept
void setTargetValue(FloatType newValue) noexcept
void setGainDecibels(FloatType newGainDecibels) noexcept
FloatType getGainLinear() const noexcept
double getRampDurationSeconds() const noexcept
bool isSmoothing() const noexcept