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.29">
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: 9.0px Monaco
; min-height: 12.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: 12.0px Helvetica
; min-height: 14.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; min-height: 12.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: 12.0px Helvetica
; min-height: 14.0px}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
; min-height: 17.0px}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #cd1612}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
21 span
.s1
{font: 17.0px Helvetica
}
22 span
.s2
{color: #000000}
23 span
.s3
{text-decoration: underline
}
24 span
.s4
{color: #0000bf}
25 span
.s5
{color: #1135f9}
26 span
.s6
{color: #0b28c6}
27 span
.s7
{color: #cd1612}
28 span
.Apple-tab-span
{white-space:pre
}
32 <p class=
"p1"><span class=
"s1"><b>BusPlug
<span class=
"Apple-tab-span"> </span></b></span><b><span class=
"Apple-tab-span"> </span>a listener on a bus
</b></p>
33 <p class=
"p2"><br></p>
34 <p class=
"p3"><span class=
"s2"><b>Inherits from:
<span class=
"Apple-converted-space"> </span></b><a href=
"../../../Core/Object.html"><span class=
"s3">Object
</span></a> :
<a href=
"../../../Core/Kernel/AbstractFunction.html"><span class=
"s3">AbstractFunction
</span></a></span></p>
35 <p class=
"p4"><br></p>
36 <p class=
"p4"><br></p>
37 <p class=
"p1">BusPlug is mainly in use as a basic superclass of NodeProxy, but it can be applied for other things
<span class=
"Apple-converted-space"> </span>as well.
</p>
38 <p class=
"p1">Most methods are documented in the
<a href=
"NodeProxy.html"><span class=
"s4">NodeProxy
</span></a> helpfile.
</p>
39 <p class=
"p4"><br></p>
40 <p class=
"p1">See also:
<a href=
"../../../ServerArchitecture/Bus.html"><span class=
"s5">Bus
</span></a></p>
41 <p class=
"p2"><br></p>
42 <p class=
"p5"><br></p>
43 <p class=
"p6"><b>*new(server)
</b><span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span></span></p>
44 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Create a new (neutral) instance on the given server
</p>
45 <p class=
"p7"><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>
46 <p class=
"p6"><b>*audio(server, numChannels)
</b><span class=
"Apple-converted-space"> </span></p>
47 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Create a new audio rate instance on the given server
</p>
48 <p class=
"p7"><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>
49 <p class=
"p6"><b>*control(server, numChannels)
</b><span class=
"Apple-converted-space"> </span></p>
50 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Create a new audio rate instance on the given server
</p>
51 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
52 <p class=
"p6"><b>clear
</b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
53 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Free the bus, end the monitor
</p>
54 <p class=
"p7"><br></p>
55 <p class=
"p6"><b>ar(numChannels)
</b></p>
56 <p class=
"p6"><b>kr(numChannels)
</b></p>
57 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
58 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Return a link to my output, which is limited by
<b>numChannels
</b>. If uninitialized, creates a matching bus. Normally,
<b> ar defaults to stereo, kr to mono
</b>.
<span class=
"Apple-converted-space"> </span></p>
59 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>This can be set in the classvars:
<b>defaultNumAudio, defaultNumControl
</b></p>
60 <p class=
"p4"><br></p>
61 <p class=
"p6"><b>play(out, numChannels, target, multi, vol, fadeTime, addAction)
</b></p>
62 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Plays from a bus index (
<b>out
</b>) with a number of channels to another index with a number of channels, within a
<b>target
</b> (a group, or a server).
</p>
63 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>multi
</b>: keep old links and add new one
</p>
64 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>volume
</b>: volume at which to monitor
</p>
65 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>fadeTime
</b>: fade in fade out time
</p>
66 <p class=
"p7"><br></p>
67 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
68 <p class=
"p6"><b>playN(outs, amps, ins, vol, fadeTime, group, addAction)
</b></p>
69 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>outs
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>array of destination channels
</p>
70 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>amps
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>array of
<span class=
"Apple-converted-space"> </span>amplitudes for each channel
</p>
71 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>outs
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>array of source channels
</p>
72 <p class=
"p5"><br></p>
73 <p class=
"p6"><b>monitor
</b></p>
74 <p class=
"p6"><span class=
"Apple-tab-span"> </span>returns the current monitor (see
<a href=
"Monitor.html"><span class=
"s4">Monitor
</span></a>)
</p>
75 <p class=
"p5"><br></p>
76 <p class=
"p5"><br></p>
77 <p class=
"p5"><br></p>
78 <p class=
"p8"><b>Example
</b></p>
79 <p class=
"p9"><br></p>
80 <p class=
"p2"><br></p>
81 <p class=
"p10">// using as a control bus listener
</p>
82 <p class=
"p2"><br></p>
83 <p class=
"p11">s.boot;
</p>
84 <p class=
"p11">z =
<span class=
"s6">Bus
</span>.control(s,
16);
</p>
85 <p class=
"p11">a =
<span class=
"s6">BusPlug
</span>.for(z);
</p>
86 <p class=
"p2"><br></p>
87 <p class=
"p11">m = {
<span class=
"s6">Mix
</span>(
<span class=
"s6">SinOsc
</span>.ar(a.kr(
16),
0,
0.1)) }.play;
</p>
88 <p class=
"p2"><br></p>
89 <p class=
"p11">z.setn(
<span class=
"s6">Array
</span>.rand(
16,
300,
320).put(
16.rand, rrand(
500,
1000)));
</p>
90 <p class=
"p11">z.setn(
<span class=
"s6">Array
</span>.rand(
16,
300,
320).put(
16.rand, rrand(
500,
1000)));
</p>
91 <p class=
"p11">z.setn(
<span class=
"s6">Array
</span>.rand(
16,
300,
320).put(
16.rand, rrand(
500,
1000)));
</p>
92 <p class=
"p2"><br></p>
93 <p class=
"p11">m.free;
</p>
94 <p class=
"p2"><br></p>
95 <p class=
"p2"><br></p>
96 <p class=
"p11">m = {
<span class=
"s6">SinOsc
</span>.ar(a.kr(
2,
<span class=
"s6">MouseX
</span>.kr(
0,
19)),
0,
0.1) }.play;
<span class=
"s7">// modulate channel offset
</span></p>
97 <p class=
"p2"><br></p>
98 <p class=
"p11">z.setn(
<span class=
"s6">Array
</span>.rand(
16,
300,
1320).put(
16.rand, rrand(
500,
1000)));
</p>
99 <p class=
"p2"><br></p>
100 <p class=
"p2"><br></p>
101 <p class=
"p11">m.free; z.free;
</p>
102 <p class=
"p2"><br></p>
103 <p class=
"p10">// using as a audio monitor
</p>
104 <p class=
"p2"><br></p>
105 <p class=
"p11">p =
<span class=
"s6">BusPlug
</span>.audio(s,
2);
</p>
106 <p class=
"p11">d = {
<span class=
"s6">Out
</span>.ar(p.index,
<span class=
"s6">PinkNoise
</span>.ar([
0.1,
0.1])) }.play;
</p>
107 <p class=
"p2"><br></p>
108 <p class=
"p2"><br></p>
109 <p class=
"p10"><span class=
"s2">p.play;
</span>// monitor whatever plays in p (the execution order does not matter)
</p>
110 <p class=
"p2"><br></p>
111 <p class=
"p2"><br></p>
112 <p class=
"p2"><br></p>
113 <p class=
"p11">d.free;
</p>
114 <p class=
"p11">d = {
<span class=
"s6">Out
</span>.ar(p.index,
<span class=
"s6">PinkNoise
</span>.ar([
0.1,
0.1])) }.play;
</p>
115 <p class=
"p2"><br></p>
116 <p class=
"p11">p.stop;
</p>
117 <p class=
"p11">p.play;
</p>
118 <p class=
"p2"><br></p>
119 <p class=
"p10">// also p can play to another bus:
</p>
120 <p class=
"p2"><br></p>
121 <p class=
"p11">p.stop;
</p>
122 <p class=
"p11">p.play(
12);
</p>
123 <p class=
"p2"><br></p>
124 <p class=
"p10">// listen to that bus for a test:
</p>
125 <p class=
"p11">x = {
<span class=
"s6">InFeedback
</span>.ar(
12,
2) }.play;
</p>
126 <p class=
"p11">x.free;
</p>
127 <p class=
"p2"><br></p>
128 <p class=
"p2"><br></p>
129 <p class=
"p2"><br></p>