Hi,
I have created a GUI with the VST GUI editor. There is a CParamDisplay element in the UI which is connected to a parameter and updates continuously. While that parameter is shown I would like to change the color from time to time. For this purpose, I add a sub controller tag and obtain a pointer reference to my CParamDisplay element. Now, I can set the color if the right condition is detected.
However, unfortunately, when setting up the sub controller, the automatic parameter binding seems to stop working. What I then did was to add the function to update the CParamDisplay element by calling setDirty() in the setParamNormalized function and using the string conversion function lambda to address the right parameter - which works. But is that really the recommended way to handle it? Or can I somehow re-attach the parameter binding even when attaching a sub controller?
Thank you and best regards
Hauke
Hi Hauke,
have a look at the DelegationController class. If you use that as a base for your custom controller, you should be able to do what you want to do without loosing automatic parameter binding. Just make sure to always call the base class if you override one of the methods.
Cheers,
Arne
Hi Arne,
thank you very much. Works like a charme :-).
I just had to find out that the DelegationController requires a link to the VST3Editor reference which holds the sub controller references.
Thank you and best regards
Hauke
Hi. I know that is an old story. But i am absolute not clear with that DelegetationController class. Following my concerns:
" If you want to be notified about value changes for controls in your sub-controller but don’t want to loose the you can add your sub-controller as dependent of the control:"
But my subcontroller should handle not only one Control, instead it handles a CViewContainer. The CViewContainer is not a Control where i have a Object, which i can put as Constructor Parameter like:
MyController (IController* baseController)
Instead i construct the subcontroller with:
MyController (EditController*)
Because of this the example doesnt work, because if i change the constructor to MyController (IController* baseController) i cannot create the Subcontroller anymore.
What i have to do?
Ok, i did it. But this is another example why the docs on github are a mess:
If you build a new project with the project generator then the maincontroller call the createSubController with VST3Editor*. NOT with an IController*. So to make the example work you have to change the constructor from IController* to VST3Editor*
in your Subcontroller Class:
SubGainController(VST3Editor* baseController) : DelegationController(baseController)
In your MainControllerClass now you can create your subcontroller with overwritten createSubController:
IController* MainController::createSubController(
UTF8StringPtr name, const IUIDescription* /*description*/, VST3Editor* editor)
{
if (UTF8StringView(name) == "subController")
{
return new SubController(editor);
}
return nullptr;
}
Now you can listen to ALL Parameters in your SubControllerClass without losing the ParameterBinding if you call the parent methodes of the overwritten methodes.