30template <
typename SampleType>
33 thresholddB = newThreshold;
37template <
typename SampleType>
40 releaseTime = newRelease;
45template <
typename SampleType>
53 firstStageCompressor.prepare (spec);
54 secondStageCompressor.prepare (spec);
60template <
typename SampleType>
63 firstStageCompressor.reset();
64 secondStageCompressor.reset();
66 outputVolume.reset (sampleRate, 0.001);
70template <
typename SampleType>
74 firstStageCompressor.setRatio ((SampleType) 4.0);
75 firstStageCompressor.setAttack ((SampleType) 2.0);
76 firstStageCompressor.setRelease ((SampleType) 200.0);
78 secondStageCompressor.setThreshold (thresholddB);
79 secondStageCompressor.setRatio ((SampleType) 1000.0);
80 secondStageCompressor.setAttack ((SampleType) 0.001);
81 secondStageCompressor.setRelease (releaseTime);
83 auto ratioInverse = (SampleType) (1.0 / 4.0);
85 auto gain = (SampleType)
std::pow (10.0, 10.0 * (1.0 - ratioInverse) / 40.0);
88 outputVolume.setTargetValue (gain);
92template class Limiter<float>;
93template class Limiter<double>;
static Type decibelsToGain(Type decibels, Type minusInfinityDb=Type(defaultMinusInfinitydB))
Converts a dBFS value to its equivalent gain level.
A simple limiter with standard threshold and release time controls, featuring two compressors and a h...
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.
void reset()
Resets the internal state variables of the processor.
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...
uint32 numChannels
The number of channels that the process() method will be expected to handle.
double sampleRate
The sample rate that will be used for the data that is sent to the processor.