Hmmm… adding this feature in a non-breaking way that makes sense is actually quite hard. I’ve got @t0m 's suggestion sitting on a branch but @anthony-nicholls correctly points out that this would result in confusing behaviour. But then we also have processBlockBypassed
vs. processBlock
which all still needs to make sense no matter if you are a plug-in or a host. We also need to think of the use case when you are implementing an editor for your plug-in and want to bypass your own plug-in (when the user clicks on a bypass button in your editor).
The only way I can think of making this all work is the following:
- we add
setBypass
/isBypassed
to theAudioProcessor
class. These are not callbacks but methods that both a host and a plug-in can call. As a host you can call these methods to bypass the plug-in or check if the user has bypassed the plug-in (to update your host’s UI, for example). As a plug-in you can also callsetBypass
to bypass your own plug-in (for example from your plug-in’s editor). - We add a
bypassChanged
callback toAudioProcessorListener
-
processBlock
/processBlockBypassed
: to remain backward compatible, your plug-in will still receiveprocessBlockBypassed
calls when the plug-in is bypassed. To ensure this even if you are hosting an internalAudioProcessor
(i.e. not a plug-in: what @yfede points out), any code hosting anAudioProcessor
will always need to queryAudioProcessor::isBypassed
and then call eitherprocessBlock
/processsBlockBypassed
depending on the value. This makes hostingAudioProcessor
s more complicated but I don’t see a way around this. - What happens if you, as a host of a VST/VST3/AU, call
processsBlockBypassed
even ifisBypassed
is currently false (or vice versa: callprocesssBlock
whenisBypassed
is true)? First of all, in the future, hosts should not do this, but for the sake of backward compatibility, I think thatprocesssBlockBypassed
always takes precedence regardless of whatisBypassed
actually is currently. If the plug-in is currently not bypassed then a call toprocesssBlockBypassed
will bypass the plug-in untilprocessBlock
is called again. Getting this right (without any race conditions) in JUCE’s plug-in code will be a bit of a challenge but I think it’s doable.
What do you guys think? I’m I missing anything?