Include a header file required for build on mac 10.4
[supercollider.git] / Help / Control / MIDIIn.html
blob2f41da074a4058f4dcceececa84e49ae3745616c
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.47">
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: 12.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: 14.0px Helvetica}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #76371b}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #002bad}
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: 12.0px Helvetica; color: #76371b}
20 p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica}
21 p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica; min-height: 12.0px}
22 span.s1 {color: #0016ff}
23 span.s2 {color: #0031f2}
24 span.s3 {color: #000000}
25 span.s4 {color: #002bad}
26 span.s5 {text-decoration: underline}
27 span.s6 {color: #001ac0}
28 span.s7 {color: #606060}
29 span.s8 {color: #576725}
30 span.Apple-tab-span {white-space:pre}
31 </style>
32 </head>
33 <body>
34 <p class="p1"><b>MIDIIn</b></p>
35 <p class="p2"><br></p>
36 <p class="p3">This document explains technical details of the MIDI hardware interface class, MIDIIn.</p>
37 <p class="p4"><br></p>
38 <p class="p3">MIDIIn is a simple and direct interface.<span class="Apple-converted-space">  </span>When MIDI events come into Super Collider, MIDIIn evaluates simple handler functions.</p>
39 <p class="p4"><br></p>
40 <p class="p3">For general programming, <b>users should not use the MIDIIn class directly</b>.<span class="Apple-converted-space">  </span>See the <a href="MIDIResponder.html"><span class="s1">MIDIResponder</span></a> classes for higher level event matching and more flexible handling of event handlers.</p>
41 <p class="p4"><br></p>
42 <p class="p3">Certain MIDI messages are supported only through MIDIIn. These are: polytouch, program, sysex, sysrt, smpte.</p>
43 <p class="p4"><br></p>
44 <p class="p3">See the <a href="UsingMIDI.html"><span class="s2">UsingMIDI</span></a> helpfile for practical considerations and techniques for using MIDI in SC.</p>
45 <p class="p4"><br></p>
46 <p class="p5"><b>The MIDIIn class</b></p>
47 <p class="p4"><br></p>
48 <p class="p3"><b>MIDIIn </b>links MIDI input received from the operating system to a set of user defined functions.</p>
49 <p class="p3">Only one set of MIDI input handling functions can be active at a time, they are stored in the</p>
50 <p class="p3">following class variables:</p>
51 <p class="p4"><br></p>
52 <p class="p3"><span class="Apple-tab-span"> </span>noteOff, noteOn, polytouch, control, program, touch, bend, sysex, sysrt, smpte</p>
53 <p class="p4"><br></p>
54 <p class="p3">The first argument these functions receive is an unique identifier that specifies the source of the data.</p>
55 <p class="p4"><br></p>
56 <p class="p3"><b>Quick start for 1 port:</b></p>
57 <p class="p2"><br></p>
58 <p class="p6">(</p>
59 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s4">MIDIIn</span><span class="s3">.connect; <span class="Apple-tab-span"> </span></span>// init for one port midi interface</p>
60 <p class="p7">// register functions:<span class="Apple-tab-span"> </span></p>
61 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.noteOff = { <span class="s4">arg</span> src, chan, num, vel; <span class="Apple-tab-span"> </span>[chan,num,vel / 127].postln; };</p>
62 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.noteOn = { <span class="s4">arg</span> src, chan, num, vel; <span class="Apple-tab-span"> </span>[chan,num,vel / 127].postln; };</p>
63 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.polytouch = { <span class="s4">arg</span> src, chan, num, vel; <span class="Apple-tab-span"> </span>[chan,num,vel / 127].postln; };</p>
64 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.control = { <span class="s4">arg</span> src, chan, num, val; <span class="Apple-tab-span"> </span>[chan,num,val].postln; };</p>
65 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.program = { <span class="s4">arg</span> src, chan, prog; <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[chan,prog].postln; };</p>
66 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.touch = { <span class="s4">arg</span> src, chan, pressure; <span class="Apple-tab-span"> </span>[chan,pressure].postln; };</p>
67 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.bend = { <span class="s4">arg</span> src, chan, bend; <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[chan,bend - 8192].postln; };</p>
68 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.sysex = { <span class="s4">arg</span> src, sysex; <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>sysex.postln; };</p>
69 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.sysrt = { <span class="s4">arg</span> src, chan, val; <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[chan,val].postln; };</p>
70 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">MIDIIn</span>.smpte = { <span class="s4">arg</span> src, chan, val; <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[chan,val].postln; };</p>
71 <p class="p6">)</p>
72 <p class="p4"><br></p>
73 <p class="p3"><b>Quick start for 2 or more ports:</b></p>
74 <p class="p4"><br></p>
75 <p class="p8">(</p>
76 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">var</span> inPorts = 2;</p>
77 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">var</span> outPorts = 2;</p>
78 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s4">MIDIClient</span><span class="s3">.init(inPorts,outPorts);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// explicitly intialize the client</p>
79 <p class="p6"><span class="Apple-tab-span"> </span>inPorts.do({ arg i;<span class="Apple-converted-space"> </span></p>
80 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4"><span class="Apple-tab-span"> </span>MIDIIn</span>.connect(i, <span class="s4">MIDIClient</span>.sources.at(i));</p>
81 <p class="p6"><span class="Apple-tab-span"> </span>});</p>
82 <p class="p6">)</p>
83 <p class="p2"><br></p>
84 <p class="p2"><br></p>
85 <p class="p3"><b><span class="s5">class methods:</span></b></p>
86 <p class="p2"><span class="Apple-tab-span"> </span><span class="Apple-converted-space"> </span></p>
87 <p class="p3"><span class="Apple-converted-space"> </span><b>*findPort(deviceName,portName)</b></p>
88 <p class="p3"><span class="Apple-converted-space"> <span class="Apple-tab-span"> </span></span>searches for a connected MIDIEndPoint by name</p>
89 <p class="p3"><span class="Apple-converted-space"> <span class="Apple-tab-span"> </span></span>list connected ins:</p>
90 <p class="p6"><span class="Apple-tab-span"> </span> <span class="Apple-tab-span"> </span><span class="s6">MIDIClient</span>.sources</p>
91 <p class="p4"><br></p>
92 <p class="p3"><b>*noteOn_(function)</b></p>
93 <p class="p3"><b><span class="Apple-tab-span"> </span>function </b>is evaluated whenever a MIDI noteOn message is received, it is passed the following arguments:</p>
94 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
95 <p class="p3"><span class="Apple-tab-span"> </span>MIDIchannel<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ranges from 0 to 15<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
96 <p class="p3"><span class="Apple-tab-span"> </span>keyNumber<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0 - 127</p>
97 <p class="p3"><span class="Apple-tab-span"> </span>velocity<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>0 - 127<span class="Apple-tab-span"> </span></p>
98 <p class="p3"><b>*noteOff_(function)</b></p>
99 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
100 <p class="p3"><span class="Apple-tab-span"> </span>MIDIchannel<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ranges from 0 to 15<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
101 <p class="p3"><span class="Apple-tab-span"> </span>keyNumber<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0 - 127</p>
102 <p class="p3"><span class="Apple-tab-span"> </span>velocity<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>0 - 127,<span class="Apple-tab-span"> </span>typically 64 unless noteOff velocity is supported</p>
103 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
104 <p class="p3"><b>*polytouch_(function)</b></p>
105 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
106 <p class="p3"><span class="Apple-tab-span"> </span>MIDIchannel<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ranges from 0 to 15<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
107 <p class="p3"><span class="Apple-tab-span"> </span>keyNumber<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0 - 127</p>
108 <p class="p3"><span class="Apple-tab-span"> </span>pressure<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>0 - 127</p>
109 <p class="p3"><b>*control_(function)</b></p>
110 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
111 <p class="p3"><span class="Apple-tab-span"> </span>MIDIchannel<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ranges from 0 to 15<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
112 <p class="p3"><span class="Apple-tab-span"> </span>controllerNumber<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0 - 127</p>
113 <p class="p3"><span class="Apple-tab-span"> </span>value<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>0 - 127</p>
114 <p class="p3"><b>*program_(function)</b></p>
115 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
116 <p class="p3"><span class="Apple-tab-span"> </span>MIDIchannel<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ranges from 0 to 15<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
117 <p class="p3"><span class="Apple-tab-span"> </span>programNumber<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0 - 127</p>
118 <p class="p3"><b>*touch_(function)</b></p>
119 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
120 <p class="p3"><span class="Apple-tab-span"> </span>MIDIchannel<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ranges from 0 to 15<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
121 <p class="p3"><span class="Apple-tab-span"> </span>pressure<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>0 - 127</p>
122 <p class="p3"><b>*bend_(function)</b></p>
123 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
124 <p class="p3"><span class="Apple-tab-span"> </span>MIDIchannel<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ranges from 0 to 15<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
125 <p class="p3"><span class="Apple-tab-span"> </span>bend<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>0..16384, <span class="Apple-converted-space">  </span>the<span class="Apple-converted-space">  </span>midpoint is 8192</p>
126 <p class="p3"><b>*sysex_(function)</b></p>
127 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
128 <p class="p3"><span class="Apple-tab-span"> </span>system exclusive data<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>an Int8Array (includes f0 and f7)<span class="Apple-converted-space"> </span></p>
129 <p class="p3"><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>see manufacturer references for details</p>
130 <p class="p3"><span class="Apple-tab-span"> </span>note: The current implementation<span class="Apple-converted-space">  </span>assembles a complete system exclusive packet</p>
131 <p class="p3"><span class="Apple-converted-space"> </span>before evaluating the function.</p>
132 <p class="p3"><b>*sysrt_(function)</b></p>
133 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
134 <p class="p3"><span class="Apple-tab-span"> </span>index<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>ranges from 0 to 15<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
135 <p class="p3"><span class="Apple-tab-span"> </span>data<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>0 - 127</p>
136 <p class="p4"><span class="Apple-tab-span"> </span></p>
137 <p class="p3"><b><span class="Apple-tab-span"> </span>index<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>data<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>message</b></p>
138 <p class="p3"><span class="Apple-tab-span"> </span>2<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>14bits<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>song pointer<span class="Apple-tab-span"> </span></p>
139 <p class="p3"><span class="Apple-tab-span"> </span>3 <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>7bits<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>song select</p>
140 <p class="p3"><span class="Apple-tab-span"> </span>8<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>midiclock</p>
141 <p class="p3"><span class="Apple-tab-span"> </span>10<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>start</p>
142 <p class="p3"><span class="Apple-tab-span"> </span>11<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>continue</p>
143 <p class="p3"><span class="Apple-tab-span"> </span>12<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>stop</p>
144 <p class="p4"><br></p>
145 <p class="p3"><b>*smpte</b></p>
146 <p class="p3"><b><span class="Apple-tab-span"> </span></b>uid<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>unique identifier of the MIDI port</p>
147 <p class="p3"><span class="Apple-tab-span"> </span>index<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>ranges from 0 to 7<span class="Apple-tab-span"> </span></p>
148 <p class="p3"><span class="Apple-tab-span"> </span>data<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>4 bits</p>
149 <p class="p4"><span class="Apple-tab-span"> </span></p>
150 <p class="p3"><span class="Apple-tab-span"> </span>Over MIDI, SMPTE is transmitted at 1/4 frame intervals four times faster than the frame rate.</p>
151 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>index<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>data</p>
152 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0<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>frames low nibble</p>
153 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>1<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>frames hi nibble</p>
154 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>2<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>seconds low nibble</p>
155 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>3<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>seconds hi nibble</p>
156 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>4<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>minutes low nibble</p>
157 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>5<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>minutes hi nibble</p>
158 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>6<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>hours low nibble</p>
159 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>7<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>hours hi <b>bit</b> OR'ed with frameRate</p>
160 <p class="p3"><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>0 -&gt; 24fps</p>
161 <p class="p3"><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>2 -&gt; 25 fps</p>
162 <p class="p3"><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>4 -&gt; 30 fps drop frame</p>
163 <p class="p3"><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>6 -&gt; 30 fps</p>
164 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Nibbles are sent in ascending order,<span class="Apple-converted-space"> </span></p>
165 <p class="p2"><span class="Apple-tab-span"> </span></p>
166 <p class="p2"><br></p>
167 <p class="p6">(</p>
168 <p class="p6"><span class="s4">MIDIIn</span>.connect;</p>
169 <p class="p6">s = <span class="s4">Server</span>.local;</p>
170 <p class="p6">s.boot;</p>
171 <p class="p6">s.latency = 0;</p>
172 <p class="p2"><br></p>
173 <p class="p6"><span class="s4">SynthDef</span>(<span class="s7">"sik-goo"</span>, { <span class="s4">arg</span> freq=440,formfreq=100,gate=0.0,bwfreq=800;</p>
174 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">var</span> x;</p>
175 <p class="p6"><span class="Apple-tab-span"> </span>x = <span class="s4">Formant</span>.ar(</p>
176 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">SinOsc</span>.kr(0.02, 0, 10, freq),<span class="Apple-converted-space"> </span></p>
177 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>formfreq,</p>
178 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>bwfreq</p>
179 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>);</p>
180 <p class="p6"><span class="Apple-tab-span"> </span>x = <span class="s4">EnvGen</span>.kr(<span class="s4">Env</span>.adsr, gate,<span class="s4">Latch</span>.kr(gate,gate)) * x;</p>
181 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">Out</span>.ar(0, x);</p>
182 <p class="p6">}).send(s);</p>
183 <p class="p2"><br></p>
184 <p class="p9"><span class="s3">x = </span><span class="s4">Synth</span><span class="s3">(</span>"sik-goo"<span class="s3">);</span></p>
185 <p class="p2"><br></p>
186 <p class="p7">//set the action:</p>
187 <p class="p6"><span class="s4">MIDIIn</span>.noteOn = {<span class="s4">arg</span> src, chan, num, vel;</p>
188 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>x.set(<span class="s8">\freq</span>, num.midicps / 4.0);</p>
189 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>x.set(<span class="s8">\gate</span>, vel / 200 );</p>
190 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>x.set(<span class="s8">\formfreq</span>, vel / 127 * 1000);</p>
191 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
192 <p class="p6"><span class="s4">MIDIIn</span>.noteOff = { <span class="s4">arg</span> src,chan,num,vel;</p>
193 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>x.set(<span class="s8">\gate</span>, 0.0);</p>
194 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
195 <p class="p6"><span class="s4">MIDIIn</span>.bend = { <span class="s4">arg</span> src,chan,val;</p>
196 <p class="p7"><span class="s3"><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>//(val * 0.048828125).postln;</p>
197 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>x.set(<span class="s8">\bwfreq</span>, val * 0.048828125 );</p>
198 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
199 <p class="p6">)</p>
200 <p class="p2"><br></p>
201 <p class="p2"><br></p>
202 <p class="p2"><br></p>
203 <p class="p2"><br></p>
204 <p class="p2"><br></p>
205 <p class="p10">//i used this and got acceptable latency for triggering synths live.</p>
206 <p class="p10">//The latency might actually be less than sc2, but i haven't used it enough</p>
207 <p class="p10">//to tell for sure yet.</p>
208 <p class="p10">//Powerbook G4, 512mb ram.</p>
209 <p class="p3">- matrix6k@somahq.com</p>
210 <p class="p2"><br></p>
211 <p class="p2"><br></p>
212 <p class="p6">writing to the bus rather than directly to the synth</p>
213 <p class="p2"><br></p>
214 <p class="p6">s = <span class="s4">Server</span>.local;</p>
215 <p class="p6">s.boot;</p>
216 <p class="p2"><br></p>
217 <p class="p6">(</p>
218 <p class="p6">s.latency = 0;</p>
219 <p class="p6"><span class="s4">SynthDef</span>(<span class="s7">"moto-rev"</span>, { <span class="s4">arg</span> ffreq=100;</p>
220 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">var</span> x;</p>
221 <p class="p6"><span class="Apple-tab-span"> </span>x = <span class="s4">RLPF</span>.ar(<span class="s4">LFPulse</span>.ar(<span class="s4">SinOsc</span>.kr(0.2, 0, 10, 21), [0,0.1], 0.1),</p>
222 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span> ffreq, 0.1)</p>
223 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span> .clip2(0.4);</p>
224 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">Out</span>.ar(0, x);</p>
225 <p class="p6">}).send(s);</p>
226 <p class="p2"><br></p>
227 <p class="p6">b = <span class="s4">Bus</span>.control(s);</p>
228 <p class="p2"><br></p>
229 <p class="p9"><span class="s3">x = </span><span class="s4">Synth</span><span class="s3">(</span>"moto-rev"<span class="s3">);</span></p>
230 <p class="p2"><br></p>
231 <p class="p7">// map the synth's first input (ffreq) to read</p>
232 <p class="p7">// from the bus' output index</p>
233 <p class="p6">x.map(0, b);</p>
234 <p class="p2"><br></p>
235 <p class="p2"><br></p>
236 <p class="p6"><span class="s4">MIDIIn</span>.connect;</p>
237 <p class="p7">//set the action:</p>
238 <p class="p6"><span class="s4">MIDIIn</span>.noteOn = {<span class="s4">arg</span> src, chan, num, vel;</p>
239 <p class="p6"><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.value = num.midicps.postln;</p>
240 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
241 <p class="p2"><br></p>
242 <p class="p6"><span class="s4">MIDIIn</span>.control = {<span class="s4">arg</span> src, chan, num, val;</p>
243 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[chan,num,val].postln;</p>
244 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
245 <p class="p6"><span class="s4">MIDIIn</span>.bend = {<span class="s4">arg</span> src, chan, val;</p>
246 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>val.postln;</p>
247 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
248 <p class="p6">)</p>
249 <p class="p2"><br></p>
250 <p class="p7">// cleanup</p>
251 <p class="p6">x.free;</p>
252 <p class="p6">b.free;</p>
253 <p class="p2"><br></p>
254 <p class="p2"><br></p>
255 <p class="p2"><br></p>
256 <p class="p3"><b>Keyboard Split for two voices</b></p>
257 <p class="p3"><b>pbend to cutoff, mod to rez, 7 to amp</b></p>
258 <p class="p10">// - matrix6k@somahq.com</p>
259 <p class="p11"><b>prepare</b></p>
260 <p class="p12"><br></p>
261 <p class="p6">s.boot;</p>
262 <p class="p6">(</p>
263 <p class="p6"><span class="s4">SynthDef</span>(<span class="s7">"funk"</span>,{ <span class="s4">arg</span> freq = 700, amp = 0.2, gate = 1, cutoff = 20000, rez = 1, lfospeed=0;</p>
264 <p class="p6"><span class="Apple-converted-space">     </span><span class="s4">var</span> e,x,env,range,filterfreq;</p>
265 <p class="p6"><span class="Apple-tab-span"> </span>e = <span class="s4">Env</span>.new([0, 0.1, 0.1, 0], [0, 0.1, 0.1], <span class="s8">'linear'</span>, 2);</p>
266 <p class="p6"><span class="Apple-tab-span"> </span>env=<span class="s4">Env</span>.adsr(0.3,1,1,1);</p>
267 <p class="p6"><span class="Apple-tab-span"> </span>range = cutoff -1;</p>
268 <p class="p6"><span class="Apple-tab-span"> </span>filterfreq = <span class="s4">SinOsc</span>.kr(lfospeed,0, range, cutoff).abs;</p>
269 <p class="p6"><span class="Apple-tab-span"> </span>x = <span class="s4">RLPF</span>.ar(<span class="s4">Mix</span>.ar([</p>
270 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">Mix</span>.arFill(2, {<span class="s4">Saw</span>.ar(freq *2 + 0.2.rand2, amp)}),</p>
271 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">Mix</span>.arFill(2, {<span class="s4">Saw</span>.ar(freq *4+ 0.2.rand2, amp)})</p>
272 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>]),</p>
273 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">EnvGen</span>.kr(env,gate)*filterfreq,</p>
274 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>rez);</p>
275 <p class="p6"><span class="Apple-converted-space">     </span><span class="s4">Out</span>.ar([0,1],x * <span class="s4">EnvGen</span>.kr(e, gate, doneAction: 2))</p>
276 <p class="p2"><br></p>
277 <p class="p6">}).send(s);</p>
278 <p class="p2"><br></p>
279 <p class="p6"><span class="s4">SynthDef</span>(<span class="s7">"strings"</span>,{ <span class="s4">arg</span> freq = 700, amp = 0.2, gate = 1;</p>
280 <p class="p6"><span class="Apple-converted-space">     </span><span class="s4">var</span> x,enve;</p>
281 <p class="p6"><span class="Apple-tab-span"> </span>enve = <span class="s4">Env</span>.new([0, 0.1, 0.1, 0], [2, 0.1, 1], <span class="s8">'linear'</span>, 2);</p>
282 <p class="p6"><span class="Apple-tab-span"> </span>x = <span class="s4">RLPF</span>.ar(<span class="s4">Mix</span>.ar([</p>
283 <p class="p6"><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="s4">Mix</span>.arFill(2, {<span class="s4">Saw</span>.ar(freq +2.rand2,0.6)}),</p>
284 <p class="p6"><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="s4">Mix</span>.arFill(2, {<span class="s4">Saw</span>.ar(freq *0.5 + 2.rand2,0.6)})</p>
285 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>]),</p>
286 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>6000,1);</p>
287 <p class="p6"><span class="Apple-converted-space">     </span><span class="s4">Out</span>.ar([0,1],x * <span class="s4">EnvGen</span>.kr(enve, gate, doneAction: 2))</p>
288 <p class="p2"><br></p>
289 <p class="p6">}).send(s);</p>
290 <p class="p2"><br></p>
291 <p class="p6">)</p>
292 <p class="p11"><b>then...</b></p>
293 <p class="p6">(</p>
294 <p class="p6"><span class="s4">var</span> keys, cutspec, cutbus, rezspec, rezbus, lfospec, lfobus;</p>
295 <p class="p6">keys = <span class="s4">Array</span>.newClear(128);</p>
296 <p class="p2"><br></p>
297 <p class="p8">MIDIClient<span class="s3">.init;</span></p>
298 <p class="p6"><span class="s4">MIDIIn</span>.connect(0, <span class="s4">MIDIClient</span>.sources.at(0));</p>
299 <p class="p2"><br></p>
300 <p class="p6">g = <span class="s4">Group</span>.new;</p>
301 <p class="p2"><br></p>
302 <p class="p6">cutspec = <span class="s4">ControlSpec</span>(100,10000,<span class="s8">\linear</span>,0.001);</p>
303 <p class="p6">cutbus = <span class="s4">Bus</span>.new(<span class="s8">\control</span>,1,1,s);</p>
304 <p class="p6">cutbus.value = 10000;</p>
305 <p class="p2"><br></p>
306 <p class="p6">rezspec = <span class="s4">ControlSpec</span>(1,0,<span class="s8">\linear</span>,0.001);</p>
307 <p class="p6">rezbus = <span class="s4">Bus</span>.new(<span class="s8">\control</span>,2,1,s);</p>
308 <p class="p6">rezbus.value = 1.0;</p>
309 <p class="p2"><br></p>
310 <p class="p6">lfospec = <span class="s4">ControlSpec</span>(0,50,<span class="s8">\linear</span>,0.001);</p>
311 <p class="p6">lfobus = <span class="s4">Bus</span>.new(<span class="s8">\control</span>,3,1,s);</p>
312 <p class="p2"><br></p>
313 <p class="p6"><span class="s4">MIDIIn</span>.control = {<span class="s4">arg</span> src, chan, num, val;</p>
314 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>if(num == 1,{</p>
315 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>rezbus.value = rezspec.map(val/127.0);</p>
316 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
317 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>if(num == 7,{</p>
318 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>lfobus.value = lfospec.map(val/127.0).postln;</p>
319 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
320 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
321 <p class="p6"><span class="s4">MIDIIn</span>.bend = {<span class="s4">arg</span> src, chan, val;</p>
322 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>cutbus.value = cutspec.map(val/16383.0);</p>
323 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
324 <p class="p2"><br></p>
325 <p class="p6"><span class="s4">MIDIIn</span>.noteOn = {<span class="s4">arg</span> src, chan, num, vel;</p>
326 <p class="p6"><span class="Apple-tab-span"> </span><span class="s4">var</span> node;</p>
327 <p class="p6"><span class="Apple-tab-span"> </span>if(num &lt; 60, {</p>
328 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>node = <span class="s4">Synth</span>.tail(g, <span class="s7">"funk"</span>, [<span class="s8">\freq</span>, num.midicps, <span class="s8">\amp</span>, vel/255]);</p>
329 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>node.map(</span>"cutoff"<span class="s3">,1,</span>"rez"<span class="s3">,2,</span>"lfospeed"<span class="s3">,3);</span></p>
330 <p class="p7">//<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>node = Synth.basicNew("funk",s);</p>
331 <p class="p7">//<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.sendBundle(nil,</p>
332 <p class="p7">//<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>node.addToTailMsg(g,[\freq, num.midicps, \amp, vel/255]),</p>
333 <p class="p7">//<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>node.mapMsg("cutoff",1,"rez",2,"lfospeed",3)</p>
334 <p class="p7">//<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>);</p>
335 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>keys.put(num, node)</p>
336 <p class="p6"><span class="Apple-tab-span"> </span>},{<span class="Apple-converted-space"> </span></p>
337 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>node = <span class="s4">Synth</span>.tail(g, <span class="s7">"strings"</span>, [<span class="s8">\freq</span>, num.midicps, <span class="s8">\amp</span>, vel/255]);</p>
338 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>keys.put(num, node)</p>
339 <p class="p6"><span class="Apple-tab-span"> </span>});</p>
340 <p class="p6">};</p>
341 <p class="p2"><br></p>
342 <p class="p6"><span class="s4">MIDIIn</span>.noteOff = {<span class="s4">arg</span> src, chan, num, vel;</p>
343 <p class="p6"><span class="Apple-converted-space">    </span><span class="s4">var</span> node;</p>
344 <p class="p6"><span class="Apple-converted-space">    </span>node = keys.at(num);</p>
345 <p class="p6"><span class="Apple-converted-space">    </span>if (node.notNil, {</p>
346 <p class="p6"><span class="Apple-converted-space">        </span>keys.put(num, <span class="s4">nil</span>);</p>
347 <p class="p6"><span class="Apple-converted-space">        </span>s.sendMsg(<span class="s7">"/n_set"</span>, node.nodeID, <span class="s7">"gate"</span>, 0);</p>
348 <p class="p7"><span class="s3"><span class="Apple-converted-space">        </span></span>// or node.release</p>
349 <p class="p7"><span class="s3"><span class="Apple-converted-space">        </span></span>// then free it ... or get the NodeWatcher to do it</p>
350 <p class="p6"><span class="Apple-converted-space">    </span>});</p>
351 <p class="p6">};</p>
352 <p class="p2"><br></p>
353 <p class="p6">)</p>
354 <p class="p2"><br></p>
355 <p class="p2"><br></p>
356 <p class="p2"><br></p>
357 <p class="p2"><br></p>
358 <p class="p2"><br></p>
359 <p class="p2"><br></p>
360 <p class="p2"><br></p>
361 <p class="p2"><br></p>
362 <p class="p2"><br></p>
363 <p class="p2"><br></p>
364 </body>
365 </html>