|
12-18-2017, 02:51 AM
|
#1
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
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.
|
|
|
12-18-2017, 03:37 PM
|
#2
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
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);
|
|
|
12-19-2017, 10:16 AM
|
#3
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Bobflip
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?
|
|
|
12-19-2017, 10:30 AM
|
#4
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
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.
|
|
|
12-19-2017, 11:09 AM
|
#5
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Bobflip
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.
|
|
|
12-19-2017, 11:10 AM
|
#6
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
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" ;-)
|
|
|
12-19-2017, 11:15 AM
|
#7
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
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);
|
|
|
12-19-2017, 11:29 AM
|
#8
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
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.
|
|
|
12-20-2017, 03:03 AM
|
#9
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Bobflip
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.
|
|
|
12-20-2017, 03:08 AM
|
#10
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
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, "");
|
|
|
12-20-2017, 03:13 AM
|
#11
|
Human being with feelings
Join Date: Apr 2016
Posts: 264
|
Quote:
Originally Posted by Bobflip
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.);
|
|
|
12-20-2017, 03:25 AM
|
#12
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
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.
|
|
|
04-24-2018, 08:17 AM
|
#13
|
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
I've tried linking controls using the above where a boolean parameter controls whether to link sets of other parameters.
I've got a strange issue in that although the dials & the custom XY control view of the values are updating correctly, the caption controls that display their values underneath as text are not updating when linked.
Why would other controls update fine, but not captions? When I am not linking the parameters, then captions work again.
|
|
|
04-24-2018, 08:34 AM
|
#14
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
Not sure atm, can you post a bit of code/pseudocode?
|
|
|
04-24-2018, 08:54 AM
|
#15
|
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
Setting up two X parameters that can be linked and appears in two sets of 3 controls - each set has an XY pad view, a dial for X, and a caption control to show X value & allow text entry updates.
Code:
GetParam(kPanner1 + kX)->InitDouble("1.LR", 0., -100., +100., 1., "LR");
GetParam(kPanner2 + kX)->InitDouble("2.LR", 0., -100., +100., 1., "LR");
Adding 3 controls for each of these X parameters.
Code:
// Attach 1.X controls
pGraphics->AttachControl(new IXYPad(this, gridLayout(0, 1, 4, 4), kPanner1));
pGraphics->AttachControl(new IDialControl(this, gridLayout(0, 5), kPanner1 + kX, &lineColor));
IText text1X = IText(14);
ICaptionControl* caption1X = new ICaptionControl(this, gridLayout(0, 6), kPanner1 + kX, &text1X);
caption1X->DisablePrompt(false);
pGraphics->AttachControl(caption1X);
// Attach 2.X controls
pGraphics->AttachControl(new IXYPad(this, gridLayout(5, 1, 4, 4), kPanner2));
pGraphics->AttachControl(new IDialControl(this, gridLayout(5, 5), kPanner2 + kX, &lineColor));
IText text2X = IText(14);
ICaptionControl* caption2X = new ICaptionControl(this, gridLayout(5, 6), kPanner2 + kX, &text2X);
caption2X->DisablePrompt(false);
pGraphics->AttachControl(caption2X);
Linking the parameters (X & Y can be flipped i.e. mirrored/opposite values)
Code:
if (GetGUI()) {
// Force update on controls for all parameters
GetGUI()->SetParameterFromPlug(paramIdx, GetParam(paramIdx)->Value(), false);
}
// Handle parameter linking
if (GetParam(kLinkPanners)->Bool()) {
if (paramIdx >= kPanner1 + kX && paramIdx <= kPanner1 + kDFB) {
// panner 1 changed
int offset = paramIdx - kPanner1;
bool flip = (GetParam(kFlipX)->Bool() && offset == kX) || (GetParam(kFlipY)->Bool() && offset == kY);
if (flip) {
GetGUI()->SetParameterFromPlug(kPanner2 + offset, 1.0 - GetParam(kPanner1 + offset)->Value(), false);
} else {
GetGUI()->SetParameterFromPlug(kPanner2 + offset, GetParam(kPanner1 + offset)->Value(), false);
}
} else if (paramIdx >= kPanner2 + kX && paramIdx <= kPanner2 + kDFB) {
int offset = paramIdx - kPanner2;
bool flip = (GetParam(kFlipX)->Bool() && offset == kX) || (GetParam(kFlipY)->Bool() && offset == kY);
if (flip) {
GetGUI()->SetParameterFromPlug(kPanner1 + offset, 1.0 - GetParam(kPanner2 + offset)->Value(), false);
} else {
GetGUI()->SetParameterFromPlug(kPanner1 + offset, GetParam(kPanner2 + offset)->Value(), false);
}
};
}
Why would the XYPad and Dials work fine, but not the captions when linked?
Last edited by mrlimbic; 04-24-2018 at 09:04 AM.
|
|
|
04-24-2018, 09:30 AM
|
#16
|
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
Quote:
Originally Posted by mrlimbic
Why would the XYPad and Dials work fine, but not the captions when linked?
|
Actually it's not always the captions, sometimes it's the dial, depending on which parameter is being linked.
Here is how it is behaving as gif.
First show all 3 controls work unlinked. After when linked only 2 work, 1 doesn't update.
|
|
|
04-24-2018, 09:34 AM
|
#17
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
Can't see what it could be offhand, hopefully someone else can spot it. Is IDialControl your own thing inherited from IKnobControl?
|
|
|
04-24-2018, 09:41 AM
|
#18
|
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
Quote:
Originally Posted by Bobflip
Can't see what it could be offhand, hopefully someone else can spot it. Is IDialControl your own thing inherited from IKnobControl?
|
Yes Dial control is basically same as knob control but with a circle added. At this stage I don't really want to get into making images for the UI, so drawing really basic controls.
The problem seems very inconsistent.
Maybe it depends on the parameter index order of what is being linked. Different controls stop working if they are before or after.
You can see that when linked if I alter the left side vs the right side, then different controls stop working.
Last edited by mrlimbic; 04-24-2018 at 09:48 AM.
|
|
|
04-24-2018, 06:09 PM
|
#19
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
I presume you've also added all the GetParam(param)->SetIsMeta(true) calls?
|
|
|
04-25-2018, 05:17 AM
|
#20
|
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
Quote:
Originally Posted by Bobflip
I presume you've also added all the GetParam(param)->SetIsMeta(true) calls?
|
I have tried with GetParam(param)->SetIsMeta(true) and without. It didn't seem to make any noticeable difference.
What is the purpose of the meta flag?
|
|
|
04-25-2018, 05:42 AM
|
#21
|
Human being with feelings
Join Date: Nov 2016
Posts: 341
|
I don't know specifically what it does, but it's needed for controls that affect other controls. Could try setting it for all the ones that are being affected as well.
I've had similar issues, and it can take a bit of prodding to solve. With breakpoints and printf lines you can trace the path and see where things aren't being updated. I'll put printfs showing the control and parameter values in ProcessDoubleReplacing to see if it's the kParameter, Control, or the display that isn't being changed. Also breakpoints and printfs in the IDialControl to make sure that it's redrawing when it ought to be, and what the value there is.
There's a few different ways of setting a control's value, and I get confused as to which is best for what!
|
|
|
05-01-2018, 03:46 PM
|
#22
|
Human being with feelings
Join Date: Sep 2009
Posts: 623
|
Quote:
Originally Posted by mrlimbic
I have tried with GetParam(param)->SetIsMeta(true) and without. It didn't seem to make any noticeable difference.
What is the purpose of the meta flag?
|
Without it, it won't pass AU validation.
|
|
|
05-03-2018, 09:45 AM
|
#23
|
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
I solved the linking/updating issue by adding one line.
Code:
GetParam(kPanner2 + offset)->Set(value);
GetGUI()->SetParameterFromPlug(kPanner2 + offset, value, false);
SetParameterFromPlug isn't enough on it's own. I needed to also set the linked parameter's value directly. Doh!
I didn't do this originally as I thought it would create an infinite parameter change loop but somehow it doesn't.
Last edited by mrlimbic; 05-03-2018 at 02:30 PM.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:31 AM.
|