I am new to JUCE library but I am trying to implement a processor that needs to have an input that will always be bigger than the block size. Let’s say 60/75 ms for example. I’ve implemented a circular buffer to fill the buffer in each process block, but was wondering if it is possible to only write the output buffer each n calls to the processBlock. I found this topic:
where @benvining provides and example of this with an increasing latency counter and a privateProcessBlock.
I am a little bit lost in this regard and would love to know if this is possible and if anyone has an example of how to increase the latency in the process block and only write to the output buffer when the buffer is filled.
The way it works is that you create a subclass of this engine class, declare a constant blocksize/latency, then from your top-level plugin processBlock(), simply call engine.process() with however many samples the host set you that callback.
In your subclass, override the renderBlock() method. That fuction will always be called with a consistent # of samples - the blocksize you declared.
The engine will output 0’s until it has enough samples to process (that’s the latency part), and it can also take care of anti-click fades when bypassing and un-bypassing.
Thank you so much for the help! That makes a lot of sense. If it is possible it’s going to solve me a lot of problems. I will definitely take a look at the code and try to understand and adapt from it.