How shut down a Processor?

Hi, I’m trying a way to shut down an audio processor, my aim is to make this audio processor (audioProcessor, AudioProcessorGraph or AudioPluginInstance) completely invisible to cpu.
I was trying in Juce Plug-In Host the function “Toggle Bypass” that call setBypassed, but calling it the processor is only muted, I was searching for a way to shut down completely the processor (more like cubase “Shut Down Plugin” or “Disable Track”). How ro achieve it?

I don’t get “completely invisible to cpu”. The CPU is just the physical hardware that the code runs on, and does not access your Processor class. Your Processor code runs on a CPU (when assigned to do so in the current timeslice).

Are you writing a host, or a plugin, or…?

You can choose what happens in your plugin when bypassed. You can simply bail out of the processBlock (or processBlockBypassed) function when bypassed.

1 Like

Really thank you for your reply!

I’m writing a simple host like mainstage were tracks are divided in scenes (as I’m doing in mainstage now with about 120 plug-ins of which 40 instances of kontakt). I need to load a tons of plugins, but shut them off if they’re not included in the current scene the performer is playing. (I’d like also to fade from scene to another as actually it happens in main stage, but this will be another problem… :sweat_smile:)

Hi, has anyone an idea for this topic? :blush:

Actually, setBypassed makes the audioprocessor runs processBlockBypassed(), which I guess if you don’t override it your AP doesn’t do anything (which should make it not influent to CPU performance). The documentation says: " you may override this method e.g. to add latency compensation to the data to match the processor’s latency characteristics. This will avoid situations where bypassing will shift the signal forward in time, possibly creating pre-echo effects and odd timings."

1 Like

If you’re writing a host and you want to bypass a plugin’s processor, just don’t call its processBlock() and the plugin won’t do anything. Make sure you’ve emptied the audiobuffer before stopping the plugin from processing.

1 Like

It might take a bit more thought. Most plugins are stateful, so if you just skip a few processBlock calls because it was bypassed and start calling it again later, you get artifacts.

a) you should run for getTailLengthSeconds() longer and
b) you might need to pump getLatencySamples() samples ahead of playing

2 Likes

Really really thank you fo advices!!

1 Like