[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] BinaryOpUGen (instead of ==) confusion



I've googled the list archives ... and found discussions on how the comparison statement in an if condition is shorthand for binary op Ugens. I've tried substituting my comparions statements with BinaryOpUGen longhand ... but I still cant get that to work.

In this code snippet, the if condition always evaluates to false ... even if doppler is set to 1.

SynthDef("encode_N3D",
    { arg outBus = 0, azi = 0, ele = 0, distance = 1, inBus = 0, moveIn = 1.0, doppler = 1;
 ... snip ....
        var audioOutput = if (doppler == 1, { DelayL.ar( air_attenuated_input, maxDelayTime , delayTime )} , {air_attenuated_input} );   

In this below code, I've used BinaryOpUGen('==', doppler, 1)  ... but this time I get a "ERROR: Non Boolean in test."

SynthDef("encode_N3D",
    { arg outBus = 0, azi = 0, ele = 0, distance = 1, inBus = 0, moveIn = 1.0, doppler = 1;
 ... snip ....
        var audioOutput = if (  BinaryOpUGen('==', doppler, 1), { DelayL.ar( air_attenuated_input, maxDelayTime , delayTime )} , {air_attenuated_input} );

Can anyone see what I have done wrong?

Etienne