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

Re: [sc-users] BooleanUGens (was Re: conditional statement in SynthDef)




On 6 Sep 2005, at 08:10, Dan Stowell wrote:

2005/9/6, Joshua Parmenter <joshpar@xxxxxxx>:

On Sep 5, 2005, at 1:22 PM, James Harkins wrote:

Since BinaryOpUGen already supports == and != I think it could just be
documented how to write the BinaryOpUGen yourself
I think this makes sense...

I'm afraid I don't quite understand. Could someone spell it out for a
stupid person, please? The situation as I see it is that there already
exist BinaryOpUGens which perform equality/non-equality tests, but for
some reason these aren't automatically inserted when someone uses "=="
or "!=" in a SynthDef. What's the reason? Josh found he couldn't
compile this in without breaking things so it's an unavoidable
problem?

The problem is that == in its traditional non-UGen sense is used in tests when constructing a BinaryOpUGen which optimise out degenerate cases such as aUGen * 0.0 where the second operand is a constant. In this case you don't get a UGen, you get a constant of 0.0, thus saving some computation.

When you say "documented how to write the BinaryOpUGen yourself", does
that mean documenting how to manually rewrite "==" and "!=" within
SynthDefs?

You can still make a BinaryOpUGen directly like so:

BinaryOpUGen('==', someUGen, anotherUGen);

S.