30template <
typename SampleType>
37template <
typename SampleType>
44template <
typename SampleType>
53template <
typename SampleType>
60template <
typename SampleType>
68template <
typename SampleType>
74 sampleRate =
spec.sampleRate;
76 envelopeFilter.prepare (
spec);
82template <
typename SampleType>
85 envelopeFilter.reset();
89template <
typename SampleType>
93 auto env = envelopeFilter.processSample (channel,
inputValue);
97 :
std::pow (
env * thresholdInverse, ratioInverse -
static_cast<SampleType
> (1.0));
103template <
typename SampleType>
107 thresholdInverse =
static_cast<SampleType
> (1.0) / threshold;
108 ratioInverse =
static_cast<SampleType
> (1.0) / ratio;
110 envelopeFilter.setAttackTime (attackTime);
111 envelopeFilter.setReleaseTime (releaseTime);
static Type decibelsToGain(Type decibels, Type minusInfinityDb=Type(defaultMinusInfinitydB))
Converts a dBFS value to its equivalent gain level.
A simple compressor with standard threshold, ratio, attack time and release time controls.
void reset()
Resets the internal state variables of the processor.
void setThreshold(SampleType newThreshold)
Sets the threshold in dB of the compressor.
SampleType processSample(int channel, SampleType inputValue)
Performs the processing operation on a single sample at a time.
void prepare(const ProcessSpec &spec)
Initialises the processor.
void setAttack(SampleType newAttack)
Sets the attack time in milliseconds of the compressor.
void setRelease(SampleType newRelease)
Sets the release time in milliseconds of the compressor.
void setRatio(SampleType newRatio)
Sets the ratio of the compressor (must be higher or equal to 1).
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...