30template <
typename SampleType>
33 auto oscFunction = [] (SampleType x) {
return std::sin (x); };
34 osc.initialise (oscFunction);
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>
68 centreFrequency = newCentreHz;
69 normCentreFrequency =
mapFromLog10 (centreFrequency,
static_cast<SampleType
> (20.0),
static_cast<SampleType
> (
jmin (20000.0, 0.49 * sampleRate)));
72template <
typename SampleType>
75 jassert (newFeedback >=
static_cast<SampleType
> (-1.0) && newFeedback <=
static_cast<SampleType
> (1.0));
77 feedback = newFeedback;
81template <
typename SampleType>
91template <
typename SampleType>
99 for (
auto n = 0; n < numStages; ++n)
100 filters[n]->prepare (spec);
102 dryWet.prepare (spec);
106 auto specDown = spec;
108 specDown.maximumBlockSize = specDown.maximumBlockSize / (
uint32) maxUpdateCounter + 1;
110 osc.prepare (specDown);
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);
148template class Phaser<float>;
149template class Phaser<double>;
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.
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...
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.