I have a lowpass filter like:
juce::dsp::FIR::Filter<float> lowpass;
auto coefficients = juce::dsp::FilterDesign<float>::designFIRLowpassTransitionMethod(cutoffFrequency,reader->sampleRate, filterOrder,0.01f, 4.0f);
lowpass.coefficients = *coefficients;
Processing samples manually works fine, but when I try using “process”, it doesn’t work:
Doesn’t work:
juce::dsp::AudioBlock<float> block(audioBuffer);
juce::dsp::ProcessContextReplacing<float> context(block);
lowpass.reset();
lowpass.prepare(juce::dsp::ProcessSpec{.sampleRate = static_cast<double>(sampleRate), .maximumBlockSize = static_cast<juce::uint32>(bufferSampleSize), .numChannels = static_cast<juce::uint32>(numChannels)});
lowpass.process(context);
Works:
for (int i = 0; i < audioBuffer.getNumSamples(); i++){
for(int c=0; c<numChannels; c++){
audioBuffer.setSample(c, i, lowpass.processSample(audioBuffer.getSample(c,i)));
}
}
What am I doing wrong? processSample works when I manually process every sample in every channel, but for some reason calling process on my audio buffer using ProcessContextReplacing doesn’t work (the audio is unchanged). Any ideas?
