Link Delay Times
-
Hi guys, could anyone recommend a script to link the L/R Delay times via a button, I was hoping to slot in the example from the HISE General UI (Link Sliders) but it doesn't appear to work! Here's my current script:
//DELAY LINK - NOT WORKING
reg i;
const var fx = [];
fx[0] = Synth.getEffect("Delay1");
fx[1] = Synth.getEffect("Delay1");const var btnLink = Content.getComponent("DELAYLINK");
const var knobs = [];
knobs[0] = Content.getComponent("DELAYTIME_L");
knobs[1] = Content.getComponent("DELAYTIME_R");knobs[0].setControlCallback(knobCB);
knobs[1].setControlCallback(knobCB);inline function knobCB(control, value)
{
local idx = knobs.indexOf(control);if (btnLink.getValue() == 0) // Controls not linked { fx[idx].setAttribute(2, value); fx[idx].setAttribute(3, value); } else { for (i = 0; i < knobs.length; i++) { fx[i].setAttribute(2, value); fx[i].setAttribute(3, value); knobs[i].setValue(value); } }
}
Many thanks in advance
-
@DanH said in Link Delay Times:
Hi guys, could anyone recommend a script to link the L/R Delay times via a button, I was hoping to slot in the example from the HISE General UI (Link Sliders) but it doesn't appear to work! Here's my current script:
//DELAY LINK - NOT WORKING reg i; //<--- no need to declare this if its just used in a for loop const var fx = []; // <--- shouldn't set this to a const and then put something in it later..... fx[0] = Synth.getEffect("Delay1"); // <-- like this fx[1] = Synth.getEffect("Delay1"); const var btnLink = Content.getComponent("DELAYLINK"); const var knobs = []; //<-- again not constant.... knobs[0] = Content.getComponent("DELAYTIME_L"); knobs[1] = Content.getComponent("DELAYTIME_R"); knobs[0].setControlCallback(knobCB); knobs[1].setControlCallback(knobCB); inline function knobCB(control, value) { local idx = knobs.indexOf(control); if (btnLink.getValue() == 0) // Controls not linked { fx[idx].setAttribute(2, value); //<-- better using the constant names not the index numbers - more readable fx[idx].setAttribute(3, value); }else{ for (i = 0; i < knobs.length; i++) { fx[i].setAttribute(2, value); fx[i].setAttribute(3, value); knobs[i].setValue(value); //<-- so you changed them but didnt ask them to do anything knobs[i].changed(); //<-- so add this line.... } } }
Many thanks in advance
-
@Lindon Thanks mate :)
So I've copied in your script and changed the 2 x 'const var' to just 'var' that you recommended... Should it be working? (It's not). Please let me know anything else I shld be doing...
-
@DanH try debugging it....
add some Console.print statements to see what is working and what isnt...
you may find this is where at least some of your problems are:
fx[0] = Synth.getEffect("Delay1"); // <-- the first delay you want to change fx[1] = Synth.getEffect("Delay1"); // <-- wot? the first delay again???
-
@Lindon Thanks for he help! So the two knobs were still linked to the delay parameters, once I removed it worked fine! Doh.
Just saw the updated message and if I remove the second 'fx[1]' line the knobs don't move together, so I've left it as was as seems to work that way.
Thanks again :)