Removing an old, cherished, yet pointless caveat "This documentation is
[supercollider.git] / Help / GUI / Cocoa-GUI / SCSoundFileView.html
blob38edafd83c85657ac7db882192e7e246f45e9d4f
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="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: #001ee6}
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: 9.0px Monaco}
20 p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #606060}
21 p.p12 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
22 p.p13 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica; min-height: 14.0px}
23 p.p14 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; color: #001ee6}
24 p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
25 p.p16 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
26 p.p17 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
27 p.p18 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
28 span.s1 {font: 18.0px Helvetica}
29 span.s2 {color: #485abb}
30 span.s3 {color: #000000}
31 span.s4 {text-decoration: underline}
32 span.s5 {color: #6f7178}
33 span.s6 {color: #0018b8}
34 span.s7 {color: #606060}
35 span.s8 {color: #4357c0}
36 span.s9 {color: #3e54c5}
37 span.s10 {text-decoration: underline ; color: #3e51b3}
38 span.s11 {color: #2040df}
39 span.s12 {color: #0000ff}
40 span.s13 {font: 14.0px Helvetica}
41 span.s14 {color: #0000bf}
42 span.s15 {color: #bf0000}
43 span.Apple-tab-span {white-space:pre}
44 </style>
45 </head>
46 <body>
47 <p class="p1"><span class="s1"><b>SCSoundFileView<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>a sound file editor / viewer</b></p>
48 <p class="p2"><br></p>
49 <p class="p1"><b>Inherits from: </b><a href="../../Core/Object.html"><span class="s2"><b>Object</b></span></a><b> : </b><a href="SCView.html"><span class="s2"><b>SCView</b></span></a><b> : </b><a href="SCScope.html"><span class="s2"><b>SCScope</b></span></a></p>
50 <p class="p3"><br></p>
51 <p class="p1">A sound file viewer with numerous options. </p>
52 <p class="p2"><br></p>
53 <p class="p4"><span class="s3"><b>See also:</b> <a href="../../Files/SoundFile.html"><span class="s4">SoundFile</span></a>, <a href="SCScope.html"><span class="s4">SCScope</span></a>, <a href="SoundFileViewProgressWindow.html"><span class="s4">SoundFileViewProgressWindow</span></a></span></p>
54 <p class="p2"><br></p>
55 <p class="p5"><b>Creation / Class Methods</b></p>
56 <p class="p6"><br></p>
57 <p class="p7"><b><span class="Apple-tab-span"> </span>*new (parent, bounds)</b></p>
58 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
59 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>parent </b>- The parent view.</p>
60 <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="s5">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s5">Point</span></a> indicating width@height.</p>
61 <p class="p6"><br></p>
62 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(</p>
63 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w = <span class="s6">SCWindow</span>.new(<span class="s7">"soundfile test"</span>, <span class="s6">Rect</span>(200, 200, 850, 400));</p>
64 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a = <span class="s6">SCSoundFileView</span>.new(w, <span class="s6">Rect</span>(20,20, 700, 60));</p>
65 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>f = <span class="s6">SoundFile</span>.new;</p>
66 <p class="p11"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>f.openRead(</span>"sounds/a11wlk01.wav"<span class="s3">);</span></p>
67 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.soundfile = f;</p>
68 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.read(0, f.numFrames);</p>
69 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w.front;</p>
70 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
71 <p class="p6"><br></p>
72 <p class="p12"><b>Accessing Instance and Class Variables</b></p>
73 <p class="p8"><br></p>
74 <p class="p7"><b><span class="Apple-tab-span"> </span>soundfile</b></p>
75 <p class="p7"><b><span class="Apple-tab-span"> </span>soundfile_ (snd)</b></p>
76 <p class="p7"><b><span class="Apple-tab-span"> </span></b>.</p>
77 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>snd </b>- An Instance of <a href="../../Files/SoundFile.html"><span class="s8">SoundFile</span></a>.</p>
78 <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><span class="Apple-tab-span"> </span></p>
79 <p class="p7"><b><span class="Apple-tab-span"> </span>startFrame</b></p>
80 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
81 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Returns the start frame as an <a href="../../Math/Integer.html"><span class="s8">Integer</span></a>.</p>
82 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
83 <p class="p7"><b><span class="Apple-tab-span"> </span>numFrames</b></p>
84 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
85 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Returns the number of frames in the <b>soundfile.</b></p>
86 <p class="p8"><b><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><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
87 <p class="p7"><b><span class="Apple-tab-span"> </span>viewFrames</b></p>
88 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
89 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Returns how many frames int the view.</p>
90 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
91 <p class="p7"><b><span class="Apple-tab-span"> </span>readProgress</b></p>
92 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
93 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns the read progress<span class="Apple-tab-span"> </span></p>
94 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
95 <p class="p7"><b><span class="Apple-tab-span"> </span>scrollPos</b></p>
96 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
97 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns the scroll position<span class="Apple-tab-span"> </span></p>
98 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
99 <p class="p7"><b><span class="Apple-tab-span"> </span>metaAction_(arg1)</b></p>
100 <p class="p7"><b><span class="Apple-tab-span"> </span>metaAction</b></p>
101 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
102 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 - </b>An instance of <a href="../../Core/Kernel/Function.html"><span class="s8">Function</span></a> to be evaluated on ctrl-click.</p>
103 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
104 <p class="p12"><b>Reading A Sound File into the View</b></p>
105 <p class="p6"><br></p>
106 <p class="p7"><b><span class="Apple-tab-span"> </span>read (startframe, frames, block, closeFile)</b></p>
107 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
108 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Reads a section of <b>soundfile</b> and displays it in the view. For large files, you may want to use <b>readWithTask</b> instead.</p>
109 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>startframe </b>- An integer smaller than <b>numFrames</b>.</p>
110 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frames </b>- An integer smaller than <b>numFrames</b>-<b>startFrame</b>.</p>
111 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>block </b>- An integer. The block size. Must be 2**n. Default value is 64. The visual resolution of the waveform.</p>
112 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>closeFile </b>- If true, closes the SoundFile after reading. Default value is true.</p>
113 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
114 <p class="p7"><b><span class="Apple-tab-span"> </span>readFile (asoundfile, startframe, frames, block, closefile)</b></p>
115 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
116 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Reads a section of any open instance of <a href="../../Files/SoundFile.html"><span class="s9">SoundFile</span></a>, and displays it in the view. For large files, you may want to use the method <b>readWithTask</b> instead.</p>
117 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>asoundfile </b>- Any instance of SoundFile. the file must be open.</p>
118 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>startframe </b>- An integer smaller than <b>numFrames</b>.</p>
119 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frames </b>- An integer smaller than <b>numFrames</b>-<b>startFrame</b>.</p>
120 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>block </b>- An integer. The block size. Must be 2**n. Default value is 64. The visual resolution of the waveform.</p>
121 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>closeFile </b>- If true, closes the SoundFile after reading. Default value is true.</p>
122 <p class="p6"><br></p>
123 <p class="p7"><b><span class="Apple-tab-span"> </span>readWithTask (startframe, frames, block, doneAction, showProgress)</b></p>
124 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
125 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Reads a section of this.<b>soundfile</b> into the view, looping thrugh the frames and updating <b>readProgress</b>. If showProgress is true, a <a href="SoundFileViewProgressWindow.html"><span class="s10">SoundFileViewProgressWindow</span></a> opens to show the read progress.</p>
126 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>startframe </b>- An integer smaller than <b>numFrames</b>.</p>
127 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frames </b>- An integer smaller than <b>numFrames</b>-<b>startFrame</b>.</p>
128 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>block </b>- An integer. The block size. Must be 2**n. Default value is 64. The visual resolution of the waveform.</p>
129 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>doneAction </b>- An optional functiont o be evaluated on completion.</p>
130 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>showProgress </b>- An instance of Boolean. Whether to open a progress window. Default value is true.</p>
131 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
132 <p class="p7"><b><span class="Apple-tab-span"> </span>readFileWithTask (soundfile, startframe, frames, block, doneAction, showProgress)</b></p>
133 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
134 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Reads a section of an open instance of <a href="../../Files/SoundFile.html"><span class="s9">SoundFile</span></a> into the view, looping thrugh the frames and updating <b>readProgress</b>. If showProgress is true, a <a href="SoundFileViewProgressWindow.html"><span class="s10">SoundFileViewProgressWindow</span></a> opens to show the read progress.</p>
135 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>soundfile </b>- Any instance of SoundFile. the file must be open.</p>
136 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>startframe </b>- An integer smaller than <b>numFrames</b>.</p>
137 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frames </b>- An integer smaller than <b>numFrames</b>-<b>startFrame</b>.</p>
138 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>block </b>- An integer. The block size. Must be 2**n. Default value is 64. The visual resolution of the waveform.</p>
139 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>doneAction </b>- An optional functiont o be evaluated on completion.</p>
140 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>showProgress </b>- An instance of Boolean. Whether to open a progress window. Default value is true.<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
141 <p class="p6"><br></p>
142 <p class="p12"><b>Navigating the Sound File</b></p>
143 <p class="p6"><br></p>
144 <p class="p7"><b><span class="Apple-tab-span"> </span>zoom (factor)</b></p>
145 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
146 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Zoom by factor relative to current zoom.</p>
147 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>factor </b>- An instance of <a href="../../Math/Float.html"><span class="s11">Float</span></a>.</p>
148 <p class="p6"><br></p>
149 <p class="p7"><b><span class="Apple-tab-span"> </span>zoomToFrac (frac)</b></p>
150 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
151 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Zoom to a specific scale, <b>frac</b>.</p>
152 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frac </b>- An instance of <a href="../../Math/Float.html"><span class="s11">Float</span></a>.</p>
153 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
154 <p class="p7"><b><span class="Apple-tab-span"> </span>zoomAllOut</b></p>
155 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
156 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Fill the window with the current selection.</p>
157 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
158 <p class="p7"><b><span class="Apple-tab-span"> </span>zoomSelection (index)</b></p>
159 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
160 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Zoom to <b>selections</b>.at(<b>index</b>).</p>
161 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
162 <p class="p6"><br></p>
163 <p class="p7"><b><span class="Apple-tab-span"> </span>scrollTo (position)</b></p>
164 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
165 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>position </b>- An integer.</p>
166 <p class="p6"><br></p>
167 <p class="p7"><b><span class="Apple-tab-span"> </span>scroll (amount)</b></p>
168 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
169 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>amount </b>- An integer.</p>
170 <p class="p6"><br></p>
171 <p class="p7"><b><span class="Apple-tab-span"> </span>scrollToStart</b></p>
172 <p class="p7"><b><span class="Apple-tab-span"> </span>scrollToEnd</b></p>
173 <p class="p6"><br></p>
174 <p class="p12"><b>Selecting Ranges of Sound</b></p>
175 <p class="p8"><br></p>
176 <p class="p7"><b><span class="Apple-tab-span"> </span>selections</b></p>
177 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
178 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns an array of 64 arrays of start frames and sizes: [ [ start0, size0 ] , [ start1, size1 ], ... ].</p>
179 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>This is where the selections are stored.</p>
180 <p class="p6"><br></p>
181 <p class="p7"><b><span class="Apple-tab-span"> </span>selection (index)</b></p>
182 <p class="p7"><b><span class="Apple-tab-span"> </span>setSelection (index, selection)</b></p>
183 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
184 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets/sets <b>selections</b>.at(<b>index</b>).</p>
185 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
186 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>selection </b>- An instance of Array, [ [ start, size ] ], where start and size are integers.</p>
187 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
188 <p class="p7"><b><span class="Apple-tab-span"> </span>currentSelection</b></p>
189 <p class="p7"><b><span class="Apple-tab-span"> </span>currentSelection_ (index)</b></p>
190 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
191 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets / gets the current selection.</p>
192 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
193 <p class="p6"><br></p>
194 <p class="p7"><b><span class="Apple-tab-span"> </span>selectionStart (index)</b></p>
195 <p class="p7"><b><span class="Apple-tab-span"> </span>setSelectionStart (index, frame)</b></p>
196 <p class="p8"><br></p>
197 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets/sets the start frame of <b>selections</b>.at(<b>index</b>).</p>
198 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
199 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frame </b>- An integer smaller than <b>numFrames</b> .</p>
200 <p class="p6"><br></p>
201 <p class="p7"><b><span class="Apple-tab-span"> </span>selectionSize (index)</b></p>
202 <p class="p7"><b><span class="Apple-tab-span"> </span>setSelectionSize (index, frame)</b></p>
203 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
204 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets/sets the size of <b>selections</b>.at(<b>index</b>).</p>
205 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
206 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frame </b>- An integer. The number of frames in the selection .</p>
207 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
208 <p class="p7"><b><span class="Apple-tab-span"> </span>selectionStartTime (index)</b></p>
209 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
210 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns the start time of at <b>selections</b>.at(<b>index</b>).</p>
211 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
212 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
213 <p class="p7"><b><span class="Apple-tab-span"> </span>selectionDuration (index)</b></p>
214 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
215 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns the duration of at <b>selections</b>.at(<b>index</b>).</p>
216 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
217 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
218 <p class="p7"><b><span class="Apple-tab-span"> </span>selectAll (index)</b></p>
219 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
220 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Set <b>selections</b>.at(<b>index</b>) to the whole file .</p>
221 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
222 <p class="p6"><br></p>
223 <p class="p7"><b><span class="Apple-tab-span"> </span>selectNone (index)</b></p>
224 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
225 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Set the size of the selection, <b>selections</b>.at(<b>index</b>), to 0.</p>
226 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
227 <p class="p8"><br></p>
228 <p class="p7"><b><span class="Apple-tab-span"> </span>setSelectionColor (index, color)</b></p>
229 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
230 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets the color of <b>selections</b>.at(<b>index</b>).</p>
231 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
232 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>color </b>- An instance of <b>Color</b>.</p>
233 <p class="p8"><br></p>
234 <p class="p7"><b><span class="Apple-tab-span"> </span>setEditableSelectionStart (index, bool)</b></p>
235 <p class="p7"><b><span class="Apple-tab-span"> </span>setEditableSelectionSize (index, bool)</b></p>
236 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
237 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Use this to protect a selection from being edited.</p>
238 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>index </b>- An integer between 0 an 63.</p>
239 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s11">Boolean</span></a>.</p>
240 <p class="p6"><br></p>
241 <p class="p7"><b><span class="Apple-tab-span"> </span>readSelection (block, closeFile)</b></p>
242 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
243 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>read this.<b>selection</b></p>
244 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>block </b>- An integer. The block size. Must be 2**n. Default value is 64. The visual resolution of the waveform.</p>
245 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>closeFile </b>- If true, closes the SoundFile after reading. Default value is true.</p>
246 <p class="p6"><br></p>
247 <p class="p7"><b><span class="Apple-tab-span"> </span>readSelectionWithTask</b></p>
248 <p class="p8"><br></p>
249 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>read this.<b>selection</b> using the progress window.</p>
250 <p class="p6"><br></p>
251 <p class="p12"><b>Display Options</b></p>
252 <p class="p8"><br></p>
253 <p class="p7"><b><span class="Apple-tab-span"> </span>gridOn</b></p>
254 <p class="p7"><b><span class="Apple-tab-span"> </span>gridOn_ (boolean)</b></p>
255 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
256 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>boolean </b>- An instance of <a href="../../Core/Boolean.html"><span class="s11">Boolean</span></a>.</p>
257 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
258 <p class="p7"><b><span class="Apple-tab-span"> </span>gridResolution</b></p>
259 <p class="p7"><b><span class="Apple-tab-span"> </span>gridResolution_ (resolution)</b></p>
260 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
261 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Get/set he resolution of the grid.</p>
262 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>resolution </b>- An instance of Float.</p>
263 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
264 <p class="p7"><b><span class="Apple-tab-span"> </span>gridOffset_ (offset)</b></p>
265 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
266 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>set the grid offset.</p>
267 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>offset </b>- an integer.</p>
268 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
269 <p class="p7"><b><span class="Apple-tab-span"> </span>gridColor_(color)</b></p>
270 <p class="p7"><b><span class="Apple-tab-span"> </span>gridColor</b></p>
271 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
272 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>color </b>- An instance of <a href="../GUI-Tools/Color.html"><span class="s11">Color</span></a>.</p>
273 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
274 <p class="p7"><b><span class="Apple-tab-span"> </span>drawsWaveForm</b></p>
275 <p class="p7"><b><span class="Apple-tab-span"> </span>drawsWaveForm_ (bool)</b></p>
276 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
277 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Whether the wave is drawn or not.</p>
278 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s12">Boolean</span></a>.</p>
279 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
280 <p class="p7"><b><span class="Apple-tab-span"> </span>timeCursorOn</b></p>
281 <p class="p7"><b><span class="Apple-tab-span"> </span>timeCursorOn_ (bool)</b></p>
282 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
283 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Show/hide the time cursor.</p>
284 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool</b>- An instance of <a href="../../Core/Boolean.html"><span class="s11">Boolean</span></a>.</p>
285 <p class="p6"><br></p>
286 <p class="p7"><b><span class="Apple-tab-span"> </span>timeCursorPosition</b></p>
287 <p class="p7"><b><span class="Apple-tab-span"> </span>timeCursorPosition_ (frame)</b></p>
288 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
289 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Get/set the time cursor frame position.</p>
290 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frame </b>- An integer.</p>
291 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
292 <p class="p7"><b><span class="Apple-tab-span"> </span>timeCursorColor</b></p>
293 <p class="p7"><b><span class="Apple-tab-span"> </span>timeCursorColor_ (color)</b></p>
294 <p class="p8"><br></p>
295 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>color </b>- An instance of Color</p>
296 <p class="p6"><br></p>
297 <p class="p12"><b>Subclassing and Internal Methods</b></p>
298 <p class="p7"><span class="s13"><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>
299 <p class="p6"><br></p>
300 <p class="p7"><b><span class="Apple-tab-span"> </span>doMetaAction</b></p>
301 <p class="p8"><br></p>
302 <p class="p7"><b><span class="Apple-tab-span"> </span>makeProgressWindow</b></p>
303 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
304 <p class="p14"><span class="s3"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Creates a <a href="SoundFileViewProgressWindow.html"><span class="s4">SoundFileViewProgressWindow</span></a>.</span></p>
305 <p class="p8"><br></p>
306 <p class="p7"><b><span class="Apple-tab-span"> </span>init (argParent, argBounds)</b></p>
307 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
308 <p class="p7"><b><span class="Apple-tab-span"> </span>dataFrames_(arg1)</b></p>
309 <p class="p7"><b><span class="Apple-tab-span"> </span>dataFrames</b></p>
310 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
311 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Explanation including the type of <b>dataFrames </b>and a link to its help file.</p>
312 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Default value is nil.</p>
313 <p class="p7"><b><span class="Apple-tab-span"> </span>dataNumSamples</b></p>
314 <p class="p7"><b><span class="Apple-tab-span"> </span>data</b></p>
315 <p class="p7"><b><span class="Apple-tab-span"> </span>data_ (arr)</b></p>
316 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
317 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Get/set the view data.</p>
318 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arr </b>- An instance of <a href="../../Collections/Array.html"><span class="s11">Array</span></a>.</p>
319 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
320 <p class="p7"><b><span class="Apple-tab-span"> </span>setData (arr, block, startframe, channels, samplerate)</b></p>
321 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
322 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Set the view data.</p>
323 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arr </b>- An instance of <a href="../../Collections/Array.html"><span class="s11">Array</span></a>.</p>
324 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>block </b>- An integer. The block size. Must be 2**n. Default value is 64. The visual resolution of the waveform.</p>
325 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>startframe </b>- An integer.</p>
326 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>channels </b>- An integer.</p>
327 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>samplerate </b>- An integer. Default value is 44100.</p>
328 <p class="p8"><br></p>
329 <p class="p7"><b><span class="Apple-tab-span"> </span>updateScroll</b></p>
330 <p class="p7"><b><span class="Apple-tab-span"> </span>updateData</b></p>
331 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
332 <p class="p7"><b><span class="Apple-tab-span"> </span>elasticMode</b></p>
333 <p class="p7"><b><span class="Apple-tab-span"> </span>elasticMode_ (mode)</b></p>
334 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
335 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseEndTrack (x, y)</b></p>
336 <p class="p8"><br></p>
337 <p class="p7"><span class="s13"><span class="Apple-tab-span"> </span></span>Not Implemented yet:</p>
338 <p class="p8"><span class="Apple-tab-span"> </span></p>
339 <p class="p7"><b><span class="Apple-tab-span"> </span>*cacheFolder</b></p>
340 <p class="p7"><b><span class="Apple-tab-span"> </span>*cacheFolder_ (path)</b></p>
341 <p class="p7"><b><span class="Apple-tab-span"> </span>*cacheCapacity</b></p>
342 <p class="p7"><b><span class="Apple-tab-span"> </span>*cacheCapacity_ (megaBytes)</b></p>
343 <p class="p7"><b><span class="Apple-tab-span"> </span>*cacheActive</b></p>
344 <p class="p7"><b><span class="Apple-tab-span"> </span>*cacheActive_ (bool)</b></p>
345 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
346 <p class="p12"><b>Examples</b></p>
347 <p class="p15"><br></p>
348 <p class="p16">(</p>
349 <p class="p16">w = <span class="s14">SCWindow</span>.new(<span class="s7">"soundfile test"</span>, <span class="s14">Rect</span>(200, 200, 800, 400));</p>
350 <p class="p16">a = <span class="s14">SCSoundFileView</span>.new(w, <span class="s14">Rect</span>(20,20, 700, 60));</p>
351 <p class="p15"><br></p>
352 <p class="p16">f = <span class="s14">SoundFile</span>.new;</p>
353 <p class="p17"><span class="s3">f.openRead(</span>"sounds/a11wlk01.wav"<span class="s3">);</span></p>
354 <p class="p16">f.inspect;</p>
355 <p class="p15"><br></p>
356 <p class="p16">a.soundfile = f;</p>
357 <p class="p16">a.read(0, f.numFrames);</p>
358 <p class="p16">a.elasticMode = <span class="s14">true</span>;</p>
359 <p class="p15"><br></p>
360 <p class="p16">a.timeCursorOn = <span class="s14">true</span>;</p>
361 <p class="p16">a.timeCursorColor = <span class="s14">Color</span>.red;</p>
362 <p class="p16">a.timeCursorPosition = 2050;</p>
363 <p class="p16">a.drawsWaveForm = <span class="s14">true</span>;</p>
364 <p class="p16">a.gridOn = <span class="s14">true</span>;</p>
365 <p class="p16">a.gridResolution = 0.2;</p>
366 <p class="p15"><br></p>
367 <p class="p16">w.front;</p>
368 <p class="p16">)</p>
369 <p class="p15"><br></p>
370 <p class="p18">// step by step examples:</p>
371 <p class="p15"><br></p>
372 <p class="p18"><span class="s3">( </span>// make a simple SCSoundFileView</p>
373 <p class="p16">w = <span class="s14">SCWindow</span>.new(<span class="s7">"soundfile test"</span>, <span class="s14">Rect</span>(10, 700, 750, 100));</p>
374 <p class="p16">w.front;</p>
375 <p class="p16">a = <span class="s14">SCSoundFileView</span>.new(w, <span class="s14">Rect</span>(20,20, 700, 60));</p>
376 <p class="p15"><br></p>
377 <p class="p16">f = <span class="s14">SoundFile</span>.new;</p>
378 <p class="p17"><span class="s3">f.openRead(</span>"sounds/a11wlk01.wav"<span class="s3">);</span></p>
379 <p class="p18">// f.inspect;</p>
380 <p class="p15"><br></p>
381 <p class="p16">a.soundfile = f;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s15">// set soundfile</span></p>
382 <p class="p18"><span class="s3">a.read(0, f.numFrames);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// read in the entire file.</p>
383 <p class="p18"><span class="s3">a.refresh;<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>// refresh to display the file.</p>
384 <p class="p16">)</p>
385 <p class="p15"><br></p>
386 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// reading file</p>
387 <p class="p16">a.read(0, f.numFrames / 2).refresh;<span class="Apple-tab-span"> </span><span class="s15">// read first half</span></p>
388 <p class="p18"><span class="s3">a.read.refresh;<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>// read entire file by default</p>
389 <p class="p16">a.read(f.numFrames / 2).refresh; <span class="Apple-tab-span"> </span><span class="s15">// read second half</span></p>
390 <p class="p18"><span class="s3">a.read(0, -1).refresh;<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>// -1 also reads entire file, like buffer.</p>
391 <p class="p15"><br></p>
392 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// block sets visual resolution of waveform, default is 64.</p>
393 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// i.e. the view keeps peak values for each block of e.g. 64 samples</p>
394 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// rather than the entire waveform.</p>
395 <p class="p16">a.read(0, -1, block: 32).refresh;</p>
396 <p class="p16">a.read(0, -1, block: 24).refresh;</p>
397 <p class="p16">a.read(0, -1, block: 16).refresh;</p>
398 <p class="p15"><br></p>
399 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// for longer files, you can use:</p>
400 <p class="p16">a.readWithTask;</p>
401 <p class="p15"><br></p>
402 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// zoom is relative</p>
403 <p class="p16">a.zoom(0.2).refresh;</p>
404 <p class="p16">a.zoom(2).refresh;</p>
405 <p class="p16">a.zoom(2).refresh;</p>
406 <p class="p18"><span class="s3">a.zoomToFrac(0.5); </span>// zoom to half file size</p>
407 <p class="p16">a.zoomAllOut;</p>
408 <p class="p15"><span class="Apple-tab-span"> </span></p>
409 <p class="p18"><span class="s3">a.gridOn = </span><span class="s14">true</span><span class="s3">;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// time grid, 1 second by default,</p>
410 <p class="p18"><span class="s3">a.gridResolution = 0.2;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// or set resolution in seconds</p>
411 <p class="p18"><span class="s3">a.gridColor = </span><span class="s14">Color</span><span class="s3">.cyan;<span class="Apple-tab-span"> </span></span>// color is changeable.</p>
412 <p class="p18"><span class="s3">a.gridOffset_(0.1);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// not sure if this is working?</p>
413 <p class="p15"><br></p>
414 <p class="p16">a.timeCursorOn = <span class="s14">true</span>;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s15">// a settable cursor</span></p>
415 <p class="p16">a.timeCursorPosition = 2050;<span class="Apple-tab-span"> </span><span class="s15">// position is in frames.</span></p>
416 <p class="p16">a.timeCursorColor = <span class="s14">Color</span>.white;<span class="Apple-tab-span"> </span></p>
417 <p class="p15"><br></p>
418 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// toggle drawing on/off</p>
419 <p class="p16">a.drawsWaveForm = <span class="s14">false</span>;</p>
420 <p class="p16">a.drawsWaveForm = <span class="s14">true</span>;</p>
421 <p class="p15"><br></p>
422 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// these methods should return view properties:</p>
423 <p class="p16">a.gridOn</p>
424 <p class="p16">a.gridResolution</p>
425 <p class="p16">a.gridColor</p>
426 <p class="p16">a.timeCursorOn</p>
427 <p class="p16">a.timeCursorPosition</p>
428 <p class="p16">a.timeCursorColor</p>
429 <p class="p15"><br></p>
430 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// Selections: multiple selections are supported.</p>
431 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// e.g. use selection 0:</p>
432 <p class="p16">a.setSelectionColor(0, <span class="s14">Color</span>.red);<span class="Apple-tab-span"> </span><span class="s15">// set...( index, value )</span></p>
433 <p class="p16">a.selectionStart(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="s15">// at index</span></p>
434 <p class="p16">a.setSelectionStart(0, 12345);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
435 <p class="p16">a.setSelectionSize(0, 12345);</p>
436 <p class="p15"><br></p>
437 <p class="p16">a.setSelectionStart(0, 1234);</p>
438 <p class="p16">a.selectionStart(0);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s15">//</span></p>
439 <p class="p15"><br></p>
440 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// now selection 1</p>
441 <p class="p16">a.setSelectionColor(1, <span class="s14">Color</span>.white);</p>
442 <p class="p16">a.setSelectionStart(1, 1234).setSelectionSize(1, 1234 * 2);</p>
443 <p class="p16">a.selectionStart(1);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s15">//</span></p>
444 <p class="p16">a.setSelectionStart(0, 12345);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s15">//</span></p>
445 <p class="p15"><br></p>
446 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// the current selection gets changed when click/dragging in view.</p>
447 <p class="p18"><span class="s3">a.currentSelection;<span class="Apple-tab-span"> </span></span>// index of current selection;</p>
448 <p class="p18"><span class="s3">a.currentSelection_(1);<span class="Apple-tab-span"> </span></span>// switch current selection - try click/drag white now.</p>
449 <p class="p16">a.currentSelection;</p>
450 <p class="p15"><br></p>
451 <p class="p16">a.selections.size;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s15">// 64 selections</span></p>
452 <p class="p16">a.selections[0];</p>
453 <p class="p16">a.selections[1];</p>
454 <p class="p16">a.selections;</p>
455 <p class="p15"><br></p>
456 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// setSelection (index, selection);</p>
457 <p class="p16">a.setSelection(0, [234, 2345]);</p>
458 <p class="p18"><span class="s3">a.selection(1);<span class="Apple-tab-span"> </span></span>// returns [start, size].</p>
459 <p class="p15"><br></p>
460 <p class="p15"><br></p>
461 <p class="p18"><span class="s3">a.elasticMode = </span><span class="s14">true</span><span class="s3">;<span class="Apple-tab-span"> </span></span>// not sure if this is working yet?</p>
462 <p class="p15"><br></p>
463 <p class="p18"><span class="s3">(<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// mouseUpAction</p>
464 <p class="p16">a.mouseUpAction = {</p>
465 <p class="p17"><span class="s3"><span class="Apple-tab-span"> </span>(</span>"mouseUp, current selection is now:"<span class="s3"></span></p>
466 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>+ a.selections[a.currentSelection]).postln;</p>
467 <p class="p16">};</p>
468 <p class="p16">)</p>
469 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// lock selection 0:</p>
470 <p class="p16">a.currentSelection_(0);</p>
471 <p class="p16">a.setEditableSelectionStart(0, <span class="s14">false</span>);</p>
472 <p class="p16">a.setEditableSelectionSize(0, <span class="s14">false</span>);</p>
473 <p class="p15"><br></p>
474 <p class="p15"><br></p>
475 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span></span>// unlock selection 0:</p>
476 <p class="p16">a.setEditableSelectionStart(0, <span class="s14">true</span>);</p>
477 <p class="p16">a.setEditableSelectionSize(0, <span class="s14">true</span>);</p>
478 <p class="p15"><br></p>
479 <p class="p16">a.selectionStartTime(0);</p>
480 <p class="p16">a.selectionDuration(0);</p>
481 <p class="p15"><br></p>
482 <p class="p15"><br></p>
483 <p class="p16">a.setSelectionStart(0, 12345);</p>
484 <p class="p16">a.setSelectionSize(0, 12345);</p>
485 <p class="p16">a.readSelection.refresh;</p>
486 <p class="p16">a.readSelection(16).refresh;<span class="Apple-tab-span"> </span><span class="s15">// in higher resolution</span></p>
487 <p class="p18"><span class="s3">a.read.refresh;<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>// go back to entire file.</p>
488 <p class="p15"><br></p>
489 <p class="p15"><br></p>
490 <p class="p18"><span class="s3">a.dataNumSamples;<span class="Apple-tab-span"> </span></span>// visual data have this many points</p>
491 <p class="p16">a.data.plot;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s15">//</span></p>
492 <p class="p16">a.setData(a.data.reverse);</p>
493 <p class="p15"><br></p>
494 <p class="p15"><br></p>
495 <p class="p18"><span class="s3">a.zoom(0.25);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// scrolling is normalized</p>
496 <p class="p16">a.scrollTo(0.5);<span class="Apple-tab-span"> </span><span class="s15">//</span></p>
497 <p class="p16">a.scrollTo(0.6);<span class="Apple-tab-span"> </span><span class="s15">//</span></p>
498 <p class="p18"><span class="s3">a.scroll(12);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// scroll is in viewFrames.</p>
499 <p class="p15"><br></p>
500 <p class="p16">a.zoom(4);<span class="Apple-tab-span"> </span></p>
501 <p class="p15"><br></p>
502 <p class="p16">w.close;</p>
503 </body>
504 </html>