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

Re: [Sc-devel] UGen - bipolar unipolar



Looks innocent enough to me. But why not have the mul args default to
1?

ok, for unipolar this makes sense. I just realized that MulAdd makes the optimization already, so bipolar can be simple.

unipolar { arg mul = 1;
 		^this.range(0, mul)
 	}

 bipolar { arg mul = 1;
 		^this.range(mul.neg, mul)
 	}


Would simplify the bipolar method a little, and would make it
possible to just write things like SinOsc.ar(300).unipolar

Dan


2008/1/11, Julian Rohrhuber <rohrhuber@xxxxxxxxxxxxxx>:
 would this be practical?
 it seems that it could be more efficient in some graph generation
 systems to do this.


 Index:
 /Volumes/data/sc/SuperCollider3/build/SCClassLibrary/Common/Audio/UGen.sc
 ===================================================================
 ---
 /Volumes/data/sc/SuperCollider3/build/SCClassLibrary/Common/Audio/UGen.sc
 (revision 6913)
 +++
 /Volumes/data/sc/SuperCollider3/build/SCClassLibrary/Common/Audio/UGen.sc
 (working copy)
 @@ -71,6 +71,23 @@
                          ^LinExp.multiNew(rate, this, 0, 1, lo, hi)
                  });
          }
 +
 +       unipolar { arg mul;
 +               ^this.range(0, mul)
 +       }
 +
 +       bipolar { arg mul;
 +               ^if(mul.isNumber) {
 +                       this.range(mul.neg, mul)
 +               } {
 +                       if(mul.isNil) {
 +                               this.range(-1, 1)
 +                       } {
 +                               this.range(-1, 1) * mul
 +                       }
 +               }
 +       }
 +


 --





 .
 _______________________________________________
 Sc-devel mailing list
 Sc-devel@xxxxxxxxxxxxxxx
 http://lists.create.ucsb.edu/mailman/listinfo/sc-devel



--
http://www.mcld.co.uk
_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel


--





.