One knob controlling two parameters
-
@DanH
.setBypassed()
-
@d-healey Many thanks David, what do I need between the parentheses to make it switchable?
-
true
orfalse
,1
or0
. -
@d-healey Thanks again David, so my script is: LEG1.setBypassed(0); which will turn the legato on when I click the LEGATO button, but not off again.
-
@DanH And if you set it to 1 it will do the opposite. Can you think of a way to get a 1 or a 0 when the button is clicked?
-
@d-healey haha, I will certainly try! PS - I am exhausting all avenues before eventually posting on here and am hugely grateful
-
@DanH I'll give you a hint, try checking the value of the button inside the callback ;)
-
@d-healey 2 hours later and I still can't do it! I'm hopeless
-
@DanH
LEG1.setBypassed(value);
-
@d-healey Thank you, I don't understand but thank you! (why no Boolean in there?!)
-
@DanH In the callback you get the parameters
component
andvalue
. Component refers to the control that triggered the callback (in this case the button), and value refers to the value of the control... so the button's value, which will be either1
or0
depending on if the button is on or off. You can putConsole.print(value);
in your callback to see the button's value printed each time you click it, very useful for testing. -
@DanH - why no boolean? Go take a look at one of the introduction to javascript courses - they're usually free - and it will guide you thru the different kinds of variables, booleans are one type - and they "resolve" to true = 1 and false = 0.
So 1 and 0 are numbers and also one of the ways booleans represent themselves - so you can use the value of a button (which is always 1 or 0)
-