polymorphism: better names for .binaryValue and .booleanValue are .asInteger and...
[supercollider.git] / Help / Libraries / JITLib / nodeproxy / RecNodeProxy.html
blob16f0c629ee3d519063cdff759e28abfdf9d67420
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="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 8.0px Monaco; min-height: 11.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #ad140d}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
19 p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica; min-height: 16.0px}
20 p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #001bb9}
21 span.s1 {color: #0033f1}
22 span.s2 {color: #0024f8}
23 span.s3 {text-decoration: underline}
24 span.s4 {color: #001bb9}
25 span.s5 {color: #000000}
26 span.s6 {color: #606060}
27 span.s7 {color: #2c7014}
28 span.s8 {color: #ad140d}
29 span.Apple-tab-span {white-space:pre}
30 </style>
31 </head>
32 <body>
33 <p class="p1"><b>RecNodeProxy</b></p>
34 <p class="p2"><br></p>
35 <p class="p3"><b>superclass: NodeProxy</b></p>
36 <p class="p4"><br></p>
37 <p class="p5">a <a href="NodeProxy.html"><span class="s1">NodeProxy</span></a> that can record</p>
38 <p class="p4"><br></p>
39 <p class="p3">this is also created from a <a href="NodeProxy.html"><span class="s2">NodeProxy</span></a>, or an <a href="Ndef.html"><span class="s2">Ndef</span></a> with the message record.</p>
40 <p class="p2"><br></p>
41 <p class="p2"><br></p>
42 <p class="p3"><b><span class="s3">instance creation:</span></b></p>
43 <p class="p4"><br></p>
44 <p class="p3"><span class="Apple-tab-span"> </span><b>*new(server) / *audio(server, numChannels)</b></p>
45 <p class="p3"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>see superclass</p>
46 <p class="p2"><b><span class="Apple-tab-span"> </span></b></p>
47 <p class="p3"><b><span class="Apple-tab-span"> </span>*newFrom(inproxy, numChannels)</b></p>
48 <p class="p3"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>instantiate a new proxy that listens to the in proxy.</p>
49 <p class="p2"><br></p>
50 <p class="p2"><br></p>
51 <p class="p3"><b><span class="s3">access:</span></b></p>
52 <p class="p2"><br></p>
53 <p class="p3"><b><span class="Apple-tab-span"> </span>open(path, headerformat, sampleformat)</b></p>
54 <p class="p3"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>open new file and initialize buffer on server</p>
55 <p class="p2"><b><span class="Apple-tab-span"> </span></b></p>
56 <p class="p3"><b><span class="Apple-tab-span"> </span>record(paused)</b></p>
57 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>start the recording synth, if paused is false start recording immediately</p>
58 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>default: true</p>
59 <p class="p2"><b><span class="Apple-tab-span"> </span></b></p>
60 <p class="p3"><b><span class="Apple-tab-span"> </span>close</b></p>
61 <p class="p3"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>stop recording, close file<span class="Apple-converted-space"> </span></p>
62 <p class="p2"><br></p>
63 <p class="p3"><b><span class="Apple-tab-span"> </span>pause/unpause</b></p>
64 <p class="p3"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>pause recording / unpause recording<span class="Apple-converted-space"> </span></p>
65 <p class="p2"><span class="Apple-tab-span"> </span></p>
66 <p class="p3"><span class="Apple-tab-span"> </span><b>isRecording</b></p>
67 <p class="p3"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>see if recording right now</p>
68 <p class="p2"><b><span class="Apple-tab-span"> </span></b></p>
69 <p class="p3"><b><span class="Apple-tab-span"> </span>wakeUp<span class="Apple-converted-space"> </span></b></p>
70 <p class="p3"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>until the proxy is not used by any output ( either .play or .ar/.kr )</p>
71 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>it is not running on the server. you can wake it up to force it playing.</p>
72 <p class="p4"><br></p>
73 <p class="p6"><br></p>
74 <p class="p6"><br></p>
75 <p class="p5"><b>examples</b></p>
76 <p class="p6"><br></p>
77 <p class="p6"><br></p>
78 <p class="p7">s.boot;</p>
79 <p class="p6"><br></p>
80 <p class="p7">a = <span class="s4">RecNodeProxy</span>.audio(s, 2);</p>
81 <p class="p7">a.source = { <span class="s4">SinOsc</span>.ar([400,500], 0, 0.1) };</p>
82 <p class="p8"><span class="s5">a.play; </span>//monitor;</p>
83 <p class="p9"><span class="s5">a.open(</span>"xproxySpace.aif"<span class="s5">);</span></p>
84 <p class="p7">a.record(<span class="s4">false</span>);</p>
85 <p class="p6"><br></p>
86 <p class="p7">a.source = { <span class="s4">SinOsc</span>.ar([400,700], 0, 0.1) };</p>
87 <p class="p7">a.source = { <span class="s4">SinOsc</span>.ar([410,510], 0, 0.1) };</p>
88 <p class="p7">a.source = { <span class="s4">SinOsc</span>.ar([<span class="s4">LFNoise1</span>.kr(80, 100, 300),500], 0, 0.1) };</p>
89 <p class="p6"><br></p>
90 <p class="p8">//stop recording and close file</p>
91 <p class="p7">a.close;</p>
92 <p class="p6"><br></p>
93 <p class="p8">//monitor off</p>
94 <p class="p7">a.stop;<span class="Apple-converted-space"> </span></p>
95 <p class="p6"><br></p>
96 <p class="p5"><b>recording from some bus</b></p>
97 <p class="p10"><br></p>
98 <p class="p7">a = <span class="s4">Bus</span>.audio(s, 2);<span class="Apple-converted-space"> </span></p>
99 <p class="p6"><br></p>
100 <p class="p7"><span class="s4">SynthDef</span>(<span class="s6">"test"</span>, { <span class="s4">arg</span> out; <span class="s4">Out</span>.ar(out, { <span class="s4">WhiteNoise</span>.ar(0.1) }.dup(2)) }).send(s);</p>
101 <p class="p7">x = <span class="s4">Synth</span>(<span class="s6">"test"</span>, [<span class="s7">\out</span>, a]);</p>
102 <p class="p6"><br></p>
103 <p class="p6"><br></p>
104 <p class="p7">n = <span class="s4">RecNodeProxy</span>.audio(s, 2);</p>
105 <p class="p7">n.source = { <span class="s4">InFeedback</span>.ar(a, 2) };</p>
106 <p class="p6"><br></p>
107 <p class="p8"><span class="s5">n.play;</span>//monitor</p>
108 <p class="p8"><span class="s5">n.stop;</span>//turn off monitor</p>
109 <p class="p6"><br></p>
110 <p class="p9"><span class="s5">n.open(</span>"noise.aif"<span class="s5">);</span></p>
111 <p class="p7">n.record;</p>
112 <p class="p7">n.unpause;</p>
113 <p class="p6"><br></p>
114 <p class="p7">n.close;</p>
115 <p class="p10"><br></p>
116 <p class="p10"><br></p>
117 <p class="p5"><b>instance creation from an existent node proxy</b></p>
118 <p class="p6"><br></p>
119 <p class="p6"><br></p>
120 <p class="p6"><br></p>
121 <p class="p7">b = <span class="s4">NodeProxy</span>.audio(s, 2);</p>
122 <p class="p8"><span class="s5">b.play; </span>//listen to b</p>
123 <p class="p7">b.source = { <span class="s4">SinOsc</span>.ar([400,500], 0, 0.1) }; <span class="s8">//play something</span></p>
124 <p class="p6"><br></p>
125 <p class="p7">r = <span class="s4">RecNodeProxy</span>.newFrom(b);</p>
126 <p class="p9"><span class="s5">r.open(</span>"recproxy514.aif"<span class="s5">); </span><span class="s8">//open file</span></p>
127 <p class="p8"><span class="s5">r.record; </span>//start recorder (paused)</p>
128 <p class="p6"><br></p>
129 <p class="p8"><span class="s5">r.unpause; </span>//start recording</p>
130 <p class="p6"><br></p>
131 <p class="p7">b.source = { <span class="s4">SinOsc</span>.ar([430,500], 0, 0.1) };</p>
132 <p class="p7">b.source = { <span class="s4">SinOsc</span>.ar([410,510], 0, 0.1) };</p>
133 <p class="p7">b.source = { <span class="s4">SinOsc</span>.ar([<span class="s4">LFNoise1</span>.kr(80, 100, 300), 500], 0, 0.1) };</p>
134 <p class="p7">r.pause;</p>
135 <p class="p7">b.source = { <span class="s4">WhiteNoise</span>.ar(0.01) };</p>
136 <p class="p7">r.unpause;</p>
137 <p class="p7">r.pause;</p>
138 <p class="p6"><br></p>
139 <p class="p6"><br></p>
140 <p class="p8">//stop recording and close file</p>
141 <p class="p7">r.close;</p>
142 <p class="p8"><span class="s5">b.stop; </span>//stop listen to b</p>
143 <p class="p6"><br></p>
144 <p class="p6"><br></p>
145 <p class="p5"><b>instance creation from an existent node proxy again</b></p>
146 <p class="p6"><br></p>
147 <p class="p6"><br></p>
148 <p class="p6"><br></p>
149 <p class="p7">b = <span class="s4">NodeProxy</span>.audio(s, 2);</p>
150 <p class="p8"><span class="s5">b.play; </span>//listen to b</p>
151 <p class="p7">b.source = { <span class="s4">SinOsc</span>.ar([400,500], 0, 0.1) }; <span class="s8">//play something</span></p>
152 <p class="p6"><br></p>
153 <p class="p8"><span class="s5">r = b.record(</span><span class="s6">"recproxy101.aiff"</span><span class="s5">); </span>//start recorder (paused)</p>
154 <p class="p8"><span class="s5">r.unpause; </span>//start recording</p>
155 <p class="p8"><span class="s5">r.close;<span class="Apple-converted-space">  </span></span>//end recording, close file</p>
156 <p class="p8"><span class="s5">b.stop;<span class="Apple-tab-span"> </span></span>//stop listen</p>
157 <p class="p6"><br></p>
158 <p class="p6"><br></p>
159 <p class="p6"><br></p>
160 <p class="p6"><br></p>
161 <p class="p5"><b>recording from other sources</b></p>
162 <p class="p6"><br></p>
163 <p class="p6"><br></p>
164 <p class="p6"><br></p>
165 <p class="p6"><br></p>
166 <p class="p7">s.boot;</p>
167 <p class="p6"><br></p>
168 <p class="p7">a = <span class="s4">RecNodeProxy</span>.audio(s, 2);</p>
169 <p class="p8"><span class="s5">b = a.index; </span>//get the bus index;</p>
170 <p class="p7">a.play; <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s8">//monitor;</span></p>
171 <p class="p9"><span class="s5">a.open(</span>"xproxySpace.aif"<span class="s5">);</span></p>
172 <p class="p7">a.record;</p>
173 <p class="p7">a.unpause;</p>
174 <p class="p6"><br></p>
175 <p class="p7">(</p>
176 <p class="p11">Routine<span class="s5">({</span></p>
177 <p class="p7"><span class="Apple-tab-span"> </span><span class="s4">var</span> id;</p>
178 <p class="p7"><span class="Apple-tab-span"> </span>loop({</p>
179 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>id = s.nextNodeID;</p>
180 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.sendMsg(<span class="s6">"/s_new"</span>, <span class="s6">"default"</span>, id,0,0, <span class="s7">\out</span>, b, <span class="s7">\freq</span>, rrand(400, 800));</p>
181 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0.2.wait;</p>
182 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.sendMsg(<span class="s6">"/n_set"</span>, id, <span class="s7">\gate</span>, 0);</p>
183 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0.2.wait;</p>
184 <p class="p7"><span class="Apple-tab-span"> </span>})</p>
185 <p class="p7">}).play;</p>
186 <p class="p7">)</p>
187 <p class="p6"><br></p>
188 <p class="p6"><br></p>
189 <p class="p8">//stop recording and close file</p>
190 <p class="p7">a.close;</p>
191 <p class="p6"><br></p>
192 <p class="p8">//monitor off</p>
193 <p class="p7">a.stop;<span class="Apple-converted-space"> </span></p>
194 <p class="p6"><br></p>
195 </body>
196 </html>