30template <
typename SampleType>
36 for (
auto n = 0; n < numStages; ++n)
39 filters[n]->setType (FirstOrderTPTFilterType::allpass);
42 dryWet.setMixingRule (DryWetMixingRule::linear);
45template <
typename SampleType>
54template <
typename SampleType>
63template <
typename SampleType>
69 normCentreFrequency =
mapFromLog10 (centreFrequency,
static_cast<SampleType
> (20.0),
static_cast<SampleType
> (
jmin (20000.0, 0.49 * sampleRate)));
72template <
typename SampleType>
81template <
typename SampleType>
91template <
typename SampleType>
97 sampleRate =
spec.sampleRate;
99 for (
auto n = 0; n < numStages; ++n)
100 filters[n]->prepare (
spec);
102 dryWet.prepare (
spec);
103 feedbackVolume.resize (
spec.numChannels);
104 lastOutput.resize (
spec.numChannels);
111 bufferFrequency.setSize (1, (
int)
specDown.maximumBlockSize,
false,
false,
true);
117template <
typename SampleType>
120 std::fill (lastOutput.begin(), lastOutput.end(),
static_cast<SampleType
> (0));
122 for (
auto n = 0; n < numStages; ++n)
128 oscVolume.reset (sampleRate / (
double) maxUpdateCounter, 0.05);
130 for (
auto&
vol : feedbackVolume)
131 vol.reset (sampleRate, 0.05);
136template <
typename SampleType>
139 osc.setFrequency (rate);
140 oscVolume.setTargetValue (depth * (SampleType) 0.5);
141 dryWet.setWetMixProportion (mix);
143 for (
auto&
vol : feedbackVolume)
144 vol.setTargetValue (feedback);
A first order filter class using the TPT (Topology-Preserving Transform) structure.
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 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.
constexpr Type jmin(Type a, Type b)
Returns the smaller 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...
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.
unsigned int uint32
A platform-independent 32-bit unsigned integer type.
Type mapFromLog10(Type valueInLogRange, Type logRangeMin, Type logRangeMax)
Remaps a logarithmic value in a target range to a normalised value (between 0 and 1).
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...