39template <
typename SampleType>
81 template <
typename ProcessContext>
84 const auto& inputBlock = context.getInputBlock();
85 auto& outputBlock = context.getOutputBlock();
86 const auto numChannels = outputBlock.getNumChannels();
87 const auto numSamples = outputBlock.getNumSamples();
89 jassert (inputBlock.getNumChannels() == numChannels);
90 jassert (inputBlock.getNumChannels() == lastOutput.
size());
91 jassert (inputBlock.getNumSamples() == numSamples);
93 if (context.isBypassed)
95 outputBlock.copyFrom (inputBlock);
100 auto counter = updateCounter;
102 for (
size_t i = 0; i < numSamples; ++i)
109 if (counter == maxUpdateCounter)
127 auto lfo =
jlimit (
static_cast<SampleType
> (0.0),
128 static_cast<SampleType
> (1.0),
132 static_cast<SampleType
> (
jmin (20000.0, 0.49 * sampleRate)));
136 dryWet.pushDrySamples (inputBlock);
138 for (
size_t channel = 0; channel < numChannels; ++channel)
140 counter = updateCounter;
143 auto*
inputSamples = inputBlock .getChannelPointer (channel);
144 auto*
outputSamples = outputBlock.getChannelPointer (channel);
146 for (
size_t i = 0; i < numSamples; ++i)
149 auto output = input - lastOutput[channel];
151 if (i == 0 && counter != 0)
152 for (
int n = 0; n < numStages; ++n)
157 for (
int n = 0; n < numStages; ++n)
163 for (
int n = 0; n < numStages; ++n)
164 output = filters[n]->processSample ((
int) channel, output);
167 lastOutput[channel] = output * feedbackVolume[channel].getNextValue();
171 if (counter == maxUpdateCounter)
176 dryWet.mixWetSamples (outputBlock);
177 updateCounter = (updateCounter + (
int) numSamples) % maxUpdateCounter;
189 DryWetMixer<SampleType> dryWet;
191 AudioBuffer<SampleType> bufferFrequency;
192 SampleType normCentreFrequency = 0.5;
193 double sampleRate = 44100.0;
195 int updateCounter = 0;
196 static constexpr int maxUpdateCounter = 4;
198 SampleType rate = 1.0, depth = 0.5, feedback = 0.0, mix = 0.5;
199 SampleType centreFrequency = 1300.0;
200 static constexpr int numStages = 6;
Type * getWritePointer(int channelNumber) noexcept
Returns a writeable pointer to one of the buffer's channels.
An array designed for holding objects.
A utility class for values that need smoothing to avoid audio glitches.
Generates a signal based on a user-supplied function.
A 6 stage phaser that modulates first order all-pass filters to create sweeping notches in the magnit...
void prepare(const ProcessSpec &spec)
Initialises the processor.
void process(const ProcessContext &context) noexcept
Processes the input and output samples supplied in the processing context.
void reset()
Resets the internal state variables of the processor.
void setDepth(SampleType newDepth)
Sets the volume (between 0 and 1) of the LFO modulating the phaser all-pass filters.
void setFeedback(SampleType newFeedback)
Sets the feedback volume (between -1 and 1) of the phaser.
void setMix(SampleType newMix)
Sets the amount of dry and wet signal in the output of the phaser (between 0 for full dry and 1 for f...
void setRate(SampleType newRateHz)
Sets the rate (in Hz) of the LFO modulating the phaser all-pass filters.
void setCentreFrequency(SampleType newCentreHz)
Sets the centre frequency (in Hz) of the phaser all-pass filters modulation.
Type mapToLog10(Type value0To1, Type logRangeMin, Type logRangeMax)
Remaps a normalised value (between 0 and 1) to a logarithmic target range.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
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...