summaryrefslogtreecommitdiff
path: root/lib/ClipperGraph.ck
blob: 86e6183b3a40982f9bf98bdf433ee32b3d4306f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * clip signal within -1 to 1 with simple UGens
 */
public class ClipperGraph extends ChubgraphStd {
	/* calculate a from HalfRect(inlet + 1) */
	Step __one; 1 => __one.next;
	inlet => HalfRect __a;
	__one => __a;

	/* 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;
}