Accessing other controls/views pointers from inside ValueChanged()

I’m closing our move from VST2 to VST3 (at last). Still something to understand.

I’m not able to do this:

  • On plugin’s GUI, I move a control.
  • Depending on this control’s value, another control’s alpha changes.

I would do this:

  • From inside ValueChanged():
    if (tag == firstcontroltag) {secondcontrol->setAlpha(somevalue);}

How can I get a reference to the second control/view?
I was used to having all the pointers as I used to define the controls manually inside Open() but now they are all managed by the controller through the uidesc.

Is the whole concept wrong? How to affect controls’ appearance depending on the settings of other controls?

(In this case, I want to grey-out the controls that are not active in the dinamicly selected (by the user) operating-mode of the plugin ).


I think that indeed conceptually it is wrong.

You need to think about the problem in terms of parameters (the underlying data) not in terms of control (the UI representation of the value).

For example you can have a parameter that represents a gain and then you have 2 controls: 1 that lets you modify it (like a knob), and another one that simply displays an LED that is “on” if the gain is not “0” (as in no sound). You would not implement this by having the LED control references the knob control and then do something like “if the knob all the way to the left then display LED off image otherwise display LED on image”). Instead each control would use the same “gain” parameter and render the UI according to the state of this parameter.

Of course what makes it challenging with VST3 is that if you want to use more complex parameters (only parameters that are double in the range [0.0, 1.0] are allowed) or if you need a control whose state depends on 2 (or more) parameters it is just not built-in. My framework (Jamba implements this on top of VST3, so clearly it can be implemented, but it is a ton of work when you want to go beyond 1 control 1 simple parameter.

Ok, the question itself was wrong (and pongasoft was right, of course). The right one would had been: how to access controls’ properties when they are created from the xml file?

The answer is using subcontrollers, like in several other topics here.
The subcontroller for the control needs to be linked to the additional parameters that affect the control. It takes care of notifying the subcontroller, that acts on the control, every time the linked parameter(s) change.