Removing an old, cherished, yet pointless caveat "This documentation is
[supercollider.git] / Help / GUI / Cocoa-GUI / SCRangeSlider.html
blobbeefcbd1eb64691b62c2351a090f2f6af8249cee
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: 14.0px Helvetica}
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 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
18 p.p9 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica; min-height: 14.0px}
19 p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
20 p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
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: #007300}
23 p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
24 span.s1 {font: 18.0px Helvetica}
25 span.s2 {color: #0000bf}
26 span.s3 {color: #0000bf}
27 span.s4 {color: #0000bf}
28 span.s5 {color: #0000bf}
29 span.s6 {color: #0000bf}
30 span.s7 {color: #0000bf}
31 span.s8 {color: #0000bf}
32 span.s9 {color: #007300}
33 span.s10 {font: 11.0px Monaco}
34 span.s11 {font: 11.0px Monaco; color: #0000bf}
35 span.s12 {font: 14.0px Helvetica}
36 span.s13 {color: #000000}
37 span.s14 {font: 9.0px Monaco}
38 span.s15 {color: #606060}
39 span.Apple-tab-span {white-space:pre}
40 </style>
41 </head>
42 <body>
43 <p class="p1"><span class="s1"><b>SCRangeSlider<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>a double-ended gui slider</b><span class="s1"><b><span class="Apple-tab-span"> </span></b></span></p>
44 <p class="p2"><br></p>
45 <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="SCControlView.html"><span class="s3"><b>SCControlView</b></span></a><b> : </b><a href="SCSliderBase.html"><span class="s2"><b>SCSliderBase</b></span></a></p>
46 <p class="p3"><br></p>
47 <p class="p1">A slider for setting two values (usually low and high values). Dragging in the slider sets the lo and high ranges according to mouse down and mouse up. To move the whole range, hold down the ctrl key while dragging. Arrow keys will also move the whole range.</p>
48 <p class="p2"><br></p>
49 <p class="p1"><b>See also:</b> <a href="../EZ-GUI/EZRanger.html"><span class="s2">EZRanger</span></a></p>
50 <p class="p2"><br></p>
51 <p class="p4"><b>Some Important Issues Regarding SCRangeSlider</b></p>
52 <p class="p2"><br></p>
53 <p class="p1">SCRangeSlider always has a range between zero and one. You must scale the output and input values to your needs. Using <b>map</b> and <b>unmap,</b> combined with a <a href="../../Control/Spec.html"><span class="s4">Spec</span></a>, is helpful for this. To set the increment or decrement value of the slider, set the <b>step</b> .<span class="Apple-converted-space">  </span>By default, the shift, ctrl, and alt keys will modify the stepping by 100x, 10x, or 0.1x repectively, though you can customize this by setting <b>shift_scale, ctrl_scale, </b>or<b> alt_scale </b>(see <a href="SCSliderBase.html"><span class="s4">SCSliderBase</span></a>) .<span class="Apple-converted-space"> </span><b> </b>Drag and drop returns and accepts <a href="../../Geometry/Point.html"><span class="s5">Point</span></a>s. Inherits some formatting from <a href="SCSliderBase.html"><span class="s6">SCSliderBase</span></a>.</p>
54 <p class="p2"><br></p>
55 <p class="p4"><b>Creation / Class Methods</b></p>
56 <p class="p5"><br></p>
57 <p class="p6"><b><span class="Apple-tab-span"> </span>*new (parent, bounds)</b></p>
58 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
59 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>parent </b>- The parent view.</p>
60 <p class="p8"><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="s7">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s7">Point</span></a> indicating width@height.</p>
61 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></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="s8">Window</span>.new.front;</p>
64 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a = <span class="s8">RangeSlider</span>(w, <span class="s8">Rect</span>(20, 80, 120, 30))</p>
65 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.lo_(0.2)</p>
66 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.range_(0.4)</p>
67 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({ <span class="s8">|slider|</span></p>
68 <p class="p10"><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="s9">\sliderLOW</span>, slider.lo, <span class="s9">\sliderHI</span>, slider.hi].postln;</p>
69 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
70 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
71 <p class="p5"><br></p>
72 <p class="p11"><b>Accessing Instance and Class Variables</b></p>
73 <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><span class="Apple-tab-span"> </span></p>
74 <p class="p6"><b><span class="Apple-tab-span"> </span>lo</b></p>
75 <p class="p6"><b><span class="Apple-tab-span"> </span>lo_ (val)</b></p>
76 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
77 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The low value of the slider. Gets/sets the property, \lo, by calling get/setProperty(\lo, <b>val</b>). This will not do the <b>action</b> of the slider.</p>
78 <p class="p5"><br></p>
79 <p class="p6"><b><span class="Apple-tab-span"> </span>activeLo_ (val)</b></p>
80 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
81 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Sets the property, \lo, by calling setPropertyWithAction(\lo, <b>val</b>). Does the sliders <b>action</b>, if the <b>lo</b> value has changed.</p>
82 <p class="p5"><br></p>
83 <p class="p6"><b><span class="Apple-tab-span"> </span>hi</b></p>
84 <p class="p6"><b><span class="Apple-tab-span"> </span>hi_ (val)</b></p>
85 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
86 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The high value of the slider. Gets/sets the property, \hi, by calling get/setProperty(\hi, <b>val</b>). This also sets the range of the slider to <b>hi</b> - <b>low</b> (which can be negative). This will not do the <b>action</b> of the slider.</p>
87 <p class="p5"><br></p>
88 <p class="p6"><b><span class="Apple-tab-span"> </span>activeHi_ (val)</b></p>
89 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
90 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Sets the property, \hi, by calling setPropertyWithAction(\hi, <b>val</b>). This also sets the range of the slider to <b>hi</b> - <b>low</b> (which can be negative). Does the sliders <b>action, </b>if the <b>hi</b> value has changed.</p>
91 <p class="p5"><br></p>
92 <p class="p6"><b><span class="Apple-tab-span"> </span>range</b></p>
93 <p class="p6"><b><span class="Apple-tab-span"> </span>range_ (val)</b></p>
94 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
95 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The range value of the slider. Gets/sets the property, \range, by calling get/setProperty(\range, <b>val</b>). This also sets the <b>hi</b> value of the slider to <b>lo</b> + <b>range.</b> This will not do the <b>action</b> of the slider.</p>
96 <p class="p5"><br></p>
97 <p class="p6"><b><span class="Apple-tab-span"> </span>activeRange_ (val)</b></p>
98 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
99 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Sets the property, \range, by calling setPropertyWithAction(\range, <b>val</b>). This also sets the <b>hi</b> value of the slider to <b>lo</b> + <b>range.</b> Does the sliders <b>action</b>.</p>
100 <p class="p5"><br></p>
101 <p class="p6"><b><span class="Apple-tab-span"> </span>setSpan (lo, hi)</b></p>
102 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
103 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A convenience method which performs both the <b>lo_</b> and <b>hi_</b> setters. This will not do the <b>action</b> of the slider.</p>
104 <p class="p5"><br></p>
105 <p class="p6"><b><span class="Apple-tab-span"> </span>setSpanActive (lo, hi)</b></p>
106 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
107 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A convenience method which performs both the <b>lo_</b> and <b>hi_</b> setters. Does the <b>action</b> of the slider.</p>
108 <p class="p7"><span class="Apple-tab-span"> </span></p>
109 <p class="p6"><span class="Apple-tab-span"> </span><b>setDeviation(deviation, average)</b></p>
110 <p class="p7"><span class="Apple-tab-span"> </span></p>
111 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A convenience methods which allows to set <b>lo</b> and <b>hi</b> according to their deviation and their average instead of their absolute values.</p>
112 <p class="p7"><span class="Apple-tab-span"> </span></p>
113 <p class="p5"><br></p>
114 <p class="p6"><b><span class="Apple-tab-span"> </span>increment (zoom)</b></p>
115 <p class="p6"><b><span class="Apple-tab-span"> </span>decrement (zoom)</b></p>
116 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
117 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>These are the methods called by pressing the arrow keys. These methods increment or decrement both the the slider values (<b>hi</b> and <b>lo</b>) by <span class="s10">(max(</span><span class="s11">this</span><span class="s10">.step, </span><span class="s11">this</span><span class="s10">.pixelStep) * zoom)</span>. This means that by default increment and decrement change the value by <b>pixelStep</b> (<b>step</b> is nil by default). You can set <b>step</b> to quantize the slider values. If you call these methods from your code, you can also change the resolution of the values with the <b>zoom</b> factor. This will not effect how the keys work, since they will always use a zoom factor of 1. Performs the action of the slider.</p>
118 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>zoom </b>- Defaults to 1.</p>
119 <p class="p5"><br></p>
120 <p class="p11"><b>Subclassing and Internal Methods</b></p>
121 <p class="p6"><span class="s12"><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>
122 <p class="p7"><br></p>
123 <p class="p6"><b><span class="Apple-tab-span"> </span>defaultKeyDownAction (char, modifiers, unicode)</b></p>
124 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
125 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The default keydown actions are:</p>
126 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
127 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>key</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><b>action</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><span class="Apple-tab-span"> </span><b>comment</b></p>
128 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>a<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>activeLo_(0), activeHi_(1) with action</b><span class="Apple-tab-span"> </span></p>
129 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n<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>activeLo_(0), activeHi_(0) with action</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
130 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>x<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>activeLo_(1), activeHi_(1) with action</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
131 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>c<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>activeLo_(0.5), activeHi_(0.5) with action</b><span class="Apple-tab-span"> </span></p>
132 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF700, <span class="Apple-tab-span"> </span><b>increment</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>up arrow</p>
133 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF703, <span class="Apple-tab-span"> </span><b>increment</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>right arrow</p>
134 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF701, <span class="Apple-tab-span"> </span><b>decrement</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>down arrow</p>
135 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF702, <span class="Apple-tab-span"> </span><b>decrement</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>left arrow</p>
136 <p class="p5"><br></p>
137 <p class="p6"><b><span class="Apple-tab-span"> </span>properties</b></p>
138 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
139 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>A list of properties to which this view responds. See <a href="SCView.html"><span class="s7">SCView</span></a>.</p>
140 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
141 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns:</p>
142 <p class="p13"><span class="s13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[ </span>\bounds<span class="s13">, </span>\visible<span class="s13">, </span>\enabled<span class="s13">, </span>\canFocus<span class="s13">, </span>\resize<span class="s13">, </span>\background<span class="s13">, </span>\minWidth<span class="s13">, </span>\maxWidth<span class="s13">, </span>\minHeight<span class="s13">, </span>\maxHeight<span class="s13">, </span>\knobColor<span class="s13">, </span>\step<span class="s13">, </span>\lo<span class="s13">, </span>\hi<span class="s13">, </span>\focusColor<span class="s13"> ]</span></p>
143 <p class="p5"><br></p>
144 <p class="p6"><b><span class="Apple-tab-span"> </span>defaultGetDrag</b></p>
145 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
146 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The method called by default when initiating a drag,Returns a <a href="../../Geometry/Point.html"><span class="s2">Point</span></a>( <b>lo</b>@<b>hi).</b></p>
147 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
148 <p class="p6"><span class="Apple-tab-span"> </span><b>defaultCanReceiveDrag</b></p>
149 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
150 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The method called by default when attempting to drop a drag in this object. By default, SCSlider will respond only to drags where the drag contains a <a href="../../Geometry/Point.html"><span class="s2">Point</span></a>.</p>
151 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s14"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span></p>
152 <p class="p6"><span class="Apple-tab-span"> </span><b>defaultReceiveDrag</b></p>
153 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
154 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The default method called when a drag has been recieved. Sets <b>lo</b> and <b>hi</b> repectively using the <a href="../../Geometry/Point.html"><span class="s2">Point</span></a>(currentDrag.x@currentDrag.y). Performs the action.</p>
155 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
156 <p class="p5"><br></p>
157 <p class="p11"><b>Examples</b></p>
158 <p class="p3"><br></p>
159 <p class="p10">(</p>
160 <p class="p10">w = <span class="s8">Window</span>.new.front;</p>
161 <p class="p10">a = <span class="s8">RangeSlider</span>(w, <span class="s8">Rect</span>(20, 80, 120, 30))</p>
162 <p class="p10"><span class="Apple-tab-span"> </span>.lo_(0.2)</p>
163 <p class="p10"><span class="Apple-tab-span"> </span>.range_(0.4)</p>
164 <p class="p10"><span class="Apple-tab-span"> </span>.action_({ <span class="s8">|slider|</span></p>
165 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[<span class="s9">\sliderLOW</span>, slider.lo, <span class="s9">\sliderHI</span>, slider.hi].postln;</p>
166 <p class="p10"><span class="Apple-tab-span"> </span>});</p>
167 <p class="p10">)</p>
168 <p class="p3"><br></p>
169 <p class="p14">// ---------</p>
170 <p class="p3"><br></p>
171 <p class="p10">(</p>
172 <p class="p10">w = <span class="s8">Window</span>.new.front;</p>
173 <p class="p10">a = <span class="s8">RangeSlider</span>(w, <span class="s8">Rect</span>(20, 80, 120, 30))</p>
174 <p class="p10"><span class="Apple-tab-span"> </span>.lo_(0.2)</p>
175 <p class="p10"><span class="Apple-tab-span"> </span>.hi_(0.8)</p>
176 <p class="p10"><span class="Apple-tab-span"> </span>.action_({ <span class="s8">|slider|</span></p>
177 <p class="p14"><span class="s13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>b.activeLo_(slider.lo); </span>// this will trigger the action of b (and set it's value)</p>
178 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>b.hi_(slider.hi);</p>
179 <p class="p10"><span class="Apple-tab-span"> </span>});</p>
180 <p class="p10">b = <span class="s8">RangeSlider</span>(w, <span class="s8">Rect</span>(220, 80, 20, 130))</p>
181 <p class="p10"><span class="Apple-tab-span"> </span>.lo_(0.2)</p>
182 <p class="p10"><span class="Apple-tab-span"> </span>.hi_(0.8)</p>
183 <p class="p10"><span class="Apple-tab-span"> </span>.knobColor_(<span class="s8">HiliteGradient</span>(<span class="s8">Color</span>.grey, <span class="s8">Color</span>.white,<span class="s9">\h</span>))</p>
184 <p class="p10"><span class="Apple-tab-span"> </span>.action_({ <span class="s8">|slider|</span></p>
185 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[<span class="s9">\sliderLOW</span>, slider.lo, <span class="s9">\sliderHI</span>, slider.hi].postln;</p>
186 <p class="p10"><span class="Apple-tab-span"> </span>});</p>
187 <p class="p3"><br></p>
188 <p class="p10">)</p>
189 <p class="p3"><br></p>
190 <p class="p14">// setDeviation:</p>
191 <p class="p10">(</p>
192 <p class="p3"><br></p>
193 <p class="p10">w = <span class="s8">Window</span>(<span class="s15">"setDeviation"</span>, <span class="s8">Rect</span>(300, 300, 300, 150));</p>
194 <p class="p10">a = <span class="s8">RangeSlider</span>(w, <span class="s8">Rect</span>(10, 10, 200, 30))</p>
195 <p class="p10"><span class="Apple-tab-span"> </span>.lo_(0)</p>
196 <p class="p10"><span class="Apple-tab-span"> </span>.hi_(1);</p>
197 <p class="p10">b = <span class="s8">Slider</span>(w, <span class="s8">Rect</span>(10, 50, 200, 30))</p>
198 <p class="p10"><span class="Apple-tab-span"> </span>.action_(</p>
199 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>{<span class="Apple-tab-span"> </span><span class="s8">arg</span> me;</p>
200 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.setDeviation(c.value, b.value);</p>
201 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
202 <p class="p10">c = <span class="s8">Slider</span>(w, <span class="s8">Rect</span>(10, 100, 200, 30))</p>
203 <p class="p10"><span class="Apple-tab-span"> </span>.action_(</p>
204 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>{<span class="Apple-tab-span"> </span><span class="s8">arg</span> me;</p>
205 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.setDeviation(c.value, b.value);</p>
206 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>}</p>
207 <p class="p10"><span class="Apple-tab-span"> </span>);</p>
208 <p class="p10">c.valueAction = 0.2;</p>
209 <p class="p10">w.front;</p>
210 <p class="p10">)</p>
211 <p class="p3"><br></p>
212 <p class="p3"><br></p>
213 <p class="p14">// SoundExample</p>
214 <p class="p3"><br></p>
215 <p class="p14">// Shape a bandpass filter. Hold down the ctrl-key to move the whole frequency range</p>
216 <p class="p10">(</p>
217 <p class="p10">s.waitForBoot({</p>
218 <p class="p10"><span class="Apple-tab-span"> </span>a={<span class="s8">arg</span> freq=1800, bw=0.2;</p>
219 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s8">var</span> r;</p>
220 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s8">BBandPass</span>.ar(<span class="s8">WhiteNoise</span>.ar(0.3), freq, bw);</p>
221 <p class="p3"><br></p>
222 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>}.play;</p>
223 <p class="p3"><br></p>
224 <p class="p10"><span class="Apple-tab-span"> </span>w = <span class="s8">Window</span>(<span class="s15">"2DSlider"</span>, <span class="s8">Rect</span>(100,<span class="s8">Window</span>.screenBounds.height-400, 400 ,50));</p>
225 <p class="p10"><span class="Apple-tab-span"> </span>t = <span class="s8">RangeSlider</span>(w, <span class="s8">Rect</span>(10, 10, 380, 30))</p>
226 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.lo_(0.4)</p>
227 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hi_(0.6)</p>
228 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s8">|sl|</span></p>
229 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.set(<span class="s9">\freq</span>,1800*(sl.lo+sl.lo)+10,<span class="s9">\bw</span>, (sl.hi-sl.lo).abs+0.01);</p>
230 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
231 <p class="p10"><span class="Apple-tab-span"> </span>t.doAction;</p>
232 <p class="p3"><span class="Apple-tab-span"> </span></p>
233 <p class="p10"><span class="Apple-tab-span"> </span>w.front;</p>
234 <p class="p10"><span class="Apple-tab-span"> </span><span class="s8">CmdPeriod</span>.doOnce({w.close});</p>
235 <p class="p10">})</p>
236 <p class="p10">)</p>
237 </body>
238 </html>