SCDoc: Use proper static string constants instead of comparing string literals.
[supercollider.git] / Help / Control / Spec.html
blobb34b67ec7df015383d2d9259ccad3274475c8d5c
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="1038.25">
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; color: #bf0000}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000; min-height: 12.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #007300}
17 span.s1 {font: 18.0px Helvetica}
18 span.s2 {font: 25.0px Helvetica}
19 span.s3 {color: #0000bf}
20 span.s4 {text-decoration: underline ; color: #0000bf}
21 span.s5 {color: #007300}
22 span.s6 {color: #000000}
23 span.s7 {color: #606060}
24 span.s8 {color: #737373}
25 span.Apple-tab-span {white-space:pre}
26 </style>
27 </head>
28 <body>
29 <p class="p1"><span class="s1"><b>Spec<span class="Apple-tab-span"> </span></b></span><span class="s2"><b><span class="Apple-tab-span"> </span></b></span><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>input datatype specification</b></p>
30 <p class="p2"><br></p>
31 <p class="p1"><b>Inherits from: </b><a href="../Core/Object.html"><span class="s3"><b>Object</b></span></a><b><span class="Apple-converted-space"> </span></b></p>
32 <p class="p2"><br></p>
33 <p class="p1">Specs specify what kind of input is required or permissible, and what the range of those parameters are<b>. </b>This is an abstract class – the most common subclass is: <a href="SC://ControlSpec"><span class="s4">ControlSpec</span></a></p>
34 <p class="p2"><br></p>
35 <p class="p1">ControlSpec is used by GUI sliders and knobs to specify the range and curve of the controls. Input datatypes are of interest to functions, to gui interface objects (sliders etc.) and can also be used for introspection.</p>
36 <p class="p2"><br></p>
37 <p class="p1">The class Spec itself holds a master Dictionary of common specifications.<span class="Apple-converted-space">  </span>The name that the spec was stored as can then be used as a shorthand to refer to specs:</p>
38 <p class="p2"><br></p>
39 <p class="p1">\freq.asSpec</p>
40 <p class="p2"><br></p>
41 <p class="p1">Some common mappings are initialized in ControlSpec.initClass. You may add or overwrite mappings as you wish. The crucial library defines a number of additional subclasses.<span class="Apple-converted-space">  </span>See the crucial/Instr/MoreSpecs.sc</p>
42 <p class="p2"><br></p>
43 <p class="p1"><b>See also:</b> <a href="Warp.html"><span class="s3">Warp</span></a></p>
44 <p class="p2"><br></p>
45 <p class="p2"><br></p>
46 <p class="p2"><br></p>
47 <p class="p1"><b>*add(name, item)</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>add a spec to the global spec dictionary under the <b>name</b></p>
48 <p class="p1"><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>the item will be converted to a spec using<span class="Apple-converted-space">  </span>.asSpec</p>
49 <p class="p2"><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>
50 <p class="p3">// example:</p>
51 <p class="p4"><br></p>
52 <p class="p5"><span class="s3">Spec</span>.add(<span class="s5">\helpExp</span>, <span class="s3">ControlSpec</span>( 0.01, 1.0, <span class="s5">\exp</span>) );</p>
53 <p class="p6"><br></p>
54 <p class="p3">// the array will be converted to a control spec</p>
55 <p class="p5"><span class="s3">Spec</span>.add(<span class="s5">\helpLin</span>, [0, 1, <span class="s5">\lin</span>, 0.011, 0.01]);</p>
56 <p class="p4"><br></p>
57 <p class="p3">// a symbol will be looked up converteuse the existing \freq spec for \helpLin2</p>
58 <p class="p7"><span class="s3">Spec</span><span class="s6">.add(</span>\helpLin2<span class="s6">, </span>\freq<span class="s6">);<span class="Apple-converted-space"> </span></span></p>
59 <p class="p4"><br></p>
60 <p class="p3">// existing spec:</p>
61 <p class="p5"><span class="s3">Spec</span>.add(<span class="s5">\helpLin</span>, <span class="s3">ControlSpec</span>(0.ampdb, 1.ampdb, <span class="s5">\db</span>, units: <span class="s7">" dB"</span>));</p>
62 <p class="p6"><br></p>
63 <p class="p6"><br></p>
64 <p class="p6"><br></p>
65 <p class="p3">// List of default specs:</p>
66 <p class="p6"><br></p>
67 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\unipolar</span> -&gt; <span class="s3">ControlSpec</span>(0, 1),</p>
68 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\bipolar</span> -&gt; <span class="s3">ControlSpec</span>(-1, 1, default: 0),</p>
69 <p class="p6"><br></p>
70 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\freq</span> -&gt; <span class="s3">ControlSpec</span>(20, 20000, <span class="s5">\exp</span>, 0, 440, units: <span class="s8">" Hz"</span>),</p>
71 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\lofreq</span> -&gt; <span class="s3">ControlSpec</span>(0.1, 100, <span class="s5">\exp</span>, 0, 6, units: <span class="s8">" Hz"</span>),</p>
72 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\midfreq</span> -&gt; <span class="s3">ControlSpec</span>(25, 4200, <span class="s5">\exp</span>, 0, 440, units: <span class="s8">" Hz"</span>),</p>
73 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\widefreq</span> -&gt; <span class="s3">ControlSpec</span>(0.1, 20000, <span class="s5">\exp</span>, 0, 440, units: <span class="s8">" Hz"</span>),</p>
74 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\phase</span> -&gt; <span class="s3">ControlSpec</span>(0, 2pi),</p>
75 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\rq</span> -&gt; <span class="s3">ControlSpec</span>(0.001, 2, <span class="s5">\exp</span>, 0, 0.707),</p>
76 <p class="p6"><br></p>
77 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\audiobus</span> -&gt; <span class="s3">ControlSpec</span>(0, <span class="s3">Server</span>.default.options.numAudioBusChannels-1, step: 1),</p>
78 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\controlbus</span> -&gt; <span class="s3">ControlSpec</span>(0, <span class="s3">Server</span>.default.options.numControlBusChannels-1, step: 1),</p>
79 <p class="p6"><br></p>
80 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\midi</span> -&gt; <span class="s3">ControlSpec</span>(0, 127, default: 64),</p>
81 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\midinote</span> -&gt; <span class="s3">ControlSpec</span>(0, 127, default: 60),</p>
82 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\midivelocity</span> -&gt; <span class="s3">ControlSpec</span>(1, 127, default: 64),</p>
83 <p class="p6"><br></p>
84 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\db</span> -&gt; <span class="s3">ControlSpec</span>(0.ampdb, 1.ampdb, <span class="s5">\db</span>, units: <span class="s8">" dB"</span>),</p>
85 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\amp</span> -&gt; <span class="s3">ControlSpec</span>(0, 1, <span class="s5">\amp</span>, 0, 0),</p>
86 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\boostcut</span> -&gt; <span class="s3">ControlSpec</span>(-20, 20, units: <span class="s8">" dB"</span>,default: 0),</p>
87 <p class="p6"><br></p>
88 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\pan</span> -&gt; <span class="s3">ControlSpec</span>(-1, 1, default: 0),</p>
89 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\detune</span> -&gt; <span class="s3">ControlSpec</span>(-20, 20, default: 0, units: <span class="s8">" Hz"</span>),</p>
90 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\rate</span> -&gt; <span class="s3">ControlSpec</span>(0.125, 8, <span class="s5">\exp</span>, 0, 1),</p>
91 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\beats</span> -&gt; <span class="s3">ControlSpec</span>(0, 20, units: <span class="s8">" Hz"</span>),</p>
92 <p class="p6"><br></p>
93 <p class="p5"><span class="Apple-tab-span"> </span><span class="s5">\delay</span> -&gt; <span class="s3">ControlSpec</span>(0.0001, 1, <span class="s5">\exp</span>, 0, 0.3, units: <span class="s8">" secs"</span>)</p>
94 <p class="p6"><br></p>
95 <p class="p6"><br></p>
96 </body>
97 </html>