Linked parameters

SDK for VST 3 audio plug-in and host development.
trecords
Posts: 2
Joined: Sun May 06, 2018 10:26 am

Linked parameters

Postby trecords » Sun Aug 05, 2018 9:16 pm

Hi everyone!

Please advise me how to do that. There are two parameters in my plugin, named "Left" and "Right". Also I have a "Link" button. I want to change these two parameters simultaneously when the "Link" button is pressed. I.e. when I move the "Left" slider, the "Right" slider have to move simultaneously with the "Left" slider or vice versa.

Thanks.

pongasoft
Posts: 43
Joined: Sun Mar 11, 2018 5:57 pm

Re: Linked parameters

Postby pongasoft » Tue Aug 07, 2018 1:23 pm

I am not sure if this is the best way or if there is better solution but something which should work:

- in the processing code, you keep track of the link state (you use data.inputParameterChanges to keep track of this state when it changes)
- you also detect using data.inputParameterChanges that the left or right control parameter has changed
- when you detect that one of them has changed and the link flag is true, then you change the other one by writing it to data.outputParameterChanges

Example of code using data.inputParameterChanges https://github.com/pongasoft/jamba/blob ... te.cpp#L52

Example of code using data.outputParameterChanges https://github.com/pongasoft/jamba/blob ... er.cpp#L29

There may be another solution using a sub controller but I have never used it.

Yan

pongasoft
Posts: 43
Joined: Sun Mar 11, 2018 5:57 pm

Re: Linked parameters

Postby pongasoft » Tue Aug 28, 2018 2:49 pm

I wanted to add to this topic since I last posed: when you asked your question I was working on the Jamba framework code example and this gave me the idea to extend the example to have 2 separate gain sliders (instead of 1) that would be linked via a Link toggle:

Image

Implementing it with Jamba turned out to be straightforward (and a validation that the concepts in the framework were reasonable). You can find the actual code here https://github.com/pongasoft/jamba-sample-gain/blob/v1.0.1/src/cpp/GUI/LinkedSliderView.cpp (the code is heavily documented because it serves as an example so this is why it relatively "big")

The "generic" version (which only uses tags) is implemented in the same file (line 153) and the main logic demonstrates that it is rather straightforward.

Code: Select all

void GenericLinkedSliderView::onParameterChange(ParamID iParamID)
{
  // Note: fLink is the toggle, fSlider is "this" slider, fLinkedSlider is the other slider
#if EDITOR_MODE
  if(!fLink.exists() || !fSlider.exists() || !fLinkedSlider.exists())
    return;
#endif

  if(fLinkedSlider.getParamID() == iParamID)
  {
    if(fLink && fSlider != fLinkedSlider)
      fSlider.copyValueFrom(fLinkedSlider);
    return;
  }

  if(fLink.getParamID() == iParamID)
  {
    if(fLink && fSlider.getValue() < fLinkedSlider.getValue())
      fSlider.copyValueFrom(fLinkedSlider);
    return;
  }
}


Unlike what I stated in my previous post, the logic is purely UI. The Real Time code doesn't even know about the link concept and always get a left gain and a right gain (which happens to be the same when link is enabled).

Yan


Return to “VST 3 SDK”

Who is online

Users browsing this forum: No registered users and 2 guests