How to link 2 knobs?
-
How can I do this:
When Knob1 value = 1
Set Knob2 value to 1.5 -
@titosg It depends. Is it linear? (so a simple Knob1 value + 0.5)
Does Knob1 need to react back when changing Knob2 or is it one way?Generally, a good way to set/link two sliders with different values is
(Don't forget to set the middlePosition of the knobs somewhere between min & max values or you'll get an error...)const var Knob1 = Content.getComponent("Knob1"); const var Knob2 = Content.getComponent("Knob2"); inline function onKnob1Control(component, value) { Knob2.setValueNormalized(component.getValueNormalized()); }; Knob1.setControlCallback(onKnob1Control); inline function onKnob2Control(component, value) { Knob1.setValueNormalized(component.getValueNormalized()); }; Knob2.setControlCallback(onKnob2Control);
-
HiseSnippet 839.3ocsV0tSaCCE0oTyV6VQCId.h5uR0XUoc.aRSSzQKvpX.UqLz9GxMwk5gicThKiJDR7Js2n8Hr2fsqSRIor.Cpz5+tebt2iu43qau.oCMLTFfLJczDeJx3439SDpQsGQXBT2NHikv6SBUz.yXWaMwmDFRcQFFKrq1gQohnne+ZysHbhvgl5BgNVxbneh4wTod60ZOFmuCwkdDyKS1q0pqiTzVxkiA9r.1F4SbNibJ8.hNsBXjwha6xTxf9JhhFB4rkzcR+QxuKhy+XVHa.mpMZf5CEJ1Mp8HF2s2zyZHBYTrW5Ieg3S9J38Ytra7mNAdQT.yTDYmAFElkREmgRMtKJsij6pKvcPOiLzqXL8VF22If4qRin41yvcEvGmgDXrmkVw4hJ7CCbaIjgPU2ibFcm.v3FDVaXaup45110dWkxUJCC+Pk44j.y8DxAMMeu4TnmRUskd9RAXXUMJZ0XLLAmInlCGKbTLovTJzQanAFH4VNSQsJTW9XZsJkurR4RQUndHUcr1o09D0n5dLgUrenaVU8HWTsVBJyWZZWe8Z5NdUTWuad0nZMccS5eaBmO.zPVyRKcgxv3CjJ5gBqZkurboxWU171gFNL2XIEiSCxMrVaGbe.sDi8FPClNYllH7AeVE0hOLEkS7LIShRQWAScnOMwNUy0HGMGJYnBpuBILDRUEo8VJQ60myboAHFTjmfilnnHxmdGdkVnGL3l4.9Kc6PTD8MfD5.TzmFnX5IgQG54v5j36Ckvcngmoj9Q7MQD.Sq+IiuHsger0jaLttSKOlqKm1SFxzeoRS6maBpwacFevMrYlFd82xzPztOhF926CfsRR2wbhZ1UU5cxIAzkL6NA88dAzpIY2Y+H1eYm69qb0ROP5tLtGS4LJe9VHG9pEm+m4axqAUvaObH0QkR1h3c957t5+QPkOKGqXhSgchALPCfOXrWe3AQGJvDgfxgFgMJnuuFaaqs0Sl9TgajwugeIAansMRB1XZPjGwIPdhS7EU86MOMxCvIQzSskf27Aayatdiw10sQfbkchiidT7Jf64io4bf40yAl0lCLqOGX1XNv7l4.yauWL5+AxGFqjdwWS.G81NZSogw1BBnxhTjn+zUzbBD
-
- It depends. Is it linear? Yes, it is linear
- Does Knob1 need to react back when changing Knob2 or is it one way? I want to set specific values for each value, for example:
when Knob1 is 1->Knob2 is 1.5
when Knob1 is 2->Knob2 is 6
when Knob1 is 13>Knob2 is 7.3
Is it possible to do that?
-
@d-healey What is that code? I've seen it in some posts but I don't know what it is or how to use it
-
@titosg It's a snippet. Copy it, then in HISE go to File >> Import HISE snippet
-
@titosg said in How to link 2 knobs?:
- It depends. Is it linear? Yes, it is linear
- Does Knob1 need to react back when changing Knob2 or is it one way? I want to set specific values for each value, for example:
when Knob1 is 1->Knob2 is 1.5
when Knob1 is 2->Knob2 is 6
when Knob1 is 13>Knob2 is 7.3
Is it possible to do that?
Looks like its not linear - so use a lookUp Table
var lookUpArray = [1.5,6,7.3,8.1,9.9,12.5,13,15,22,34]; const var Knob2 = Content.getComponent("Knob2"); // knob 1's range is set 1 to 10 inline function onKnob1Control(component, value) { // Knob2.setValue(lookUpArray[value-1]); }; Content.getComponent("Knob1").setControlCallback(onKnob1Control);
-
@d-healey Oh ok thank you, I've installed it and it works perfectly, but that's not exactly what I need. Do you know how can I do what I said before? Set different Knob2 values for each Knob1 value
-
@Lindon That's exactly what I wanted! Thank you!!
-
HiseSnippet 1320.3oc4X80aaaCDmJNpI1qIXsXOr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jmQymB1oib+PTlObhKy2T.gp31sn+rgZuq11wf+RLpzeoldo1JfGyFYsRY9QjPBVBG+FXls1QG8TAON75nd+l5fkiEvEBvUXNwgLB32kl6w5BdTTGX6nsUj4TMiEcU9pgRNhbIQDMprChCfydFi3GoxPXAhNIhnNqod6ikB5UlZqWkJGi0m2emc0UJO5ykGB+z4GTutQc83DHtYGR0rCY4rCYkrCY0rCYsrCY8LAIIPaebn5FipmzqUVclIqrJXflXHTvPysocGX7DIil50P0AwhZpazA7X5e7deBZu8Ceh8+40gxMYGL2RG346ywVT0QU+xrZNNlhulrbeNiGdNmQ8FMSAbyuaWhvj6icCkV4dDr9DbjQptus1ygNjwhQS.9wxWbSmWecZiFNpj+N+2n+gb+uu+gax0MeZ2CNvpKjeleNeeacpeGU6Iepn5Q7XIz1Q+R+1P+Asfdh7HlcILkpyijwUTiUDpEg0VO3OfmzIc62RgZR29Sh75aJXuk9t9CgrxQXpRG51h8glU7MCoifNuTTBJu8uBKCvdB9q7R9.OEWmUKAXIS+W+j2de0XmAeVnx6F.Updkmm5ZvibQnwinZlQrblQrRlQrZlQrVlQrdlQ73a.gpsfshk7fjjhffl6lDHYs6f.obn+DvTdDE8
I'm getting this error message: Interface:! Line 13, column 16: API call with undefined parameter 0 {SW50ZXJmYWNlfHwyNjN8MTN8MTY=}
The slider is changing its value but it is not affecting the parameter with wich it is linked to.
-
The slider is changing its value but it is not affecting the parameter with wich it is linked to.
The error is telling you that you're using a parameter that doesn't exist aka
undefined
.Just had a quick look at the snippet. Your array only has 10 elements but your knob has 5000 possible values, so you need to do something about that :)
-
I just fixed the error but it still not working, it doesn't change the linked parameter
This is what I'm using now:
const var Knob2 = Content.getComponent("Knob2"); const var Knob1 = Content.getComponent("Knob1"); inline function onKnob1Control(component, value) { if (Knob1.getValue() == 5) { Knob2.setValue(12); } }; Content.getComponent("Knob1").setControlCallback(onKnob1Control);
-
@titosg Just use
value
:const var Knob2 = Content.getComponent("Knob2"); const var Knob1 = Content.getComponent("Knob1"); inline function onKnob1Control(component, value) { if (value == 5) { Knob2.setValue(12); } }; Knob1.setControlCallback(onKnob1Control);
Also, no need to getComponent if you already declared it
-
Still not working, it doesn't change the parameter, wich in this case is the release knob from the envelope
I just recorded a video: https://vimeo.com/430058912
-
Call
Knob2.changed()
after you set its value. -
Yes!! Thank you, now works perfect