Call function when HOST bypasses plugin?

I am developing a delay-based plugin effect that utilizes a circular buffer (https://en.wikipedia.org/wiki/Circular_buffer) data structure; basically input is saved into an MyPlugin::AudioProcessor member array as it arrives and can be called up later to construct a delayed signal.

One issue I am having is that, if I turn the plugin “off” in the DAW (bypass it by host), and then later turn the plugin back on, all of the old stuff is still loaded into the circular buffer. I’d like to start over with a fresh buffer if the plugin is ever bypassed, but i’m not sure how to go about doing this.

I tried overwriting the processBlockBypassed() function to clear the circular buffer, but it seems that the host does not call this function when bypassing the plugin. I also tried having the buffer cleared on prepareToPlay(), but it seems that this is only called when the plugin is loaded the first time.

I suppose I can include my own bypass switch and encourage users to use this instead of turning the plugin off through the host, but would like to work around this if possible for better functionality.

Any ideas or workarounds? I am relatively inexperienced in c++ and this is my first JUCE program, so I apologize if I am polluting the forum with a trivial question. I appreciate the help in advance!

This has been asked many times already. Short answer bypass call is optional. Usually though the prepareToPlay or reset would be where you’d clear your circular.

If still needed,
You can try approximating though.
Keep a member tracking last call to processBlock and if it wasn’t called in the past N milliseconds, clear your buffer (just don’t allocate :grinning:).

I‘ve got the same problem, it‘s a shame we can‘t implement click-free bypass using certain Hosts (VST3 on Ableton 10 for example)…

This discussion needs to be with those developers…
JUCE implemented the API properly. it’s up to the host to decide how they do things…
Even Apple’s Logic Pro X don’t use the Audio-Unit bypass API (which can be tested on MOTU Digital Performer). So the issue is purely on the host side…

It seems that reset() has done the trick, at least when hosted in Ableton 10 where I am testing my plugin. I will also implement a bypass swtich that will act as a catch-all.

Thanks so much!