1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
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: 18.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: 13.0px Helvetica
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica
; min-height: 16.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: #606060}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #091fb1}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #902a19}
20 span
.s1
{font: 13.0px Helvetica
}
21 span
.s2
{color: #091fb1}
22 span
.s3
{color: #000000}
23 span
.s4
{color: #606060}
24 span
.s5
{color: #456c20}
25 span
.Apple-tab-span
{white-space:pre
}
29 <p class=
"p1"><b>NodeMap
</b></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p3">object to store control values and bus mappings independant of of a specific node.
</p>
32 <p class=
"p2"><br></p>
33 <p class=
"p4"><span class=
"s1"><span class=
"Apple-tab-span"> </span></span><b>set(key1, value1, ...)
</b> <span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>set arguments of a node
</p>
34 <p class=
"p4"><span class=
"Apple-tab-span"> </span><b>map(key1, busindex1, ...)
</b> <span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>set bus mappings of a node
</p>
35 <p class=
"p4"><span class=
"Apple-tab-span"> </span><b>unset(key1, key2, ...)
<span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>remove settings
</p>
36 <p class=
"p4"><span class=
"Apple-tab-span"> </span><b>unmap(key1, key2, ...)
</b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>remove mappings
</p>
37 <p class=
"p4"><span class=
"Apple-tab-span"> </span><b>setn(key1, valueArray1, ...)
</b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>set ranges of controls
</p>
38 <p class=
"p4"><span class=
"Apple-tab-span"> </span><b>mapn(key1, busindex1,
<span class=
"Apple-converted-space"> </span>numChan...)
</b><span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span></p>
39 <p class=
"p4"><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><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>map num busses mappings to node
</p>
40 <p class=
"p5"><br></p>
41 <p class=
"p4"><span class=
"Apple-tab-span"> </span><b>at(index)
</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><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>return setting at that key.
<span class=
"Apple-converted-space"> </span></p>
42 <p class=
"p4"><span class=
"Apple-tab-span"> </span><b>sendToNode(aTarget, latency)
</b><span class=
"Apple-tab-span"> </span>apply a setting to a node by sending a bundle
</p>
43 <p class=
"p4"><span class=
"Apple-tab-span"> </span><b>send(server, nodeID, latency)
</b><span class=
"Apple-tab-span"> </span>apply a setting to a node by sending a bundle
</p>
44 <p class=
"p4"><span class=
"s1"><span class=
"Apple-tab-span"> </span></span><b>addToBundle(aBundle)
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>add all my messages to the bundle
</p>
45 <p class=
"p6"><br></p>
46 <p class=
"p2"><br></p>
47 <p class=
"p2"><br></p>
48 <p class=
"p2"><br></p>
49 <p class=
"p7">s.boot;
</p>
50 <p class=
"p2"><br></p>
52 <p class=
"p8"><span class=
"s2">SynthDef
</span><span class=
"s3">(
</span>"modsine"<span class=
"s3">,
<span class=
"Apple-converted-space"> </span></span></p>
53 <p class=
"p7"><span class=
"Apple-tab-span"> </span>{
<span class=
"s2">arg
</span> freq=
320, amp=
0.2;
</p>
54 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Out
</span>.ar(
0,
<span class=
"s2">SinOsc
</span>.ar(freq,
0, amp));
</p>
55 <p class=
"p7"><span class=
"Apple-tab-span"> </span>}).send(s);
</p>
56 <p class=
"p9">SynthDef
<span class=
"s3">(
</span><span class=
"s4">"lfo"</span><span class=
"s3">,
<span class=
"Apple-converted-space"> </span></span></p>
57 <p class=
"p7"><span class=
"Apple-tab-span"> </span>{
<span class=
"s2">arg
</span> rate=
2, busNum=
0;
</p>
58 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Out
</span>.kr(busNum,
<span class=
"s2">LFPulse
</span>.kr(rate,
0,
0.1,
0.2))
<span class=
"Apple-converted-space"> </span></p>
59 <p class=
"p7"><span class=
"Apple-tab-span"> </span>}).send(s);
</p>
61 <p class=
"p2"><br></p>
62 <p class=
"p10">//start nodes
</p>
64 <p class=
"p7">b =
<span class=
"s2">Bus
</span>.control(s,
1);
</p>
65 <p class=
"p8"><span class=
"s3">x =
</span><span class=
"s2">Synth
</span><span class=
"s3">(
</span>"modsine"<span class=
"s3">);
</span></p>
66 <p class=
"p7">y =
<span class=
"s2">Synth
</span>.before(x,
<span class=
"s4">"lfo"</span>, [
<span class=
"s5">\busNum
</span>, b]);
</p>
68 <p class=
"p2"><br></p>
69 <p class=
"p10">//create some node maps
</p>
71 <p class=
"p7">h =
<span class=
"s2">NodeMap
</span>.new;
</p>
72 <p class=
"p7">h.set(
<span class=
"s5">\freq
</span>,
800);
</p>
73 <p class=
"p7">h.map(
<span class=
"s5">\amp
</span>, b);
</p>
74 <p class=
"p2"><br></p>
75 <p class=
"p7">k =
<span class=
"s2">NodeMap
</span>.new;
</p>
76 <p class=
"p7">k.set(
<span class=
"s5">\freq
</span>,
400);
</p>
77 <p class=
"p7">k.unmap(
<span class=
"s5">\amp
</span>);
</p>
79 <p class=
"p2"><br></p>
80 <p class=
"p10">//apply the maps
</p>
81 <p class=
"p2"><br></p>
82 <p class=
"p10"><span class=
"s3">h.sendToNode(x);
</span>//the first time a new bundle is made
</p>
83 <p class=
"p7">k.sendToNode(x);
</p>
84 <p class=
"p2"><br></p>
85 <p class=
"p10"><span class=
"s3">h.sendToNode(x);
</span>//the second time the cache is used
</p>
86 <p class=
"p7">k.sendToNode(x);
</p>
87 <p class=
"p2"><br></p>
88 <p class=
"p7">h.set(
<span class=
"s5">\freq
</span>,
600);
</p>
89 <p class=
"p2"><br></p>
90 <p class=
"p10"><span class=
"s3">h.sendToNode(x);
</span>//when a value was changed, a new bundle is made
</p>
91 <p class=
"p2"><br></p>
92 <p class=
"p10">//free all
</p>
93 <p class=
"p7">x.free; b.free; y.free;
</p>
94 <p class=
"p2"><br></p>
95 <p class=
"p2"><br></p>
96 <p class=
"p2"><br></p>