Connecting two different value type knobs & inverting one...
-
Hey all,
Any ideas on how to do the following? I've searched through the forum, checked out the documentation and also @d-healey vids to no avail... Apologies if I missed it somewhere!
- Connect two knobs (both with different value types)
- One controls Saturation level in % (0-100) - this one wants to control the second one.
- One controls Post Gain in dB (-24 to 0) - Then turn the Post Gain knob into a inverted control so it actually goes from (0 to -24)
It's a head scratcher, and I'm probably missing something obvious... Using the 'linkTo' function is not an option it appears, as the range and default type of the dB control gets overwritten to mirror the % type of the other control. Then trying this via standard 'setAttribute' isn't working because the values are not matched. As for inverting the dB control, I'm completely at a loss...
Thanks for any light shed!
- Connect two knobs (both with different value types)
-
@bm_forum you need to use normalisedToRange, and then set the values accordingly.
Here's a bunch of code I've used recently which uses one knob to change multiple other knobs. I'd be interested if there's a better way of doing it though? @d-healey @ustk
inline function normalisedToRange(normalisedValue, min, max) { return min + normalisedValue * (max - min); } inline function onMAINControl(component, value) { local v1 = normalisedToRange(value, 0, 7); local v2 = normalisedToRange(value, 0, 7); local v3 = normalisedToRange(value, 0, 1); local v4 = normalisedToRange(value, 100, 170); LF.setValue(v1); HF.setValue(v2); SATURATION.setValue(v3); WIDTH.setValue(v4); LF.changed(); HF.changed(); SATURATION.changed(); WIDTH.changed(); }; Content.getComponent("MAIN").setControlCallback(onMAINControl);
-
@danh That is the good way to do it, except if you have many values you might want to make a loop...
-
@danh Amazing, thanks! Worked like a charm