LadderFiler process block size in SyntheserVoice


#1

Hi, I’m trying to use the LadderFilter in a SynthesiserVoice process.
I’m trying to make a process block with:

void renderNextBlock(AudioBuffer< float > &outputBuffer, int startSample, int numSamples) override
{
.
.
.

AudioBlock<float> block(outputBuffer,(size_t)startSample);
ladderFilter.process(ProcessContextReplacing<float>(block));		

Like in the demos. But unfortunately it doesn’t include a numSamples. The incomming block is the Maximum block size which is incorrect for processing.

I can’t be doing this right, can someone point me in the right direction please? Thanks.


#2

You can create your AudioBlock in a different way:
AudioBlock<float> block (outputBuffer.getArrayOfWritePointers(), outputBuffer.getNumChannels(), static_cast<size_t> (startSamples), static_cast<size_t> (numSamples));


#3

OK Thanks, I didn’t connect the channelData with the float arrays, thanks. I’ve since found out that was still the wrong one, because I need the channel number:

AudioBlock<float> block(outputBuffer.getArrayOfWritePointers(), outputBuffer.getNumChannels(), static_cast<size_t> (startSample), static_cast<size_t> (numSamples));

And wow, that’s one expensive filter!! :slight_smile:


#4

Oh sorry, I forget the number of channels! I edited my previous post to the correct function call.
Btw: never judge a digital filter without compiling in Release mode :wink:


#5

Still pricey though man, but it does sound nice…