Linking two knobs together
Hi there,
I am trying to link two knobs together in Kontakt, but haven't had much luck with it yet.
Would someone have any good direction for me to go to?
PS: my knobs are declared as sliders, so I can add my own knob design to them:
declare ui_slider $knob(100000,500000)
set_knob_defval($knob, 500000)
$knob := 500000
move_control_px($knob,100,70)
make_persistent($knob)
declare $knobId
$knobId := get_ui_id($knob)
set_control_par_str($knobId, $CONTROL_PAR_PICTURE,"knob")
set_control_par($knobId, $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)
My idea is to create a link button, so when I press it, knob 1 and knob 2 will move together, linked.
Comments
-
You'll want to mirror the values of one knob to the other whenever the
link_button
is set to 1. Also, don't forget to copy theset_engine_par
part into both knob callbacks.Here’s a quick example:
on ui_control (knob_1)
if link_button # 0
knob_2 := knob_1
set_engine_par(<knob_2 engine parameters>)
end if set_engine_par(<knob_1 engine parameters>)
end on on ui_control (knob_2)
same logic as above
end on0 -
Thank you! This worked great!
I'm still trying to understand why there's a
set engine par
for knob 1 afterend if
, and beforeend on
end if set_engine_par(<knob_1 engine parameters>) end on
But it did work for what I wanted to do! Just wanted to fully understand the code.
Thank you again.
0 -
Just to complement my comment, when I used it for my simple test script, it worked perfectly.
But then when I was trying to mirror two slider values that have multiple set_engine_par parameters assigned to it (from different groups), it doesn't seem to work :/
Would like to understand the code for mirroring values, so I can adjust to mine.
Thank you for your help!
0 -
The same approach can be used for as many
set_engine_par
lines as you want. Here's an explanation of the code:
on init
declare ui_slider $knob_1(0,1000000) {Declare the first knob}
make_persistent($knob_1) {make it persistent so it keeps its value whenever we restart the engine}
declare ui_slider $knob_2(0,1000000)
make_persistent($knob_2)
declare ui_button $link_button {declare link button}
make_persistent($link_button)
end on on ui_control($knob_1)
set_engine_par($ENGINE_PAR_CUTOFF,$knob_1,0,0,-1) {control the cutoff values of the first group}
if ($link_button # 0) {if link button is not equal to 0}
$knob_2 := get_control_par(get_ui_id($knob_1),$CONTROL_PAR_VALUE) {transfer knob's 1 values to knob 2}
set_engine_par($ENGINE_PAR_CUTOFF,$knob_2,1,0,-1) {sets the cutoff values to group 2}
end if
end on on ui_control($knob_2)
set_engine_par($ENGINE_PAR_CUTOFF,$knob_2,1,0,-1) {control the cutoff values of the second group}
if ($link_button # 0) {if link button is not equal to 0}
$knob_1 := get_control_par(get_ui_id($knob_2),$CONTROL_PAR_VALUE) {copy the knob's 2 values to knob 1}
set_engine_par($ENGINE_PAR_CUTOFF,$knob_1,0,0,-1) {set the cutoff values to group 1}
end if
end on on ui_control($link_button)
if ($link_button # 0) {copy the values of the first knob to the second whenever you click the link button}
$knob_2 := get_control_par(get_ui_id($knob_1),$CONTROL_PAR_VALUE)
set_engine_par($ENGINE_PAR_CUTOFF,$knob_2,1,0,-1)
end if
end onIn the example above, the main
set_engine_par
is placed before theif
statement, but you can totally put it after theif
statement as well.For future reference:
set_engine_par(<parameter>, <value>, <group>, <slot>, <generic>)
0 -
Thank you very much for the detailed explanation! I appreciate it.
If I were to add a third knob, to link with the other two, would I have to then mirror all of them like this:
on init declare ui_slider $knob_1(0,1000000) make_persistent($knob_1) declare ui_slider $knob_2(0,1000000) make_persistent($knob_2) declare ui_slider $knob_3(0,1000000) make_persistent($knob_3) declare ui_button $link_button make_persistent($link_button) end on on ui_control($knob_1) set_engine_par($ENGINE_PAR_CUTOFF,$knob_1,0,0,-1) if ($link_button # 0) $knob_2 := $knob_1 set_engine_par($ENGINE_PAR_CUTOFF,$knob_2,1,0,-1) end if end on on ui_control($knob_2) set_engine_par($ENGINE_PAR_CUTOFF,$knob_2,1,0,-1) if ($link_button # 0) $knob_1 := $knob_2 set_engine_par($ENGINE_PAR_CUTOFF,$knob_1,0,0,-1) end if end on on ui_control($knob_3) set_engine_par($ENGINE_PAR_CUTOFF,$knob_3,1,0,-1) if ($link_button # 0) $knob_2 := $knob_3 set_engine_par($ENGINE_PAR_CUTOFF,$knob_2,0,0,-1) end if end on on ui_control($link_button) if ($link_button # 0) $knob_2 := $knob_1 $knob_2 := $knob_3 $knob_1 := $knob_2 $knob_1 := $knob_3 set_engine_par($ENGINE_PAR_CUTOFF,$knob_2,1,0,-1) set_engine_par($ENGINE_PAR_CUTOFF,$knob_3,1,0,-1) end if end on
When I add the above code, all I can get is knob_1 and knob_2 are linked, and knob_2 and knob_3 are linked, but not all three of them together.
Thank you again!
0 -
You'll want to link all the knobs so they move together whenever the link button is on. Right now, each knob callback only links two knobs at a time (like knob 1 and 2, or knob 2 and 3). The solution is already there, you just need to copy and tweak a specific part of the code above 😊
1
Categories
- All Categories
- 19 Welcome
- 1.4K Hangout
- 60 NI News
- 735 Tech Talks
- 3.9K Native Access
- 15.9K Komplete
- 1.9K Komplete General
- 4.2K Komplete Kontrol
- 5.5K Kontakt
- 1.5K Reaktor
- 365 Battery 4
- 817 Guitar Rig & FX
- 417 Massive X & Synths
- 1.2K Other Software & Hardware
- 5.5K Maschine
- 7K Traktor
- 7K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators