29enum class StateVariableTPTFilterType
56template <
typename SampleType>
61 using Type = StateVariableTPTFilterType;
87 Type
getType() const noexcept {
return filterType; }
103 void reset (SampleType newValue);
113 template <typename ProcessContext>
114 void process (const ProcessContext& context) noexcept
116 const auto& inputBlock = context.getInputBlock();
117 auto& outputBlock = context.getOutputBlock();
118 const auto numChannels = outputBlock.getNumChannels();
119 const auto numSamples = outputBlock.getNumSamples();
121 jassert (inputBlock.getNumChannels() <= s1.size());
122 jassert (inputBlock.getNumChannels() == numChannels);
123 jassert (inputBlock.getNumSamples() == numSamples);
125 if (context.isBypassed)
127 outputBlock.copyFrom (inputBlock);
131 for (
size_t channel = 0; channel < numChannels; ++channel)
133 auto* inputSamples = inputBlock .getChannelPointer (channel);
134 auto* outputSamples = outputBlock.getChannelPointer (channel);
136 for (
size_t i = 0; i < numSamples; ++i)
137 outputSamples[i] =
processSample ((
int) channel, inputSamples[i]);
140 #if JUCE_DSP_ENABLE_SNAP_TO_ZERO
147 SampleType
processSample (
int channel, SampleType inputValue);
155 std::vector<SampleType> s1 { 2 }, s2 { 2 };
157 double sampleRate = 44100.0;
158 Type filterType = Type::lowpass;
159 SampleType cutoffFrequency =
static_cast<SampleType
> (1000.0),
160 resonance =
static_cast<SampleType
> (1.0 / std::sqrt (2.0));
SampleType getResonance() const noexcept
void snapToZero() noexcept
void process(const ProcessContext &context) noexcept
void setType(Type newType)
void prepare(const ProcessSpec &spec)
SampleType getCutoffFrequency() const noexcept
void setResonance(SampleType newResonance)
SampleType processSample(int channel, SampleType inputValue)
void setCutoffFrequency(SampleType newFrequencyHz)
Type getType() const noexcept