"assignment missing left-hand" - Codebox won't compile!

Joni Newham's icon

hello lovely patchers! i've been putting together some control utilities for an additive synth using mc~ and i've run into the above error while working. does anyone know why this error is being thrown up? i'm not trying to make an assignment on the relevant line, it's just a condition check for the if statement.

i'm new to gen so i've looked around but couldn't find anything on this particular issue! thanks in advance.

center = in1;
amount = in2;
if (amount >= 0){
    if (mc_channel < center){
        val = 1 - amount;
        gain = scale(mc_channel, 0, center, val, 1, 1);
        out = clip(gain, 0, 1);
        }
    else{
        out = 1;
        }
    }
else if (amount < 0){ //issue happens here
    if mc_channel > center{
        val = amount + 1
        gain = scale(mc_channel, center, mc_channelcount, 1, val, 1)
        out = clip(gain, 0, 1);
        }
    else{
        out = 1    
        }
else if (amount == 0){
    out1 = 1
    }

tilt.gendsp
gendsp 2.79 KB

Jean-Francois Charles's icon

A compiler gives always a kind of approximative place for syntax errors.
What if you used parens on the following line?
if (mc_channel > center)...
This should reveal, well, the next syntax error in your code.
Also, note that you final else if (amount == 0) will never be reached.

Joni Newham's icon

thanks! so much of this could have been solved if i hadn't been coding at 11pm... ha!

i've corrected the codebox - the power of a good night's sleep! thanks for the hint on the errors being approximate, i know what to look out for now.