polymorphism: better names for .binaryValue and .booleanValue are .asInteger and...
[supercollider.git] / Help / Libraries / JITLib / GUI / ProxyMixerOld.html
blob4454e75701ebce9b18f981a95f0963c0576f1796
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="1038.29">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Helvetica}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0000ee}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #ad140d}
19 p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #001bb9}
20 span.s1 {font: 18.0px Helvetica}
21 span.s2 {color: #000000}
22 span.s3 {text-decoration: underline}
23 span.s4 {color: #0a25b9}
24 span.s5 {font: 9.0px Monaco}
25 span.s6 {color: #001bb9}
26 span.s7 {color: #2c7014}
27 span.s8 {color: #1d20b9}
28 span.s9 {color: #ad140d}
29 span.s10 {text-decoration: underline ; color: #0021e7}
30 span.s11 {color: #606060}
31 span.Apple-tab-span {white-space:pre}
32 </style>
33 </head>
34 <body>
35 <p class="p1"><span class="s1"><b>ProxyMixerOld<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>mix control for a proxyspace</b></p>
36 <p class="p2"><br></p>
37 <p class="p3"><b>ProxyMixer has been updated - some little adaptations to existing<span class="Apple-converted-space"> </span></b></p>
38 <p class="p3"><b>uses may be needed.</b> If you like, you can also replace "ProxyMixer"<span class="Apple-converted-space"> </span></p>
39 <p class="p3">with "ProxyMixerOld" to keep using the old style of ProxyMixer.</p>
40 <p class="p4"><b></b><br></p>
41 <p class="p4"><br></p>
42 <p class="p4"><br></p>
43 <p class="p4"><br></p>
44 <p class="p4"><br></p>
45 <p class="p1">ProxyMixer provides controls for handling and editing the node proxies in a proxyspace and their monitors (cross-platform graphics).</p>
46 <p class="p4"><br></p>
47 <p class="p5"><span class="s2">See also: <a href="../environments/ProxySpace.html"><span class="s3">ProxySpace</span></a>, <a href="NodeProxyEditor.html"><span class="s3">NodeProxyEditor</span></a></span></p>
48 <p class="p1">Overview: <a href="../JITLib.html"><span class="s4">JITLib</span></a></p>
49 <p class="p2"><br></p>
50 <p class="p2"><br></p>
51 <p class="p6"><b>Creation / Class Methods</b></p>
52 <p class="p2"><br></p>
53 <p class="p2"><br></p>
54 <p class="p1"><b>*new(proxyspace, nProxies, title, bounds)</b></p>
55 <p class="p1"><span class="Apple-tab-span"> </span><b>nProxies: </b>the maximum number of proxies you plan to use</p>
56 <p class="p1"><b><span class="Apple-tab-span"> </span>title:<span class="Apple-tab-span"> </span></b>window title</p>
57 <p class="p1"><b><span class="Apple-tab-span"> </span>bounds:</b> window bounds</p>
58 <p class="p2"><br></p>
59 <p class="p2"><br></p>
60 <p class="p7"><br></p>
61 <p class="p7"><br></p>
62 <p class="p6"><b>Example</b><span class="s5"><span class="Apple-tab-span"> </span></span></p>
63 <p class="p2"><br></p>
64 <p class="p8">p = <span class="s6">ProxySpace</span>.push(s.boot, <span class="s7">\p</span>);<span class="Apple-converted-space"> </span></p>
65 <p class="p8">m = <span class="s6">ProxyMixer</span>(p, 8, <span class="s7">\p</span>, <span class="s6">Rect</span>(20, 500, 0,0));</p>
66 <p class="p2"><br></p>
67 <p class="p8">m = <span class="s8">ProxyMixer</span>(p, 8)</p>
68 <p class="p2"><br></p>
69 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// the top left menu sets which proxies will be shown.</p>
70 <p class="p2"><br></p>
71 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// existingProxies: even an empty proxy is shown</p>
72 <p class="p8">~test.ar;<span class="Apple-converted-space"> <span class="Apple-tab-span"> </span></span></p>
73 <p class="p2"><br></p>
74 <p class="p9"><span class="s2">(<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// activeProxies: proxy appears when it is alive</p>
75 <p class="p10"><span class="s2">~test = { </span>|freq=250, intv=19, timescale=1, curve=0, loopnode=0|<span class="s2"><span class="Apple-converted-space"> </span></span></p>
76 <p class="p8"><span class="Apple-tab-span"> </span><span class="s6">var</span> env = <span class="s6">EnvGen</span>.kr(</p>
77 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s6">Env</span>({ 1.0.rand2 }!11, {1.0.rand}!10, curve, releaseNode: 9, loopNode: loopnode),<span class="Apple-converted-space"> </span></p>
78 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>timeScale: timescale);</p>
79 <p class="p8"><span class="Apple-tab-span"> </span><span class="s6">var</span> pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;</p>
80 <p class="p8"><span class="Apple-tab-span"> </span><span class="s6">Splay</span>.ar(<span class="s6">Formant</span>.ar(pitch, pitch.scramble * 2, pitch.scramble)) * 0.1;</p>
81 <p class="p8">};</p>
82 <p class="p8">)</p>
83 <p class="p8">~test.lag(<span class="s7">\freq</span>, 4);</p>
84 <p class="p2"><br></p>
85 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// playingProxies : only those that really play are shown.</p>
86 <p class="p8">~test.playN(vol: 1);</p>
87 <p class="p2"><br></p>
88 <p class="p9">// switch back to active proxies...</p>
89 <p class="p2"><span class="Apple-tab-span"> </span></p>
90 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// the reduce button removes all proxies that are not playing</p>
91 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// and that are not used as sources in other proxies:</p>
92 <p class="p8">~otto = { <span class="s6">|dens=12|</span> <span class="s6">Dust</span>.ar(dens) };</p>
93 <p class="p2"><br></p>
94 <p class="p8">~otto.clear;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s9">// remove it</span></p>
95 <p class="p8">p.reduce;</p>
96 <p class="p2"><br></p>
97 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// doc and docc post the current proxyspace as code</p>
98 <p class="p8">p.document;</p>
99 <p class="p2"><br></p>
100 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// openEdit opens the editor zone, see below;</p>
101 <p class="p8">m.openEditZone(1);<span class="Apple-tab-span"> </span></p>
102 <p class="p2"><br></p>
103 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// R opens a Record utility, see below.<span class="Apple-converted-space"> </span></p>
104 <p class="p2"><br></p>
105 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// the line of controls for one proxy and its monitor is<span class="Apple-converted-space"> </span></p>
106 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// a ProxyMonitorGui, so for full details see ProxyMonitorGui.help.</p>
107 <p class="p2"><span class="Apple-tab-span"> </span></p>
108 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// it displays current volume,<span class="Apple-converted-space"> </span></p>
109 <p class="p8">~test.vol_(0.05);<span class="Apple-tab-span"> </span></p>
110 <p class="p8">~test.vol_(0.1);<span class="Apple-tab-span"> </span></p>
111 <p class="p2"><br></p>
112 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// proxy name; play/stop/end control:</p>
113 <p class="p8">~test.playN;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s9">// playN as is</span></p>
114 <p class="p8">~test.stop;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s9">// stop<span class="Apple-converted-space"> </span></span></p>
115 <p class="p9"><span class="s2">~test.end;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// option-click on stop : end the monitor and the proxy itself.</p>
116 <p class="p9"><span class="s2">~test.playN(vol: 0);<span class="Apple-tab-span"> </span></span>// option-click on play : start playing with volume zero.</p>
117 <p class="p2"><br></p>
118 <p class="p8">~test.vol_(0.1);</p>
119 <p class="p2"><br></p>
120 <p class="p8">s.scope(8);</p>
121 <p class="p9"><span class="s2">~test.playN(4);<span class="Apple-tab-span"> </span></span>// set proxy's first output channel:</p>
122 <p class="p8">~test.playN(0);<span class="Apple-tab-span"> </span></p>
123 <p class="p2"><br></p>
124 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// the "-=" / "-&lt;" button supports multichannel monitoring,<span class="Apple-converted-space"> </span></p>
125 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// see ProxyMonitorGui.help</p>
126 <p class="p2"><br></p>
127 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>//<span class="Apple-tab-span"> </span>paus/rsum toggles pause and resume:</p>
128 <p class="p8">~test.pause;</p>
129 <p class="p8">~test.resume;<span class="Apple-tab-span"> </span></p>
130 <p class="p2"><br></p>
131 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// send button resends the proxy,<span class="Apple-converted-space"> </span></p>
132 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// option-click on send rebuilds the proxy</p>
133 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// (e.g. for lookup in client-site state)</p>
134 <p class="p8">~test.send;<span class="Apple-tab-span"> </span></p>
135 <p class="p8">~test.send;<span class="Apple-tab-span"> </span></p>
136 <p class="p8">~test.send;<span class="Apple-tab-span"> </span></p>
137 <p class="p8">~test.rebuild;<span class="Apple-tab-span"> </span></p>
138 <p class="p8">~test.rebuild;<span class="Apple-tab-span"> </span></p>
139 <p class="p8">~test.rebuild;<span class="Apple-tab-span"> </span></p>
140 <p class="p2"><br></p>
141 <p class="p2"><br></p>
142 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// the ed button sends this proxy to the editor - see below</p>
143 <p class="p2"><br></p>
144 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// kr proxies show up in the middle</p>
145 <p class="p8">~lfo = { <span class="s6">SinOsc</span>.kr(2) };</p>
146 <p class="p8">~lfnoyz0 = { <span class="s6">|lofreq, mul=1, add|</span> <span class="s6">LFDNoise0</span>.kr(lofreq, mul, add) };</p>
147 <p class="p2"><br></p>
148 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// the editor zone is a <a href="NodeProxyEditor.html"><span class="s10">NodeProxyEditor</span></a></p>
149 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// open it and set some params</p>
150 <p class="p8">m.openEditZone(1);</p>
151 <p class="p8">m.editor.proxy_(~test);</p>
152 <p class="p8">~test.set(<span class="s7">\freq</span>, exprand(80, 1250));<span class="Apple-tab-span"> </span><span class="s9">// set ~tests parameters</span></p>
153 <p class="p8">~test.set(<span class="s7">\intv</span>, 1.0.linrand);</p>
154 <p class="p2"><br></p>
155 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>//<span class="Apple-tab-span"> </span>if you declare global specs for the range of a parameter,<span class="Apple-converted-space"> </span></p>
156 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>//<span class="Apple-tab-span"> </span>they can be used in the editor:</p>
157 <p class="p8"><span class="s6">Spec</span>.add(<span class="s7">\intv</span>, [0, 36, <span class="s7">\lin</span>]);</p>
158 <p class="p8"><span class="s6">Spec</span>.add(<span class="s7">\timescale</span>, [0.001, 10, <span class="s7">\exp</span>]);</p>
159 <p class="p8"><span class="s6">Spec</span>.add(<span class="s7">\loopnode</span>, [0, 7, <span class="s7">\lin</span>, 1]);</p>
160 <p class="p8"><span class="s6">Spec</span>.add(<span class="s7">\curve</span>, [-10, 10]);</p>
161 <p class="p2"><br></p>
162 <p class="p8">m.editor.proxy_(~test);</p>
163 <p class="p2"><br></p>
164 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// you can map a kr proxy to a control param;</p>
165 <p class="p8">~test.map(<span class="s7">\intv</span>, ~lfnoyz0);</p>
166 <p class="p8">~test.unmap(<span class="s7">\intv</span>);</p>
167 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// this also works by dragging the kr proxy name<span class="Apple-converted-space"> </span></p>
168 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// the field left of the param name.</p>
169 <p class="p2"><br></p>
170 <p class="p2"><br></p>
171 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>//<span class="Apple-tab-span"> </span>some more tests :</p>
172 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// if there are too many ar proxies, a scroller appears</p>
173 <p class="p9"><span class="s2">(<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// test too many<span class="Apple-converted-space"> </span></p>
174 <p class="p8">10.do { <span class="s6">|i|</span> p[(<span class="s11">"test"</span> ++ i).asSymbol] = {<span class="Apple-converted-space"> </span></p>
175 <p class="p8"><span class="Apple-tab-span"> </span><span class="s6">Pan2</span>.ar(<span class="s6">Ringz</span>.ar(<span class="s6">Impulse</span>.ar(exprand(0.5, 4)), exprand(300, 3000), 0.02), 1.0.rand2, 0.2) };<span class="Apple-converted-space"> </span></p>
176 <p class="p8">};</p>
177 <p class="p8">)</p>
178 <p class="p2"><br></p>
179 <p class="p8">10.do { <span class="s6">|i|</span> p[(<span class="s11">"test"</span> ++ i).asSymbol].playN(vol: linrand(1.0), fadeTime: exprand(0.01, 5)) };</p>
180 <p class="p2"><br></p>
181 <p class="p9"><span class="s2"><span class="Apple-tab-span"> </span></span>// and the same for kr proxies</p>
182 <p class="p8">10.do { <span class="s6">|i|</span> p[(<span class="s11">"kr"</span> ++ i).asSymbol] = { <span class="s6">LFNoise0</span>.kr(exprand(5, 50)) }; };</p>
183 <p class="p2"><br></p>
184 <p class="p8">p.krProxyNames.do { <span class="s6">|key|</span> p.removeAt(key) };</p>
185 <p class="p2"><br></p>
186 <p class="p8">p.reduce(method: <span class="s7">\clear</span>);</p>
187 <p class="p2"><br></p>
188 <p class="p8">p.clean;</p>
189 </body>
190 </html>