Hello,
I have problem with dsp::IIR::Filter::processSample() depend on channel change order in processBlock(). When I iterate through channels for each sample it’s OK. But when I iterate through all samples for each channel then I get unpleasent sound for right channel. Please see my code below.
I mean that, when I have code like that:
for (int channel = 0; channel < numOfMainInputChannels; ++channel)
{
for (int i = 0; i < buffer.getNumSamples(); ++i)
{
float sample = getBusBuffer(buffer, true, _busIndex).getSample(channel, i);
filteredSample = myLowCutFilter.processSample(sample);
buffer.getWritePointer(channel)[i] = filteredSample;
}
}
lowCutFilter.snapToZero();
It generates some artefacted, unpleasent sound on right channel. But left channel sounds OK.
But when I change my code like that:
for (int i = 0; i < buffer.getNumSamples(); ++i)
{
for (int channel = 0; channel < numOfMainInputChannels; ++channel)
{
float sample = getBusBuffer(buffer, true, _busIndex).getSample(channel, i);
filteredSample = myLowCutFilter.processSample(sample);
buffer.getWritePointer(channel)[i] = filteredSample;
}
}
lowCutFilter.snapToZero();
Then everything works great for both channels.
Why is that? Is it regular behaviour? Or I do something wrong?
For any help thanks in advance.
Best regards
