44template <
typename SampleType>
86 template <
typename ProcessContext>
89 const auto& inputBlock = context.getInputBlock();
90 auto& outputBlock = context.getOutputBlock();
91 const auto numChannels = outputBlock.getNumChannels();
92 const auto numSamples = outputBlock.getNumSamples();
94 jassert (inputBlock.getNumChannels() == numChannels);
95 jassert (inputBlock.getNumChannels() == lastOutput.
size());
96 jassert (inputBlock.getNumSamples() == numSamples);
98 if (context.isBypassed)
100 outputBlock.copyFrom (inputBlock);
113 for (
size_t i = 0; i < numSamples; ++i)
115 auto lfo =
jmax (
static_cast<SampleType
> (1.0), maximumDelayModulation *
delaySamples[i] + centreDelay);
119 dryWet.pushDrySamples (inputBlock);
121 for (
size_t channel = 0; channel < numChannels; ++channel)
123 auto*
inputSamples = inputBlock .getChannelPointer (channel);
124 auto*
outputSamples = outputBlock.getChannelPointer (channel);
126 for (
size_t i = 0; i < numSamples; ++i)
129 auto output = input - lastOutput[channel];
131 delay.pushSample ((
int) channel, output);
133 output = delay.popSample ((
int) channel);
136 lastOutput[channel] = output * feedbackVolume[channel].getNextValue();
140 dryWet.mixWetSamples (outputBlock);
152 DryWetMixer<SampleType> dryWet;
154 AudioBuffer<SampleType> bufferDelayTimes;
156 double sampleRate = 44100.0;
157 SampleType rate = 1.0, depth = 0.25, feedback = 0.0, mix = 0.5,
160 static constexpr SampleType maxDepth = 1.0,
161 maxCentreDelayMs = 100.0,
162 oscVolumeMultiplier = 0.5,
163 maximumDelayModulation = 20.0;
Type * getWritePointer(int channelNumber) noexcept
Returns a writeable pointer to one of the buffer's channels.
A utility class for values that need smoothing to avoid audio glitches.
A simple chorus DSP widget that modulates the delay of a delay line in order to create sweeping notch...
void setFeedback(SampleType newFeedback)
Sets the feedback volume (between -1 and 1) of the chorus delay line.
void setDepth(SampleType newDepth)
Sets the volume of the LFO modulating the chorus delay line (between 0 and 1).
void prepare(const ProcessSpec &spec)
Initialises the processor.
void setMix(SampleType newMix)
Sets the amount of dry and wet signal in the output of the chorus (between 0 for full dry and 1 for f...
void reset()
Resets the internal state variables of the processor.
void process(const ProcessContext &context) noexcept
Processes the input and output samples supplied in the processing context.
void setRate(SampleType newRateHz)
Sets the rate (in Hz) of the LFO modulating the chorus delay line.
void setCentreDelay(SampleType newDelayMs)
Sets the centre delay in milliseconds of the chorus delay line modulation.
A delay line processor featuring several algorithms for the fractional delay calculation,...
Generates a signal based on a user-supplied function.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
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...