found identifier when expecting ' ; ' headache
-
Hi guys,
Can anyone see the problem here please? I just used the same code about 10 minutes ago and I've only changed the names this time around to the new things that I need to control, but the 2nd time it isn't working and i get this message in the console:
Line 90 thats it's referring to is the line:
LF EQ.setBypassed(0);
const var LF EQ = Synth.getEffect("LF EQ"); const var LMF EQ = Synth.getEffect("LMF EQ"); const var HMF EQ = Synth.getEffect("HMF EQ"); const var HF EQ = Synth.getEffect("HF EQ"); const var EqBypass = Content.getComponent("EqBypass"); inline function onEqBypassControl(component, value) { if (value ==1) { LF EQ.setBypassed(0); LMF EQ.setBypassed(0); HMF EQ.setBypassed(0); HF EQ.setBypassed(0); } else { LF EQ.setBypassed(1); LMF EQ.setBypassed(1); HMF EQ.setBypassed(1); HF EQ.setBypassed(1); } }; Content.getComponent("EqBypass").setControlCallback(onEqBypassControl);
-
@SteveRiggs said in found identifier when expecting ' ; ' headache:
if (value ==1)
try
if (EqBypass.getValue() == 1)
-
@dustbro Damn. Still the same error message
-
-
@dustbro Ah, that could be it, ok 2 seconds I'll try it.... Thanks...
-
@dustbro Thats got it!!! Spot on mate. Thank you. It's always the little things that keep getting me!
Note to self, no more spaces!!
-
@SteveRiggs Just a wee tip
inline function onEqBypassControl(component, value) { if (value ==1) { LF EQ.setBypassed(0); LMF EQ.setBypassed(0); HMF EQ.setBypassed(0); HF EQ.setBypassed(0); } else { LF EQ.setBypassed(1); LMF EQ.setBypassed(1); HMF EQ.setBypassed(1); HF EQ.setBypassed(1); } };
Can be simplified in:
inline function onEqBypassControl(component, value) { LF EQ.setBypassed(! Value); LMF EQ.setBypassed(! Value); HMF EQ.setBypassed(! Value); HF EQ.setBypassed(! Value); };
And if you put your EQs in an array you can gain two more lines :
inline function onEqBypassControl(component, value) { for (i = 0; i < myEqArray.length; i++){ myEqArray[i].setBypassed(! Value); ] };
-
@ustk Awesome! Thanks man. Thats going to save me a lot of lines in this one now
-
And if you use the for in loop you gain a few more characters:
for(eq in eqs) eq.setBypassed(value);