0

我已经实现了一个带有 2 个垂直推子的 VST 2.4 GUI (C++)。

在代码中,我已经链接了 2,所以一个缩放到另一个。所以基本上我想说fader2总是fader1值的一半:

fader1 = 1.0; 
fader2 = fader1 / 2; 

代码相当简单,但我需要添加什么功能才能“反馈”到 GUI;这样当推子 1 滑块移动时,推子 2 上的滑块也会随着显示变量的更新而移动(按比例)?

我认为它必须以与“valueChanged”中的 setParameterAutomated 类似的方式工作

我实现这个的原因是我有一个开关可以将 2 个推子连接到这个比率。所以当它关闭时,每个推子都可以独立设置;但是当它打开时,推子 1 移动,推子 2 以 2:1 的比例移动

4

1 回答 1

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).

于 2011-05-27T01:54:54.543 回答