diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-08-30 15:04:06 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-08-30 15:04:06 +0200 |
commit | cf7f80e969f9bde04883fa155ad37e90aba19449 (patch) | |
tree | f66facee48e881ce4a57cbdc2ca6c9d8519ffc1d /lib | |
parent | 4514b8809744960f1805f376d15bd470fd342b2f (diff) | |
download | digitale-debutanten-cf7f80e969f9bde04883fa155ad37e90aba19449.tar.gz |
implement Clipper as Chubgraph (simplifying usage)
also make members pseudo-private by appending "__"
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Clipper.ck | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/Clipper.ck b/lib/Clipper.ck index c11d3c2..eb45ea2 100644 --- a/lib/Clipper.ck +++ b/lib/Clipper.ck @@ -1,18 +1,20 @@ /* * clip signal within -1 to 1 with simple UGens */ -public class Clipper { - Gain input; // chuck input signal to this - Gain output; // chuck this out to have the result +public class Clipper extends ChubgraphStd { + /* calculate a from HalfRect(inlet + 1) */ + Step __one; 1 => __one.next; + inlet => HalfRect __a; + __one => __a; - Step one; 1 => one.next; - input => HalfRect a; - one => a; // calculate a from HalfRect(input + 1) - one => Gain two; 2 => two.gain; - -1 => a.gain; - a => HalfRect b; - two => b; // calculate b from HalfRect(2 - HalfRect(input + 1)) - -1 => b.gain; - one => output; - b => output; // the result we want: 1 - HalfRect(2 - HalfRect(input + 1)) + /* calculate b from HalfRect(2 - HalfRect(inlet + 1)) */ + Step __two; 2 => __two.next; + -1 => __a.gain; + __a => HalfRect __b; + __two => __b; + + /* the result we want: 1 - HalfRect(2 - HalfRect(inlet + 1)) */ + -1 => __b.gain; + __one => outlet; + __b => outlet; } |