35template <
typename SampleType>
59 template <
typename ProcessContext>
60 void process (
const ProcessContext& context)
noexcept
62 const auto& inputBlock = context.getInputBlock();
63 auto& outputBlock = context.getOutputBlock();
64 const auto numChannels = outputBlock.getNumChannels();
65 const auto numSamples = outputBlock.getNumSamples();
67 jassert (inputBlock.getNumChannels() == numChannels);
68 jassert (inputBlock.getNumSamples() == numSamples);
70 if (context.isBypassed)
72 outputBlock.copyFrom (inputBlock);
76 firstStageCompressor.process (context);
79 secondStageCompressor.process (secondContext);
81 outputBlock.multiplyBy (outputVolume);
83 for (
size_t channel = 0; channel < numChannels; ++channel)
85 FloatVectorOperations::clip (outputBlock.getChannelPointer (channel), outputBlock.getChannelPointer (channel),
86 (SampleType) -1.0, (SampleType) 1.0, (
int) numSamples);
98 double sampleRate = 44100.0;
99 SampleType thresholddB = -10.0, releaseTime = 100.0;
void process(const ProcessContext &context) noexcept
void setThreshold(SampleType newThreshold)
void prepare(const ProcessSpec &spec)
void setRelease(SampleType newRelease)