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=
"1038.35">
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: 12.0px Helvetica
; color: #0000ee}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
; min-height: 17.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
; min-height: 14.0px}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica
; min-height: 17.0px}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #a41c14}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #0018b8}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #606060}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 56.0px; text-indent: -56.0px; font: 9.0px Monaco
}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 56.0px; text-indent: -56.0px; font: 9.0px Monaco
; min-height: 12.0px}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 56.0px; text-indent: -56.0px; font: 9.0px Monaco
; color: #a41c14}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #a41c14}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; min-height: 12.0px}
27 p
.p18
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #a71e14}
28 p
.p19
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
29 p
.p20
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica
}
30 span
.s1
{font: 18.0px Helvetica
}
31 span
.s2
{color: #000000}
32 span
.s3
{text-decoration: underline
}
33 span
.s4
{color: #0018b8}
34 span
.s5
{font: 12.0px Helvetica
}
35 span
.s6
{color: #606060}
36 span
.s7
{font: 9.0px Monaco
}
37 span
.s8
{color: #356f14}
38 span
.s9
{color: #a41c14}
39 span
.s10
{font: 14.0px Helvetica
}
40 span
.s11
{font: 9.0px Monaco
; color: #356f14}
41 span
.s12
{color: #0034fd}
42 span
.s13
{color: #0926b7}
43 span
.s14
{color: #a71e14}
44 span
.s15
{font: 12.0px Helvetica
; color: #000000}
45 span
.Apple-tab-span
{white-space:pre
}
49 <p class=
"p1"><span class=
"s1"><b>Node
<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></b></span><b>abstract superclass of Synth and Group
</b></p>
50 <p class=
"p2"><br></p>
51 <p class=
"p1"><b>superclass: Object
</b></p>
52 <p class=
"p2"><br></p>
53 <p class=
"p3"><span class=
"s2"><b>See also:
</b> <a href=
"Server-Architecture.html"><span class=
"s3">Server-Architecture
</span></a>,
<a href=
"Synth.html"><span class=
"s3">Synth
</span></a>,
<a href=
"Group.html"><span class=
"s3">Group
</span></a>,
<a href=
"RootNode.html"><span class=
"s3">RootNode
</span></a></span></p>
54 <p class=
"p2"><br></p>
55 <p class=
"p1">This class is the abstract super class of
<b>Synth
</b> and
<b>Group
</b>, which represent synth and group nodes on the server.
<span class=
"Apple-converted-space"> </span>Node objects are not made explicitly, but Synth and Group are subclasses, and inherit the methods
<span class=
"Apple-converted-space"> </span>documented below.
</p>
56 <p class=
"p2"><br></p>
57 <p class=
"p4"><b>Freed Nodes and Node Status
</b></p>
58 <p class=
"p2"><br></p>
59 <p class=
"p1">Nodes which you explicitly free using the methods free or release will have their group instance variable set to nil. However Nodes which are automatically freed after a certain time (for instance by an
<a href=
"../UGens/Synth control/Envelopes/EnvGen.html"><span class=
"s4">EnvGen
</span></a> with a doneAction of
2) will not. This keeps the implementation of the classes simple and lightweight. To have the current state of a Node tracked you can register it with an instance of
<a href=
"../Control/NodeWatcher.html"><span class=
"s4">NodeWatcher
</span></a><span class=
"s4">,
</span><span class=
"s2"> either by calling register on the Node instance or on the NodeWatcher singleton
</span>. This will enable two variables, isPlaying and isRunning, which you can use for checking purposes.
</p>
60 <p class=
"p2"><br></p>
61 <p class=
"p4"><b>Bundling
</b></p>
62 <p class=
"p2"><br></p>
63 <p class=
"p1">Many of the methods below have two versions: a regular one which sends its corresponding message to the server immediately, and one which returns the message in an Array so that it can be added to a bundle. It is also possible to capture the messages generated by the regular methods using Server's automated bundling capabilities. See
<a href=
"Server.html"><span class=
"s4">Server
</span></a> and
<a href=
"bundledCommands.html"><span class=
"s4">bundledCommands
</span></a> for more details.
</p>
64 <p class=
"p5"><br></p>
65 <p class=
"p4"><b>Accessing Class Variables
</b></p>
66 <p class=
"p5"><br></p>
67 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>*addActions
</b>- Returns the list of addActons as an event.
<span class=
"Apple-converted-space"> </span>Useful for
<span class=
"Apple-converted-space"> </span>converting
<span class=
"Apple-converted-space"> </span>addAction symbols to their corresponding integer codes.
</p>
68 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
69 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Node.addActions.at(\addToTail)
</p>
70 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
71 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// returns
1</p>
72 <p class=
"p5"><br></p>
73 <p class=
"p5"><br></p>
74 <p class=
"p4"><b>Accessing Instance Variables
</b></p>
75 <p class=
"p8"><br></p>
76 <p class=
"p1">The following getter methods also have corresponding setters, but they should be used with extreme care and only if you are
<i>sure
</i> you know what you're doing.
</p>
77 <p class=
"p8"><br></p>
78 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>nodeID
</b>- Returns the Node's node ID number. Normally you should not need to access this since instances of Node can be passed directly as UGen inputs or Synth args.
</p>
79 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
80 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>group
<span class=
"Apple-converted-space"> </span></b> - Returns an instance of
<b>Group
</b> or
<b>RootNode
</b> corresponding to this Node's group on the server.
</p>
81 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
82 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>server
</b> - Returns an instance of
<b>Server
</b> corresponding to this Node's server app.
</p>
83 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
84 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>isPlaying
</b>- Returns a boolean indicating if this node is currently on the server, providing this Node has been registered with a
<b>NodeWatcher
</b>.
<b>N.B.
</b>If this Node has not been registered this will likely be false in any case.
</p>
85 <p class=
"p9"><br></p>
86 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>isRunning
</b>- Returns a boolean indicating if this node is currently on the server, providing this Node has been registered with a
<b>NodeWatcher
</b>.
<b>N.B.
</b>If this Node has not been registered this will likely be false in any case.
</p>
87 <p class=
"p2"><br></p>
88 <p class=
"p5"><br></p>
89 <p class=
"p4"><b>Node Commands
</b></p>
90 <p class=
"p8"><br></p>
91 <p class=
"p1">See the Node Commands section in
<a href=
"Server-Command-Reference.html"><span class=
"s4">Server-Command-Reference
</span></a><b> </b>for the OSC equivalents of the methods outlined below
<b>.
</b></p>
92 <p class=
"p2"><br></p>
93 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>free(sendFlag)
<span class=
"Apple-converted-space"> </span></b></p>
94 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>freeMsg
</b><span class=
"Apple-converted-space"> </span></p>
95 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
96 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Stop this Node and free it from its parent group on the server.
<b> </b>Once a Node has been freed, you cannot restart it.
<b>sendFlag
</b> is a boolean indicating whether the free message should be sent. If false an
<b>n_free
</b> message will not be sent to this Node's server, but its isPlaying and isRunning variables will be set to false. The default for
<b>sendFlag
</b> is true. If this Node is a
<b>Group
</b> this will free all Nodes within the Group.
</p>
97 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
98 <p class=
"p7"><span class=
"s5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>s.boot;
</p>
99 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
<span class=
"s4">Synth
</span>(
<span class=
"s6">"default"</span>);
</p>
100 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free;
</p>
101 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
102 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>run(boolean)
</b></p>
103 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>runMsg(boolean)
</b></p>
104 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
105 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set the running state of this Node according to a boolean. False will pause the node without freeing it. The default is true. If this Node is a
<b>Group
</b> this will set the running state of all Nodes within the Group.
</p>
106 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
107 <p class=
"p7"><span class=
"s5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>s.boot;
</p>
108 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">(
</span></p>
109 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
<span class=
"s4">SynthDef
</span>(
<span class=
"s6">"help-node-set"</span>, {
<span class=
"s4">arg
</span> freq =
440, out =
0;
<span class=
"Apple-converted-space"> </span></p>
110 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Out
</span>.ar(out,
<span class=
"s4">SinOsc
</span>.ar(freq,
0,
0.1));}).play(s);
</p>
111 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
112 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.run(
<span class=
"s4">false
</span>);
</p>
113 <p class=
"p10"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.run;
</span>// default is true
</p>
114 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free;
</p>
115 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
116 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>set(controlName, value ... moreArgs)
</b></p>
117 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>setMsg(controlName, value ... moreArgs)
</b></p>
118 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
119 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set controls in this Node to values. Controls are defined in a
<b>SynthDef
</b>as args or instances of
<b>Control
</b>. They are specified here using symbols, strings, or indices, and are listed in pairs with values. If this Node is a
<b>Group
</b> this will set all Nodes within the Group.
</p>
120 <p class=
"p8"><br></p>
121 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>s.boot;
</p>
122 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
123 <p class=
"p11"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
</span>SynthDef
<span class=
"s2">(
</span><span class=
"s6">"help-node-set"</span><span class=
"s2">, {
</span>| freq =
440, out =
0 |
</p>
124 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Out
</span>.ar(out,
<span class=
"s4">SinOsc
</span>.ar(freq,
0,
0.1));
</p>
125 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
126 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x = x.play(s);
</p>
127 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
128 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.set(
<span class=
"s8">\freq
</span>,
880,
<span class=
"s8">\out
</span>,
1);
<span class=
"s9">// two pairs
</span></p>
129 <p class=
"p10"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.set(
0,
660,
1,
0);
</span>// freq is the first argument, so it's index is
0. out is index
1.
</p>
130 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free;
</p>
131 <p class=
"p8"><br></p>
132 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Values that are arrays are sent using the OSC array type-tags ($[ and $]).
<span class=
"Apple-converted-space"> </span>These values will be assigned to subsequent controls in the manner of setn.
</p>
133 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
134 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>s.boot;
</p>
135 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
136 <p class=
"p11"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
</span>SynthDef
<span class=
"s2">(
</span><span class=
"s6">"help-node-set"</span><span class=
"s2">, {
</span>| freq = #[
440,
450,
460], out =
0 |
</p>
137 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Out
</span>.ar(out,
<span class=
"s4">Mix
</span>(
<span class=
"s4">SinOsc
</span>.ar(freq,
0,
0.1)));
</p>
138 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
139 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x = x.play(s);
</p>
140 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
141 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.set(
<span class=
"s8">\freq
</span>, [
1,
2,
3] *
400 + [
1,
2,
3],
<span class=
"s8">\out
</span>,
1);
<span class=
"s9">// two pairs
</span></p>
142 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.set(
<span class=
"s8">\freq
</span>, [
3] *
400 + [
1,
2,
3],
<span class=
"s8">\out
</span>,
1);
<span class=
"s9">// two pairs
</span></p>
143 <p class=
"p10"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.set(
0, [
660,
680,
720],
1,
0);
</span>// freq is the first argument, so it's index is
0. out is index
1.
</p>
144 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free;
</p>
145 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
146 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
147 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>setn(controlName, values ... moreArgs)
</b></p>
148 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>setnMsg(controlName, values ... moreArgs)
</b></p>
149 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
150 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span>Set sequential ranges of controls in this Node to values. Controls are defined in a
<b>SynthDef
</b>as args or instances of
<b>Control
</b>. They are specified here using symbols, strings, or indices, and are listed in pairs with arrays of values. If this Node is a
<b>Group
</b> this will setn all Nodes within the Group.
</p>
151 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
152 <p class=
"p7"><span class=
"s5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>s.boot;
</p>
153 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
154 <p class=
"p12"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
</span><span class=
"s4">SynthDef
</span><span class=
"s2">(
</span>"help-node-setn"<span class=
"s2">, {
</span></p>
155 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">arg
</span> freq1 =
440, freq2 =
440, freq3 =
440, amp1 =
0.05, amp2 =
0.05, amp3 =
0.05;
<span class=
"Apple-converted-space"> </span></p>
156 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Out
</span>.ar(
0,
<span class=
"s4">Mix
</span>(
<span class=
"s4">SinOsc
</span>.ar([freq1, freq2, freq3],
0, [amp1, amp2, amp3])));}).play(s);
</p>
157 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
158 <p class=
"p10"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set
3 controls starting from \freq1, and
3 controls starting from \amp1
</p>
159 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.setn(
<span class=
"s8">\freq1
</span>, [
440,
880,
441],
<span class=
"s8">\amp1
</span>, [
0.3,
0.1,
0.3]);
</p>
160 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free;
</p>
161 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
162 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>fill(controlName, numControls, value ... moreArgs)
</b></p>
163 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>fillMsg(controlName, numControls, value ... moreArgs)
</b></p>
164 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
165 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set sequential ranges of controls in this Node to a single value. Controls are defined in a
<b>SynthDef
</b>as args or instances of
<b>Control
</b>. They are specified here using symbols, strings, or indices, and are listed in groups of three along with an integer indicating the number of controls to set, and the value to set them to. If this Node is a
<b>Group
</b> this will fill all Nodes within the Group.
</p>
166 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
167 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>map(controlName, bus ... moreArgs)
</b></p>
168 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>mapMsg(controlName, bus ... moreArgs)
</b></p>
169 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
170 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Map controls in this Node to read from control or audio rate Buses. Controls are defined in a
<b>SynthDef
</b>as args or instances of
<b>Control
</b>or its subclasses. They are specified here using symbols, strings, or indices, and are listed in pairs with Bus objects. The number of sequential controls mapped corresponds to the Bus' number of channels. If this Node is a
<b>Group
</b> this will map all Nodes within the Group. Note that with
<b>mapMsg
</b> if you mix audio and control rate busses you will get an Array of two messages rather than a single message. Integer bus indices are assumed to refer to control buses. To map a control to an audio bus, you must use a Bus object.
</p>
171 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
172 <p class=
"p7"><span class=
"s5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>s.boot;
</p>
173 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
174 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b =
<span class=
"s4">Bus
</span>.control(s,
1); b.set(
880);
</p>
175 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c =
<span class=
"s4">Bus
</span>.control(s,
1);
<span class=
"Apple-tab-span"> </span>c.set(
884);
</p>
176 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
<span class=
"s4">SynthDef
</span>(
<span class=
"s6">"help-Node-map"</span>, {
<span class=
"s4">arg
</span> freq1 =
440, freq2 =
440;
<span class=
"Apple-converted-space"> </span></p>
177 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Out
</span>.ar(
0,
<span class=
"s4">SinOsc
</span>.ar([freq1, freq2],
0,
0.1));
</p>
178 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}).play(s);)
</p>
179 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.map(
<span class=
"s8">\freq1
</span>, b,
<span class=
"s8">\freq2
</span>, c);
</p>
180 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free; b.free; c.free;
</p>
181 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
182 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// same as above with a multichannel Bus and Control
</p>
183 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
184 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b =
<span class=
"s4">Bus
</span>.control(s,
2); b.set(
880,
884);
</p>
185 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
<span class=
"s4">SynthDef
</span>(
<span class=
"s6">"help-Node-map2"</span>, {
<span class=
"s4">arg
</span> freqs = #[
440,
440];
<span class=
"Apple-converted-space"> </span></p>
186 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Out
</span>.ar(
0,
<span class=
"s4">SinOsc
</span>.ar(freqs,
0,
0.1));
</p>
187 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}).play(s);)
</p>
188 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.map(
<span class=
"s8">\freqs
</span>, b);
</p>
189 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free; b.free;
</p>
190 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
191 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>mapn(controlName, index, numControls ... moreArgs)
</b></p>
192 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>mapnMsg(controlName, index, numControls ... moreArgs)
</b></p>
193 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
194 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Map sequential ranges of controls in this Node to read from control rate Buses. This is similar to map above, but you specify the number of sequential Controls to map. If this Node is a
<b>Group
</b> this will mapn all Nodes within the Group.
</p>
195 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
196 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>release(releaseTime)
</b></p>
197 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>releaseMsg(releaseTime)
</b></p>
198 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
199 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s10"><b><span class=
"Apple-tab-span"> </span></b></span>This is a convenience method which assumes that the synth contains an envelope generator (an
<b>EnvGen
</b>,
<b>Linen
</b>, or similar
<b>UGen
</b>) running a sustaining envelope (see
<b>Env
</b>) and that it's gate argument is set to a control called
<span class=
"s11">\gate
</span>. This method will cause the envelope to release. If
<b>releaseTime
</b>is not nil, it will override the envelope's decay or release time. If this Node is a
<b>Group
</b> this will release all Nodes within the Group.
</p>
200 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
201 <p class=
"p7"><span class=
"s5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>x = {
<span class=
"s4">arg
</span> gate=
1;
<span class=
"s4">BrownNoise
</span>.ar(
0.5) *
<span class=
"s4">EnvGen
</span>.kr(
<span class=
"s4">Env
</span>.cutoff(
1), gate, doneAction:
2) }.play;
</p>
202 <p class=
"p16"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.release(
5);
</span>// overide the Env's specified
1 second release time
</p>
203 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
204 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>query
</b></p>
205 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
206 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Sends an
<b>n_query
</b> message to the server, which will reply with a message containing information about this node and its place in the server's node tree. This information will be printed to the post window. (See also the queryAllNodes method of
<b>Server
</b>.)
"parent" indicates the Node's enclosing group. If
"prev" or
"next" are equal to -
1 that indicates that there are no other nodes in the enclosing group before or after this one, respectively.
</p>
207 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
208 <p class=
"p7"><span class=
"s5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>g =
<span class=
"s4">Group
</span>.new;
</p>
209 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
<span class=
"s4">Synth
</span>.head(g,
<span class=
"s6">"default"</span>);
</p>
210 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.query;
</p>
211 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.query;
</p>
212 <p class=
"p10"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>s.queryAllNodes;
</span>// Note the RootNode (ID
0) and the default Group (ID
1)
</p>
213 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free; g.free;
</p>
214 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
215 <p class=
"p6"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>trace
</b></p>
216 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
217 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Causes a synth to print out the values of the inputs and outputs of its unit generators for one control period to the post window. Causes a group to print the node IDs and names of each node in the group for one control period.
</p>
218 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
219 <p class=
"p7"><span class=
"s5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>g =
<span class=
"s4">Group
</span>.new;
</p>
220 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x =
<span class=
"s4">Synth
</span>.head(g,
<span class=
"s6">"default"</span>);
</p>
221 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.trace;
</p>
222 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.trace;
</p>
223 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x.free; g.free;
</p>
224 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
225 <p class=
"p6"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>register(assumePlaying)
</b></p>
226 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
227 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Registers the node at the
<a href=
"../Control/NodeWatcher.html"><span class=
"s12">NodeWatcher
</span></a><span class=
"s12"> </span>object. This will enable two variables, isPlaying and isRunning, which you can use for checking purposes.
<span class=
"Apple-converted-space"> </span></p>
228 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
229 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
<span class=
"Apple-tab-span"> </span></p>
230 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b = s.makeBundle(
<span class=
"s13">false
</span>, {
</p>
231 <p class=
"p18"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a =
</span><span class=
"s13">Group
</span><span class=
"s2">.new(s);
</span>//create a node object
</p>
232 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.register;
</span>// register before creating on the server
</p>
233 <p class=
"p19"><span class=
"s14"><span class=
"Apple-tab-span"> </span></span><span class=
"Apple-tab-span"> </span>});
</p>
234 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
235 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.isPlaying;
</p>
236 <p class=
"p18"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>s.listSendBundle(nil, b);
</span>//start the node on the server
</p>
237 <p class=
"p19"><span class=
"s14"><span class=
"Apple-tab-span"> </span></span><span class=
"Apple-tab-span"> </span>a.isPlaying;
</p>
238 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.isRunning;
</p>
239 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.run(
<span class=
"s13">false
</span>);
</p>
240 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.isRunning;
</p>
241 <p class=
"p18"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>s.freeAll;
</span>//free all nodes
</p>
242 <p class=
"p19"><span class=
"s14"><span class=
"Apple-tab-span"> </span></span><span class=
"Apple-tab-span"> </span>a.isPlaying;
</p>
243 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.isRunning;
</p>
244 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
245 <p class=
"p20"><b>Changing the order of execution
</b></p>
246 <p class=
"p8"><br></p>
247 <p class=
"p1">The following methods can be used to change the Node's place in the order of execution. See the
<b>Order-of-execution
</b> help file for more information on this important topic. See
<b>Server-Command-Reference
</b> for the OSC equivalents of these methods.
</p>
248 <p class=
"p8"><br></p>
249 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>moveAfter(aNode)
</b></p>
250 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>moveAfterMsg(aNode)
</b></p>
251 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
252 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Move this Node to be directly after aNode.
<b>N.B. n_after
</b>, the OSC message which this method encapsulates, allows already freed nodes as targets. This is so that one may attempt a series of moves, with the last successful one taking effect. For this reason this method will fail silently if either the target or this node have already been freed. If you will need to check, you may register the relevant nodes with a
<b>NodeWatcher
</b>.
</p>
253 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
254 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>moveBefore(aNode)
</b></p>
255 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>moveBeforeMsg(aNode)
</b></p>
256 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
257 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Move this Node to be directly before aNode.
<b>N.B. n_before
</b>, the OSC message which this method encapsulates, allows already freed nodes as targets. This is so that one may attempt a series of moves, with the last successful one taking effect. For this reason this method will fail silently if either the target or this node have already been freed. If you will need to check, you may register the relevant nodes with a
<b>NodeWatcher
</b>.
</p>
258 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
259 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>moveToHead(aGroup)
</b></p>
260 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>moveToHeadMsg(aGroup)
</b></p>
261 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
262 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>If
<b>aGroup
</b> is a
<b>Group
</b> then this method will move this Node to the head of that Group. If it is nil this will move this Node to the head of the
<b>default_group
</b> of this Node's
<b>Server
</b>.
</p>
263 <p class=
"p8"><br></p>
264 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>moveToTail(aGroup)
</b></p>
265 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>moveToTailMsg(aGroup)
</b></p>
266 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
267 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>If
<b>aGroup
</b> is a
<b>Group
</b> then this method will move this Node to the tail of that Group. If it is nil this will move this Node to the tail of the
<b>default_group
</b> of this Node's
<b>Server
</b>.
</p>
268 <p class=
"p8"><br></p>
269 <p class=
"p20"><b>Other Methods
</b></p>
270 <p class=
"p8"><br></p>
271 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>asTarget
</b> - Returns this Node. See the
<b>asTarget
</b> help file for more details.
</p>
272 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
273 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>printOn(stream)
</b> - Prints this Node's Class (Synth or Group) and nodeID on
<b>stream
</b>.
</p>
274 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
275 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>hash
</b> - Returns server.hash bitXor: nodeID.hash
</p>
276 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
277 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>== aNode
</b>- Returns true if this Node and aNode have the same nodeID and the same Server object, otherwise returns false. Under certain circumstances this Node and aNode might not be the same object, even though this returns true.
</p>
278 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
279 <p class=
"p10"><span class=
"s15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">g =
</span><span class=
"s4">Group
</span><span class=
"s2">.basicNew(s,
1);
</span>// the default group of s
</p>
280 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>h =
<span class=
"s4">Group
</span>.basicNew(s,
1);
<span class=
"s9">// and again
</span></p>
281 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g == h;
<span class=
"Apple-tab-span"> </span><span class=
"s9">// true
</span></p>
282 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g === h;
<span class=
"Apple-tab-span"> </span><span class=
"s9">// false
</span></p>
283 <p class=
"p17"><br></p>