Cockos Incorporated Forums

Cockos Incorporated Forums (https://forum.cockos.com/index.php)
-   WDL users forum (https://forum.cockos.com/forumdisplay.php?f=32)
-   -   Linking knobs (https://forum.cockos.com/showthread.php?t=200889)

Tunca 12-18-2017 02:51 AM

Linking knobs
 
Hi,

I have an EQ plugin.It has L/R dual mono processing.But i want to it L/R link.

Any easy solution for this?

Thanks.

Bobflip 12-18-2017 03:37 PM

You'll need to activate the meta flag for controls that are to be modified by other controls like this:

Code:

GetParam(kParameterNameL)->SetIsMeta(true);
GetParam(kParameterNameR)->SetIsMeta(true);

And then in OnParamChange set them like this:

Code:

case kParameterNameL:
        GetGUI()->SetParameterFromPlug(kParameterNameR, GetParam(kParameterNameL)->Value(), false);


Tunca 12-19-2017 10:16 AM

Quote:

Originally Posted by Bobflip (Post 1927890)
You'll need to activate the meta flag for controls that are to be modified by other controls like this:

Code:

GetParam(kParameterNameL)->SetIsMeta(true);
GetParam(kParameterNameR)->SetIsMeta(true);

And then in OnParamChange set them like this:

Code:

case kParameterNameL:
        GetGUI()->SetParameterFromPlug(kParameterNameR, GetParam(kParameterNameL)->Value(), false);


Thanks!

But something is wrong,i guess...

When i link knobs,working great.But when i unlink,right knob still depending left knob.But it goes all the way up or down.

Am i doing something wrong?

Bobflip 12-19-2017 10:30 AM

Well, the code I put in was pretty skeletal, you'll need to put your own if statements to check if Link is activated or not, and you also need to duplicate that code for the R knob, swapping the left and right parameter names over.

Tunca 12-19-2017 11:09 AM

Quote:

Originally Posted by Bobflip (Post 1928224)
Well, the code I put in was pretty skeletal, you'll need to put your own if statements to check if Link is activated or not, and you also need to duplicate that code for the R knob, swapping the left and right parameter names over.

I did what you said.

Created mLink."true" or "false".Duplicated for R knob...

When i unlink,R knob going crazy while playing with L knob.

Bobflip 12-19-2017 11:10 AM

You need to post code with these types of questions, at the moment the only answer we can give to "am I doing something wrong?" is "probably" ;-)

Tunca 12-19-2017 11:15 AM

Oh sorry.

Here is my codes...

Code:


    int Link = GetParam(kLink)->Value();
    if (Link == 0)
      mLink =  false;
    else if (Link == 1)
      mLink = true;

Code:


GetParam(kGainLL)->SetIsMeta(mLink);
GetParam(kGainLR)->SetIsMeta(mLink);

Code:


case kGainLL:
        GetGUI()->SetParameterFromPlug(kGainLR, GetParam(kGainLL)->Value(), mLink);

case kGainLR:
        GetGUI()->SetParameterFromPlug(kGainLL, GetParam(kGainLR)->Value(), mLink);


Bobflip 12-19-2017 11:29 AM

This jumped out:

GetParam(kGainLL)->SetIsMeta(mLink);
GetParam(kGainLR)->SetIsMeta(mLink);

IsMeta is a flag rather than a parameter. change the mLink in the brackets to true.

Tunca 12-20-2017 03:03 AM

Quote:

Originally Posted by Bobflip (Post 1928259)
This jumped out:

GetParam(kGainLL)->SetIsMeta(mLink);
GetParam(kGainLR)->SetIsMeta(mLink);

IsMeta is a flag rather than a parameter. change the mLink in the brackets to true.

Ok but still same.I can't use R knob when unlinked knobs.

R knob shows only all the way up or down.

R knob still depending L knob.If i play with R knob,there is no problem.But if i play with L knob,R knob moving,too while they are unlinked.

Bobflip 12-20-2017 03:08 AM

It sounds like it's reading the parameter as an int rather than float. Have you set up the control with anything like this?

GetParam(kParamL)->InitDouble("Parameter L", 0.5, 0.0, 1.0, 0.01, "");

Tunca 12-20-2017 03:13 AM

Quote:

Originally Posted by Bobflip (Post 1928529)
It sounds like it's reading the parameter as an int rather than float. Have you set up the control with anything like this?

GetParam(kParamL)->InitDouble("Parameter L", 0.5, 0.0, 1.0, 0.01, "");

Yes,i did like this.

Code:


  GetParam(kGainLL)->InitDouble("GainLL", 0., -18., 18., 0.01, "%");
  GetParam(kGainLL)->SetShape(1.);
 
  GetParam(kGainLR)->InitDouble("GainLR", 0., -18., 18., 0.01, "%");
  GetParam(kGainLR)->SetShape(1.);


Bobflip 12-20-2017 03:25 AM

Not sure offhand what's causing the issue, but just noticed you also changed the 'false' in the SetParameterFromPlug calls to 'mLink'. It's worth looking over the definitions of these functions when you first use them to get a gist of the variables they require.

This one has a comment saying:
// Normalized means the value is in [0, 1].
void ClampControl(int paramIdx, double lo, double hi, bool normalized);
void SetParameterFromPlug(int paramIdx, double value, bool normalized);

Don't think it'll clear your problem up but it's worth correcting anyway.


All times are GMT -7. The time now is 10:51 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.