35template <
typename SampleType>
59 template <
typename ProcessContext>
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);
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;
A utility class for values that need smoothing to avoid audio glitches.
A simple compressor with standard threshold, ratio, attack time and release time controls.
A simple limiter with standard threshold and release time controls, featuring two compressors and a h...
void process(const ProcessContext &context) noexcept
Processes the input and output samples supplied in the processing context.
void setThreshold(SampleType newThreshold)
Sets the threshold in dB of the limiter.
void prepare(const ProcessSpec &spec)
Initialises the processor.
void setRelease(SampleType newRelease)
Sets the release time in milliseconds of the limiter.
Limiter()=default
Constructor.
void reset()
Resets the internal state variables of the processor.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...