supernova: fixes for boost-1.49 and gcc-4.7
[supercollider.git] / Help / Control / OSCBundle.html
blobe68980ea44de1cafa0b6c501168f212fce410edd
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="824.44">
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: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #942b17}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #942b17; min-height: 12.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
16 span.s1 {font: 18.0px Helvetica}
17 span.s2 {font: 9.0px Monaco}
18 span.s3 {color: #000000}
19 span.s4 {color: #001fb3}
20 span.s5 {color: #606060}
21 span.Apple-tab-span {white-space:pre}
22 </style>
23 </head>
24 <body>
25 <p class="p1"><span class="s1"><b>OSCBundle<span class="Apple-tab-span"> </span></b></span><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><b>network</b><span class="s2"> </span><b>bundle object</b></p>
26 <p class="p2"><br></p>
27 <p class="p2"><br></p>
28 <p class="p1">superclass: Object</p>
29 <p class="p2"><br></p>
30 <p class="p1">a bundle object that allows to add preparation messages for async processes.</p>
31 <p class="p1">if this feature is not needed, a list object can be used instead.</p>
32 <p class="p2"><br></p>
33 <p class="p2"><br></p>
34 <p class="p1"><b>add(msg)</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>add an osc message to the bundle</p>
35 <p class="p2"><br></p>
36 <p class="p1"><b>addAll(array)<span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>add an array of osc messages to the bundle</p>
37 <p class="p2"><br></p>
38 <p class="p1"><b>addPrepare(msg)</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>add a preparation osc message, which is sent</p>
39 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>before the bundle is sent.</p>
40 <p class="p2"><br></p>
41 <p class="p2"><br></p>
42 <p class="p2"><br></p>
43 <p class="p1"><b>send(server, delta)</b><span class="Apple-tab-span"> </span>send the bundle to a server.<span class="Apple-converted-space">  </span>If preparation messages are given,</p>
44 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>they are sent, the process waits for their reception abd then sends the</p>
45 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>bundle.</p>
46 <p class="p2"><br></p>
47 <p class="p1"><b>schedSend(server, clock, quant)</b><span class="Apple-converted-space"> </span></p>
48 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>like send, but the sending is synced to a given clock (TempoClock) to the next beat.</p>
49 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>quant can be a pair of values: [quant, offset]</p>
50 <p class="p2"><br></p>
51 <p class="p2"><br></p>
52 <p class="p2"><br></p>
53 <p class="p3">// example</p>
54 <p class="p4"><br></p>
55 <p class="p5"><br></p>
56 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// create a new, empty instance</p>
57 <p class="p6"><span class="Apple-tab-span"> </span>a = <span class="s4">OSCBundle</span>.new;<span class="Apple-converted-space"> </span></p>
58 <p class="p5"><span class="Apple-tab-span"> </span></p>
59 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// a synthdef that needs to be sent to the server, an operation that is asynchronous,</p>
60 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// i.e. we have to wait until it is finished.</p>
61 <p class="p6"><span class="Apple-tab-span"> </span>x = <span class="s4">SynthDef</span>(<span class="s5">"test"</span>, { <span class="s4">OffsetOut</span>.ar(0, <span class="s4">BPF</span>.ar(<span class="s4">Impulse</span>.ar(4) * 10, <span class="s4">Rand</span>(9000, 1000), 0.1)) });</p>
62 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// this is why addPrepare is used.</p>
63 <p class="p6"><span class="Apple-tab-span"> </span>a.addPrepare([<span class="s5">"/d_recv"</span>, x.asBytes]);</p>
64 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// add is used with synchronous operations, like starting synths.</p>
65 <p class="p6"><span class="Apple-tab-span"> </span>a.add([<span class="s5">"/s_new"</span>, <span class="s5">"test"</span>, -1]);</p>
66 <p class="p5"><br></p>
67 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// the bundle has now the synchronous separated from the asynchronous bundles:</p>
68 <p class="p6"><span class="Apple-tab-span"> </span>a.messages;</p>
69 <p class="p6"><span class="Apple-tab-span"> </span>a.preparationMessages;</p>
70 <p class="p5"><span class="Apple-tab-span"> </span></p>
71 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// this can be simply sent - the bundle takes care of the server client communication</p>
72 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// like waiting for the synthdef to be loaded. the synth is started when the preparation</p>
73 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// is finished.</p>
74 <p class="p5"><span class="Apple-tab-span"> </span></p>
75 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span>s.boot; </span>// boot the server</p>
76 <p class="p6"><span class="Apple-tab-span"> </span>a.send(s);</p>
77 <p class="p5"><br></p>
78 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span>s.freeAll; </span>// free all nodes on the server</p>
79 <p class="p5"><br></p>
80 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// scheduled sending: the synths are started on the next beat.</p>
81 <p class="p5"><br></p>
82 <p class="p6"><span class="Apple-tab-span"> </span>a.schedSend(s, <span class="s4">TempoClock</span>.default, 1);<span class="Apple-converted-space"> <span class="Apple-tab-span"> </span></span></p>
83 <p class="p6"><span class="Apple-tab-span"> </span>a.schedSend(s, <span class="s4">TempoClock</span>.default, 1);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
84 <p class="p6"><span class="Apple-tab-span"> </span>a.schedSend(s, <span class="s4">TempoClock</span>.default, 1);</p>
85 <p class="p5"><span class="Apple-tab-span"> </span></p>
86 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span>s.freeAll; </span>// free all nodes on the server</p>
87 <p class="p5"><br></p>
88 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// the bundle can contain several preparation messages and messages at a time.</p>
89 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// the proparationMessages are sent first and only when they are all completed,</p>
90 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// the other bundles are sent.</p>
91 <p class="p3"><span class="s3"><span class="Apple-tab-span"> </span></span>// the bundle can also be reused, if there is no specific allocated buffers/node ids.<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
92 <p class="p5"><span class="Apple-tab-span"> </span></p>
93 </body>
94 </html>