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/isBypassedto theAudioProcessorclass. 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 callsetBypassto bypass your own plug-in (for example from your plug-in’s editor). - We add a
bypassChangedcallback toAudioProcessorListener -
processBlock/processBlockBypassed: to remain backward compatible, your plug-in will still receiveprocessBlockBypassedcalls 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 anAudioProcessorwill always need to queryAudioProcessor::isBypassedand then call eitherprocessBlock/processsBlockBypasseddepending on the value. This makes hostingAudioProcessors more complicated but I don’t see a way around this. - What happens if you, as a host of a VST/VST3/AU, call
processsBlockBypassedeven ifisBypassedis currently false (or vice versa: callprocesssBlockwhenisBypassedis true)? First of all, in the future, hosts should not do this, but for the sake of backward compatibility, I think thatprocesssBlockBypassedalways takes precedence regardless of whatisBypassedactually is currently. If the plug-in is currently not bypassed then a call toprocesssBlockBypassedwill bypass the plug-in untilprocessBlockis 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?
