Adas
February 17, 2020, 11:59am
#1
I want to make calculations only on particular buffers, for example every other, or every 20th buffer. Rest of the buffers should be processed without changes.
I am creating a plugin and modify buffer in
processBlock(AudioBuffer<float>& buffer, MidiBuffer& midiMessages);
function. How to do this?
daniel
February 17, 2020, 12:04pm
#2
You are aware, that there is no guarantee of a certain buffer size, so it will lead to arbitrary results if you rely on the number of buffers.
However to achieve this, just use a member variable:
void processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages) override
{
if (++sinceLastProcessing < 20)
return;
sinceLastProcessing = 0;
// ...
}
private:
int sinceLastProcessing = 0;
1 Like