开发者

VST GUI Feedback (C++)

开发者 https://www.devze.com 2023-02-21 06:23 出处:网络
I have implemented a VST 2.4 GUI (C++) with 2 vertical faders. In code I have linked the 2 so one is scaled to the other. So Basically I want to say that fader2 is always half the value of fader1:

I have implemented a VST 2.4 GUI (C++) with 2 vertical faders.

In code I have linked the 2 so one is scaled to the other. So Basically I want to say that fader2 is always half the value of fader1:

fader1 = 1.0; 
fader2 = fader1 / 2; 

Fairly simple in code, but what functionality do I need to add so that this 'feeds back' to the G开发者_如何学CUI; so that when the fader1 slider is moved, the slider on fader2 also moves (in ratio) with the display variable updating also?

I presume it must work in a similar way to setParameterAutomated within 'valueChanged'

the reason why I am implementing this is that I have a switch that will link the 2 faders to this ratio. So when it is off, each fader can be set independently; but when it is on, fader1 is moved and fader2 moves with it at a ratio of 2:1


When you move your slider, it calls the editor valueChanged() method, which in turns, calls the effect setParameterAutomated().

setParameterAutomated(), internally, calls setParameter(). This method is virtual, you should override it so that it sets the value of the parameter associated with the 2nd fader to whatever you want it to be. Just don't forget to call AEffectX::setParameter() too.

Then, whatever mechanism you have in place for notifying the UI of parameter changes will kick in, and your 2nd fader will move properly.

You have to do it this way, so that the 2nd fader moves, regardless of why the 1st fader moved (either because the user dragged it, or because the host sent automation events to it).

0

精彩评论

暂无评论...
验证码 换一张
取 消