30template <
typename SampleType>
33 auto oscFunction = [] (SampleType x) {
return std::sin (x); };
34 osc.initialise (oscFunction);
36 dryWet.setMixingRule (DryWetMixingRule::linear);
39template <
typename SampleType>
48template <
typename SampleType>
57template <
typename SampleType>
62 centreDelay =
jlimit (
static_cast<SampleType
> (1.0), maxCentreDelayMs, newDelayMs);
65template <
typename SampleType>
68 jassert (newFeedback >=
static_cast<SampleType
> (-1.0) && newFeedback <=
static_cast<SampleType
> (1.0));
70 feedback = newFeedback;
74template <
typename SampleType>
84template <
typename SampleType>
92 const auto maxPossibleDelay =
std::ceil ((maximumDelayModulation * maxDepth * oscVolumeMultiplier + maxCentreDelayMs)
93 * sampleRate / 1000.0);
97 dryWet.prepare (spec);
102 bufferDelayTimes.setSize (1, (
int) spec.
maximumBlockSize,
false,
false,
true);
108template <
typename SampleType>
111 std::fill (lastOutput.begin(), lastOutput.end(),
static_cast<SampleType
> (0));
117 oscVolume.reset (sampleRate, 0.05);
119 for (
auto& vol : feedbackVolume)
120 vol.reset (sampleRate, 0.05);
123template <
typename SampleType>
126 osc.setFrequency (rate);
127 oscVolume.setTargetValue (depth * oscVolumeMultiplier);
128 dryWet.setWetMixProportion (mix);
130 for (
auto& vol : feedbackVolume)
131 vol.setTargetValue (feedback);
135template class Chorus<float>;
136template class Chorus<double>;
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 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,...
void prepare(const ProcessSpec &spec)
Initialises the processor.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
bool isPositiveAndNotGreaterThan(Type1 valueToTest, Type2 upperLimit) noexcept
Returns true if a value is at least zero, and also less than or equal to a specified upper limit.
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Returns true if a value is at least zero, and also below a specified upper limit.
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.
uint32 maximumBlockSize
The maximum number of samples that will be in the blocks sent to process() method.