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=
"949.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #001bec}
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 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; min-height: 12.0px}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
}
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 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica
}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
; min-height: 14.0px}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #615f4a}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #ae1a19}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #ae1a19}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
27 span
.s1
{font: 18.0px Helvetica
}
28 span
.s2
{color: #000000}
29 span
.s3
{text-decoration: underline
}
30 span
.s4
{text-decoration: underline
; color: #1940ce}
31 span
.s5
{color: #2f4fcf}
32 span
.s6
{color: #6f7178}
33 span
.s7
{color: #4c5fb5}
34 span
.s8
{color: #5a66a4}
35 span
.s9
{font: 14.0px Helvetica
}
36 span
.s10
{color: #0016bd}
37 span
.s11
{color: #ae1a19}
38 span
.s12
{color: #606060}
39 span
.s13
{color: #2b7000}
40 span
.Apple-tab-span
{white-space:pre
}
44 <p class=
"p1"><span class=
"s1"><b>SCScope
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>oscilliscope: render a buffer to a view in real time
</b><span class=
"s1"><b><span class=
"Apple-tab-span"> </span></b></span></p>
45 <p class=
"p2"><br></p>
46 <p class=
"p1"><b>Inherits from: Object : SCView
</b></p>
47 <p class=
"p3"><br></p>
48 <p class=
"p1">An oscilloscope-type view.
</p>
49 <p class=
"p2"><br></p>
50 <p class=
"p4"><span class=
"s2"><b>See also:
</b> <a href=
"SCStethoscope.html"><span class=
"s3">SCStethoscope
</span></a>,
<a href=
"SCFreqScope.html"><span class=
"s4">SCFreqScope
</span></a>,
<a href=
"SCFreqScopeWindow.html"><span class=
"s3">SCFreqScopeWindow
</span></a></span></p>
51 <p class=
"p2"><br></p>
52 <p class=
"p5"><b>Some Important Issues Regarding SCScope
</b></p>
53 <p class=
"p2"><br></p>
54 <p class=
"p1">SCScope can only work with the internal
<a href=
"../../ServerArchitecture/Server.html"><span class=
"s5">Server
</span></a>.
</p>
55 <p class=
"p2"><br></p>
56 <p class=
"p5"><b>Creation / Class Methods
</b></p>
57 <p class=
"p6"><br></p>
58 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>*new (parent, bounds)
</b></p>
59 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
60 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>parent
</b>- The parent view.
</p>
61 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>bounds
</b>- An instance of
<a href=
"../../Geometry/Rect.html"><span class=
"s6">Rect
</span></a>, or a
<a href=
"../../Geometry/Point.html"><span class=
"s6">Point
</span></a> indicating width@height.
</p>
62 <p class=
"p6"><br></p>
63 <p class=
"p10"><b>Accessing Instance and Class Variables
</b></p>
64 <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><span class=
"Apple-tab-span"> </span></p>
65 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>bufnum
</b></p>
66 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>bufnum_ (num)
</b></p>
67 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
68 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>num
</b>- An integer.The
<b>bufnum
</b> of the scope's
<a href=
"../../ServerArchitecture/Buffer.html"><span class=
"s7">Buffer
</span></a>.
</p>
69 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
70 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>style_ (val)
</b></p>
71 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
72 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>The display style of the scope.
</p>
73 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>val
</b>- an integer.
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
74 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0 = vertically spaced
</p>
75 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1 = overlapped
</p>
76 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2 = x/y
</p>
77 <p class=
"p8"><br></p>
78 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>xZoom
</b></p>
79 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>xZoom_ (val)
</b></p>
80 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
81 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>The x- scaling of the scope.
</p>
82 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>val
</b>- An instance of
<a href=
"../../Math/Float.html"><span class=
"s8">Float
</span></a>. Must be in steps of
2**(
1/n ), where n is a positive integer
</p>
83 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
84 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>yZoom
</b></p>
85 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>yZoom_ (val)
</b></p>
86 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
87 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>The y- scaling of the scope. Must be in steps of
2**(
1/n ), where n is a positive integer
</p>
88 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>val
</b>- An instance of
<a href=
"../../Math/Float.html"><span class=
"s8">Float
</span></a>.
</p>
89 <p class=
"p7"><span class=
"Apple-tab-span"> </span><b>x
</b></p>
90 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>x_ (val)
</b></p>
91 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
92 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>The x offset of the scope in samples.
</p>
93 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>val
</b>- An Integer.
</p>
94 <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>
95 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>waveColors
</b></p>
96 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>waveColors_ (arrayOfColors)
</b></p>
97 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
98 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arrayOfColors
</b>- An
<a href=
"../../Collections/Array.html"><span class=
"s8">Array
</span></a> of
<a href=
"../GUI-Tools/Color.html"><span class=
"s8">Color
</span></a>s. [ color1, color2, color2, ...], corresponding to the number of channels.
</p>
99 <p class=
"p6"><br></p>
100 <p class=
"p10"><b>Subclassing and Internal Methods
</b></p>
101 <p class=
"p7"><span class=
"s9"><span class=
"Apple-tab-span"> </span></span>The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.
</p>
102 <p class=
"p8"><br></p>
103 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>properties
</b></p>
104 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
105 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>returns;
</p>
106 <p class=
"p13"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
</span>\bounds
<span class=
"s2">,
</span>\visible
<span class=
"s2">,
</span>\enabled
<span class=
"s2">,
</span>\canFocus
<span class=
"s2">,
</span>\resize
<span class=
"s2">,
</span>\background
<span class=
"s2">,
</span>\minWidth
<span class=
"s2">,
</span>\maxWidth
<span class=
"s2">,
</span>\minHeight
<span class=
"s2">,
</span>\maxHeight
<span class=
"s2">,
</span>\bufnum
<span class=
"s2">,
</span>\x
<span class=
"s2">,
</span>\y
<span class=
"s2">,
</span>\xZoom
<span class=
"s2">,
</span>\yZoom
<span class=
"s2">,
</span>\gridColor
<span class=
"s2">,
</span>\waveColors
<span class=
"s2">,
</span>\style
<span class=
"s2">]
</span></p>
107 <p class=
"p6"><br></p>
108 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>gridColor
</b></p>
109 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>gridColor_ (color)
</b></p>
110 <p class=
"p8"><b><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></p>
111 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>y
</b></p>
112 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>y_ (val)
</b></p>
113 <p class=
"p6"><br></p>
114 <p class=
"p10"><b>Examples
</b></p>
115 <p class=
"p3"><br></p>
116 <p class=
"p14">// execute these in succession
</p>
117 <p class=
"p14">// the cross platform syntax for SCScope is ScopeView
</p>
119 <p class=
"p15">s =
<span class=
"s10">Server
</span>.internal;
</p>
120 <p class=
"p15">s.boot;
</p>
123 <p class=
"p15">f =
<span class=
"s10">Buffer
</span>.alloc(s,
1024,
2);
</p>
124 <p class=
"p12">b =
<span class=
"s10">Bus
</span>.audio(s,
1);
</p>
125 <p class=
"p6"><br></p>
126 <p class=
"p12">w=
<span class=
"s10">Window
</span>.new.front;
</p>
127 <p class=
"p12">c =
<span class=
"s10">ScopeView
</span>(w.view,w.view.bounds.insetAll(
10,
10,
10,
10));
<span class=
"Apple-converted-space">Â
</span><span class=
"s11">// this is SCScope
</span></p>
128 <p class=
"p12">c.bufnum = f.bufnum;
</p>
131 <p class=
"p16">// listening to the bus, using ScopeOut to write it to the buffer
</p>
132 <p class=
"p12">a=
<span class=
"s10">SynthDef
</span>(
<span class=
"s12">"monoscope"</span>, {
<span class=
"s10">arg
</span> bus, bufnum;
</p>
133 <p class=
"p15"><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=
"s10">var
</span> z;
</p>
134 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>z =
<span class=
"s10">In
</span>.ar(bus,
2);
</p>
135 <p class=
"p14"><span class=
"s2"><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>// ScopeOut writes the audio to the buffer
</p>
136 <p class=
"p15"><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=
"s10">ScopeOut
</span>.ar(z, bufnum);
</p>
137 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}).play(
</p>
138 <p class=
"p15"><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=
"s10">RootNode
</span>(s),
</p>
139 <p class=
"p15"><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=
"s13">\bus
</span>,b.index,
<span class=
"s13">\bufnum
</span>, f.bufnum] ,
</p>
140 <p class=
"p14"><span class=
"s2"><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><span class=
"s13">\addToTail
</span><span class=
"s2"> </span>// make sure it goes after what you are scoping
</p>
141 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
142 <p class=
"p6"><br></p>
143 <p class=
"p16">// making noise onto the buffer
</p>
144 <p class=
"p15">d=
<span class=
"s10">SynthDef
</span>(
<span class=
"s12">"noise"</span>, {
<span class=
"s10">arg
</span> bus;
</p>
145 <p class=
"p15"><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=
"s10">var
</span> z;
</p>
146 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>z =
<span class=
"s10">LFSaw
</span>.ar(
<span class=
"s10">SinOsc
</span>.kr(
0.1).range(
300,
1000),[
0,
1]*pi) *
0.1;
</p>
147 <p class=
"p15"><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=
"s10">Out
</span>.ar(bus, z);
</p>
148 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}).play(
</p>
149 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>s,
</p>
150 <p class=
"p15"><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=
"s13">\bus
</span>,b.index]
</p>
151 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
153 <p class=
"p6"><br></p>
154 <p class=
"p16"><span class=
"s2">c.style =
0 </span>// vertically spaced
</p>
155 <p class=
"p16"><span class=
"s2">c.style =
1 </span>// overlapped
</p>
156 <p class=
"p12">c.style =
2 <span class=
"s11">// x/y
</span></p>
157 <p class=
"p6"><br></p>
158 <p class=
"p12">(
<span class=
"Apple-converted-space">Â
</span></p>
159 <p class=
"p16">//remember to free your stuff when finished
</p>
160 <p class=
"p12">a.free;
</p>
161 <p class=
"p12">d.free;
</p>
162 <p class=
"p12">f.free;
</p>
163 <p class=
"p12">b.free;
</p>
164 <p class=
"p12">w.close;
</p>
166 <p class=
"p6"><br></p>
167 <p class=
"p6"><br></p>
168 <p class=
"p16">/***** Interactive Example with Sound (explains all the options) *****/
</p>
169 <p class=
"p6"><br></p>
171 <p class=
"p3"><br></p>
172 <p class=
"p15">s =
<span class=
"s10">Server
</span>.internal;
</p>
173 <p class=
"p15">s.waitForBoot({
<span class=
"Apple-tab-span"> </span></p>
174 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
175 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"s10">var
</span> func, sdef1, sdef2, syn1, syn2,startButton ;
</p>
176 <p class=
"p15"><span class=
"Apple-tab-span"> </span>f =
<span class=
"s10">Buffer
</span>.alloc(s,
1024,
2);
</p>
177 <p class=
"p15"><span class=
"Apple-tab-span"> </span>b =
<span class=
"s10">Bus
</span>.audio(s,
1);
</p>
178 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
179 <p class=
"p15"><span class=
"Apple-tab-span"> </span>w=
<span class=
"s10">Window
</span>(
<span class=
"s12">"Scope"</span>,
<span class=
"s10">Rect
</span>(
150,
<span class=
"s10">SCWindow
</span>.screenBounds.height-
500,
790,
400)).front;
</p>
180 <p class=
"p15"><span class=
"Apple-tab-span"> </span>c =
<span class=
"s10">ScopeView
</span>(w,
<span class=
"s10">Rect
</span>(
10,
10,
380,
380));
<span class=
"s11">// this is SCScope
</span></p>
181 <p class=
"p15"><span class=
"Apple-tab-span"> </span>c.bufnum = f.bufnum;
</p>
182 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
183 <p class=
"p15"><span class=
"Apple-tab-span"> </span>v=
<span class=
"s10">CompositeView
</span>(w,
<span class=
"s10">Rect
</span>(
400,
10,
380,
380)).background_(
<span class=
"s10">Color
</span>.rand(
0.7));
</p>
184 <p class=
"p15"><span class=
"Apple-tab-span"> </span>v.decorator = n =
<span class=
"s10">FlowLayout
</span>(v.bounds, margin:
0@
0, gap:
5@
5);
</p>
185 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
186 <p class=
"p15"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s10">StaticText
</span>(v,
<span class=
"s10">Rect
</span>(
20,
70,
90,
20)).string_(
<span class=
"s12">" xZoom = 1"</span>).background_(
<span class=
"s10">Color
</span>.rand);
</p>
187 <p class=
"p15"><span class=
"Apple-tab-span"> </span>m =
<span class=
"s10">Slider
</span>(v,
<span class=
"s10">Rect
</span>(
20,
60,
285,
20)).background_(a.background).action_({func.value}).value_(
0.5);
</p>
188 <p class=
"p15"><span class=
"Apple-tab-span"> </span>d =
<span class=
"s10">StaticText
</span>(v,
<span class=
"s10">Rect
</span>(
20,
70,
90,
20)).string_(
<span class=
"s12">" yZoom = 1"</span>).background_(
<span class=
"s10">Color
</span>.rand);
</p>
189 <p class=
"p15"><span class=
"Apple-tab-span"> </span>g =
<span class=
"s10">Slider
</span>(v,
<span class=
"s10">Rect
</span>(
20,
60,
285,
20)).background_(d.background).action_({func.value}).value_(
0.5);
</p>
190 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
191 <p class=
"p15"><span class=
"Apple-tab-span"> </span>h =
<span class=
"s10">StaticText
</span>(v,
<span class=
"s10">Rect
</span>(
20,
70,
90,
20)).string_(
<span class=
"s12">" x = 0"</span>).background_(
<span class=
"s10">Color
</span>.rand);
</p>
192 <p class=
"p15"><span class=
"Apple-tab-span"> </span>i =
<span class=
"s10">Slider
</span>(v,
<span class=
"s10">Rect
</span>(
20,
60,
285,
20)).background_(h.background).action_({func.value}).value_(
0.5);
</p>
193 <p class=
"p3"><br></p>
194 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"s10">Button
</span>(v,
<span class=
"s10">Rect
</span>(
0,
0,
380,
20))
</p>
195 <p class=
"p17"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.states_([[
</span>"waveColors = [ Color.rand, ... ]"<span class=
"s2">,
</span><span class=
"s10">Color
</span><span class=
"s2">.black,
</span><span class=
"s10">Color
</span><span class=
"s2">.rand]])
</span></p>
196 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_({c.waveColors = [
<span class=
"s10">Color
</span>.rand,
<span class=
"s10">Color
</span>.rand]});
</p>
197 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
198 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"s10">Button
</span>(v,
<span class=
"s10">Rect
</span>(
0,
0,
380,
20))
</p>
199 <p class=
"p17"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.states_([[
</span>" background = Color.rand(0.1,0.3) "<span class=
"s2">,
</span><span class=
"s10">Color
</span><span class=
"s2">.black,
</span><span class=
"s10">Color
</span><span class=
"s2">.rand]])
</span></p>
200 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_({c.background =
<span class=
"s10">Color
</span>.rand(
0.1,
0.3) });
</p>
201 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
202 <p class=
"p15"><span class=
"Apple-tab-span"> </span>t=
<span class=
"s10">Button
</span>(v,
<span class=
"s10">Rect
</span>(
0,
0,
380,
20))
</p>
203 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.states_([[
<span class=
"s12">"Current style is 0"</span>,
<span class=
"s10">Color
</span>.black,
<span class=
"s10">Color
</span>.rand],
</p>
204 <p class=
"p17"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
</span>"Current style is 1"<span class=
"s2">,
</span><span class=
"s10">Color
</span><span class=
"s2">.black,
</span><span class=
"s10">Color
</span><span class=
"s2">.rand],
</span></p>
205 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
<span class=
"s12">"Current style is 2"</span>,
<span class=
"s10">Color
</span>.black,
<span class=
"s10">Color
</span>.rand]])
</p>
206 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_({func.value});
</p>
207 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
208 <p class=
"p15"><span class=
"Apple-tab-span"> </span>func={
</p>
209 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c.xZoom = ([
0.25,
10,
<span class=
"s13">\exp
</span>,
1/
8,
1].asSpec.map(m.value)); a.string =
<span class=
"s12">" xZoom = %"</span>.format(c.xZoom);
</p>
210 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c.yZoom = ([
0.25,
10,
<span class=
"s13">\exp
</span>,
1/
8,
1].asSpec.map(g.value)); d.string =
<span class=
"s12">" yZoom = %"</span>.format(c.yZoom);
</p>
211 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c.x = ([ -
1024,
1024,
<span class=
"s13">\linear
</span>,
1/
8,
1].asSpec.map(i.value)); h.string =
<span class=
"s12">" x = %"</span>.format(c.x);
</p>
212 <p class=
"p14">//
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c.y = ([-
1,
1, \linear,
1/
16,
1].asSpec.map(k.value)); j.string =
" y = %".format(c.y);
</p>
213 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c.style=t.value
</p>
214 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
215 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
216 <p class=
"p15"><span class=
"Apple-tab-span"> </span>startButton =
<span class=
"s10">Button
</span>.new(v,
<span class=
"s10">Rect
</span>(
0,
0,
380,
50))
</p>
217 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.states_([[
<span class=
"s12">"Start Sound"</span>,
<span class=
"s10">Color
</span>.black,
<span class=
"s10">Color
</span>.green],[
<span class=
"s12">"Stop Sound"</span>,
<span class=
"s10">Color
</span>.black,
<span class=
"s10">Color
</span>.red]]).action_({});
</p>
218 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
219 <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></p>
220 <p class=
"p15"><span class=
"Apple-tab-span"> </span>startButton.action_{
</p>
221 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(startButton.value==
1).if{
</p>
222 <p class=
"p15"><span class=
"Apple-tab-span"> </span>syn1=
<span class=
"s10">SynthDef
</span>(
<span class=
"s12">"test1"</span>, {
<span class=
"s10">arg
</span> bus, bufnum;
</p>
223 <p class=
"p15"><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=
"s10">var
</span> z;
</p>
224 <p class=
"p15"><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>z =
<span class=
"s10">In
</span>.ar(bus,
2);
</p>
225 <p class=
"p14"><span class=
"s2"><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>// ScopeOut writes the audio to the buffer
</p>
226 <p class=
"p15"><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=
"s10">ScopeOut
</span>.ar(z, bufnum);
</p>
227 <p class=
"p15"><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=
"s10">Out
</span>.ar(
0,z);
</p>
228 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}).play(
</p>
229 <p class=
"p15"><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=
"s10">RootNode
</span>(s),
</p>
230 <p class=
"p15"><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=
"s13">\bus
</span>,b.index,
<span class=
"s13">\bufnum
</span>, f.bufnum] ,
</p>
231 <p class=
"p14"><span class=
"s2"><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><span class=
"s13">\addToTail
</span><span class=
"s2"> </span>// make sure it goes after what you are scoping
</p>
232 <p class=
"p15"><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>
233 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
234 <p class=
"p14"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>// making noise onto the buffer
</p>
235 <p class=
"p15"><span class=
"Apple-tab-span"> </span>syn2=
<span class=
"s10">SynthDef
</span>(
<span class=
"s12">"test2"</span>, {
<span class=
"s10">arg
</span> bus;
</p>
236 <p class=
"p15"><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=
"s10">var
</span> z;
</p>
237 <p class=
"p15"><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>z =
<span class=
"s10">PMOsc
</span>.ar([
300,
250],*
<span class=
"s10">SinOsc
</span>.ar([
0.027,
0.017])*pi) *
0.1;
</p>
238 <p class=
"p15"><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=
"s10">Out
</span>.ar(bus, z);
</p>
239 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}).play(s,[
<span class=
"s13">\bus
</span>,b.index]);
</p>
240 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
241 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
242 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
243 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}{syn1.free; syn2.free};
</p>
244 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
245 <p class=
"p15"><span class=
"Apple-tab-span"> </span>};
</p>
246 <p class=
"p15"><span class=
"Apple-tab-span"> </span>w.onClose={syn1.free; syn2.free; b.free; f.free};
</p>
247 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"s10">CmdPeriod
</span>.doOnce({w.close});
</p>
248 <p class=
"p15">})
</p>