35template <
typename SampleType>
65 template <
typename ProcessContext>
68 const auto& inputBlock = context.getInputBlock();
69 auto& outputBlock = context.getOutputBlock();
70 const auto numChannels = outputBlock.getNumChannels();
71 const auto numSamples = outputBlock.getNumSamples();
73 jassert (inputBlock.getNumChannels() == numChannels);
74 jassert (inputBlock.getNumSamples() == numSamples);
76 if (context.isBypassed)
78 outputBlock.copyFrom (inputBlock);
82 for (
size_t channel = 0; channel < numChannels; ++channel)
84 auto* inputSamples = inputBlock .getChannelPointer (channel);
85 auto* outputSamples = outputBlock.getChannelPointer (channel);
87 for (
size_t i = 0; i < numSamples; ++i)
88 outputSamples[i] =
processSample ((
int) channel, inputSamples[i]);
93 SampleType
processSample (
int channel, SampleType inputValue);
100 SampleType threshold, thresholdInverse, currentRatio;
103 double sampleRate = 44100.0;
104 SampleType thresholddB = -100, ratio = 10.0, attackTime = 1.0, releaseTime = 100.0;
A processor to apply standard attack / release ballistics to an input signal.
A simple noise gate with standard threshold, ratio, attack time and release time controls.
void prepare(const ProcessSpec &spec)
Initialises the processor.
SampleType processSample(int channel, SampleType inputValue)
Performs the processing operation on a single sample at a time.
void setRelease(SampleType newRelease)
Sets the release time in milliseconds of the noise-gate.
void setRatio(SampleType newRatio)
Sets the ratio of the noise-gate (must be higher or equal to 1).
void process(const ProcessContext &context) noexcept
Processes the input and output samples supplied in the processing context.
void setAttack(SampleType newAttack)
Sets the attack time in milliseconds of the noise-gate.
void setThreshold(SampleType newThreshold)
Sets the threshold in dB of the noise-gate.
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...