Basically I want the editor to stop responding to mouse events while the plugin is turned off.
So I need to detect when the plugin is turned On or Off. Is this possible?
Thank you
Andres
Basically I want the editor to stop responding to mouse events while the plugin is turned off.
So I need to detect when the plugin is turned On or Off. Is this possible?
Thank you
Andres
typically the host sends buffers with numSamples == 0 when it wants to tell the plugin that thereâs nothing to process rn. you could use these moments to set some atomic bool to false, which could then be read by the editor
Not sure what you mean by turned On or Off. Do you mean when Bypassed vs. not Bypassed? When the Editor is shown versus not shown? When Activated in a host that has an Activate (On/Off) button instead of (or in addition to) their Bypass button?
VST3 hosts can call setActive(bool) to tell a plugin that it is âactiveâ or not. That gets fed to the more generic functions prepareToPlay() (after which the transport is allowed to start) and releaseResources(), after which the transport is not expected to run.
Not sure if this helps, but if you need more info, then we could use more info from you as to exactly what you mean by On and Off (and whether youâre targeting a specific plugin type, such as VST3).
Thank you @Mrugalla and @HowardAntares
Sorry if it was not clear. By On/Off I try to indicate whether the plugin is actively processing audio or not.
By pressing this button on Logic the plugin alternates states On/OffâŠ
What I did was check if the âprocessBlockâ in being called or not.
That button only affects Logicâs behavior, I think. Pro Tools also has an Activate/De-Activate button that does a similar thing. The plugin is not told of this change, as far as I know. It just stops the plugin from receiving audio during playback. A kind of âhard bypassâ, I guess.
Some hosts have this, some do not. VST3 plugins have a setActive(bool) function as I mentioned earlier, but not AU or AAX. There is a master bypass, but that is different, and (if hooked up in the plugin) will allow you to detect that condition.
But detecting if the transport has been called recently does not tell you if it will be called at any moment. Logic stops calling processBlock() when the transport is stopped if youâre using an audio effect or midi-controlled audio effect, and also stops calling the plugin when the transport is running but there is no audio in that part of the track. (Unless you use a certain trick to allow it, and are white-listed by them for that explicit purpose.)
Solving for a Logic-specific may not be the way to get the behavior you want in all AU hosts, though, given that this control is Logic only.
I donât know why you would not want to allow the plugin to respond to the mouse when de-activated like this, though. I would assume that users will quite likely want to still interact with the plugin when de-activated, in order to set up the plugin with the settings they want when they do re-activate the plugin. It lets you keep the transport running while making changes that do not affect the output until you re-activate it, so it seems useful to keep your editor alive regardless of the state of that button in Logic.
The tests are done only on Logic, Reaper, ProTools and Ableton and fortunately, so far it has behaved as expected. The mouse response is only for a couple drag-n-drop dots that need to be unresponsive in this state.
But wonât it also disable that ability if you simply stop the transport in Logic, or if the transport is in an area with no audio on that portion of the track? Or are you not using an audio effect or midi-controlled audio effect? It does receive callbacks when using a generator or instrument (unless that button is turned Off).
If the DAW does not provide any notification of this state, you can use a âwatchdogâ.
The idea is that everytime the DAW call the process function, you update a counter.
On the GUI side, you âwatchâ that counter, if it stops incrementing for too long, you can assume that the DAW is no longer calling the process function.
This is precisely what I do. Thank you.
Hello this is Gulshan Negi
Well, yes you can detect whether a JUCE plugin is turned on or off by utilizing either the plugin parameters or the host automation system.
Thanks
This topic interests me but I donât see the obvious solution in any posted answer (not obvious to me anyway).
I have created a VST3 plugin modeled after the JUCE Arpeggiator effect example. I want to be able to know when the effect is bypassed or not. Iâm using Cakewalk by Bandlab as a test host.
setActive(bool) is a member of the ApplicationCommandInfo struct. I donât see how that struct can be woven into my plugin source code so I can access setActive(). Iâm not convinced the function is even correct for my task.
Would somebody please provide some example code snippets or point to some example code that does what I need?
Thanks - JJS
Iâm going to attempt to start to answer this question and hopefully Iâll be steered correctly:
This Steinberg forum thread link says âIn order to implement audio process bypassing, the Plug-in can export a parameter which is additionally and exclusively flagged as having the attribute kIsBypassâ in the third entry by Arne_Scheffler. That advice correlates to a comment related to the kIsBypass parameter flag in the ParameterInfo definition in ivsteditcontroller.h from the JUCE modules directory. It says âspecial bypass parameter (only one allowed): plug-in can handle bypass (highly recommended to export a bypass parameter for effect plug-in)â
That advice tells me I need to create a plugin parameter, and set the parameter flag kIsBypass. It sounds easy but I am not able to see how to set the flag after calling addParameter(). Can anyone help with that?
You can override the getBypassParameter()
function in your audio processor.
See the documentation in juce_AudioProcessor.h
Thanks, rcohen. I think youâre saying:
I assume the host will call getBypassParameter() so the host can set or clear the bypass parameter as the host desires.
Is that correct?
Is the kIsBypass flag implicitly set in that case?
Hello @johnspeth .
Yes, I think you have it correct.
Hereâs a code snippet from juce_VST3_Wrapper.cpp:
if (isBypassParameter)
info.flags |= Vst::ParameterInfo::kIsBypass;
I just tested the code I described in my 3 step plan. Unfortunately Cakewalk by Bandlab does not call the pluginsâ getBypassParameter() function. Actuating the Bypass checkbox on the plugin GUI does correctly toggle the Bypass state. Based on those observations, either:
My Juce installation does not have any juce_VST3_Wrapper.cpp file. In fact, the file is nowhere on my computer, which includes my source directories. Why is that? It seems there is some sort of tool difference. This difference makes me think Iâm creating the bypass parameter incorrectly.