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

[Sc-devel] UGen - bipolar unipolar



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
+                       }
+               }
+       }
+


--





.