I’m trying to “link” some knobs together, so when linked, the linked knobs will take the value of the one they are linked to. In this particular module I have an A-, B-, C- and D-Section, and when linked I want to set the value of the B-, C- and D-knobs to the value of the A-knobs. The following piece of code is executed every 256th cycle:
if (params[LINK_SCALE_PARAM].getValue() > 0.5f) {
float scale = params[A_SCALE_PARAM].getValue();
float scaleTrim = params[A_SCALE_TRIM_PARAM].getValue();
for (int i = 0; i < 3; i++) {
params[B_SCALE_PARAM + i].setValue(scale);
params[B_SCALE_TRIM_PARAM + i].setValue(scaleTrim);
}
}
When I enable Link-mode (latched button), all C-D knobs switch to the value of the A-knobs (as they should). However I can still in the GUI rotate (e.g.) the D-scale knob. I had expected that as soon as I release the mouse, the D-scale knob would snap back to the value of the A-scale knob. If I instead rotate the C-scale knob with the mouse, then the D-scale snaps to the value of the A-scale, but now C-scale is out of sync?
If I rotate the A-knob or disable/enable link, all C- and D-knobs snap back to the A-knobs values. All of the knobs are the default RoundSmallBlackKnob and with regard to the scale-knobs defined with a -1 to +1 range.
In a different module I have a RoundSmallBlackKnob for dialing in channel-count (fixed values from 1 to 16). In this module I have a button to toggle between automatic/manual channel count. In manual mode the user can freely choose count, and in auto-mode the knob will automatic snap to the channel-count of the detected input signal. Like the previous code, this is executed every 256th cycle:
bool useAutoCount = params[AUTO_CHANNEL_COUNT_PARAM].getValue() > 0.5f;
inChannels = haveInput
? inputs[POLY_INPUT].getChannels()
: 1;
if (useAutoCount) {
outChannels = inChannels;
params[MAN_CHANNEL_COUNT_PARAM].setValue((int)outChannels);
}
else {
outChannels = (int)params[MAN_CHANNEL_COUNT_PARAM].getValue();
}
In this module the knob behaves exactly as I expect. When you tries to rotate the knob while in auto-mode it will snap-back to the actual channel count. The only difference I can see from the previous module and this module is that the first module lets the user pick an arbitrary value between -1 and +1, where is the 2nd module is fixed at 16 values (1-16).



