29enum class LinkwitzRileyFilterType
47template <
typename SampleType>
52 using Type = LinkwitzRileyFilterType;
67 Type
getType() const noexcept {
return filterType; }
81 template <
typename ProcessContext>
82 void process (
const ProcessContext& context)
noexcept
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() <= s1.size());
90 jassert (inputBlock.getNumChannels() == numChannels);
91 jassert (inputBlock.getNumSamples() == numSamples);
93 if (context.isBypassed)
95 outputBlock.copyFrom (inputBlock);
99 for (
size_t channel = 0; channel < numChannels; ++channel)
101 auto* inputSamples = inputBlock.getChannelPointer (channel);
102 auto* outputSamples = outputBlock.getChannelPointer (channel);
104 for (
size_t i = 0; i < numSamples; ++i)
105 outputSamples[i] =
processSample ((
int) channel, inputSamples[i]);
108 #if JUCE_DSP_ENABLE_SNAP_TO_ZERO
114 SampleType
processSample (
int channel, SampleType inputValue);
119 void processSample (
int channel, SampleType inputValue, SampleType &outputLow, SampleType &outputHigh);
133 std::vector<SampleType> s1, s2, s3, s4;
135 double sampleRate = 44100.0;
136 SampleType cutoffFrequency = 2000.0;
137 Type filterType = Type::lowpass;
void prepare(const ProcessSpec &spec)
void setType(Type newType)
void process(const ProcessContext &context) noexcept
SampleType getCutoffFrequency() const noexcept
SampleType processSample(int channel, SampleType inputValue)
void setCutoffFrequency(SampleType newCutoffFrequencyHz)
Type getType() const noexcept
void snapToZero() noexcept