SCDoc: Use proper static string constants instead of comparing string literals.
[supercollider.git] / Help / Control / CCResponder.html
blob8f441caa0edceef70e640206c2619fccea9c5ff6
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="824.48">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0018e8}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 29.0px; text-indent: -29.0px; font: 12.0px Helvetica}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
19 p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
20 p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; min-height: 14.0px}
21 p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000}
22 p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
23 p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #1a32a0}
24 span.s1 {color: #000000}
25 span.s2 {text-decoration: underline}
26 span.s3 {color: #0000bf}
27 span.Apple-tab-span {white-space:pre}
28 </style>
29 </head>
30 <body>
31 <p class="p1"><b>CCResponder</b></p>
32 <p class="p2"><br></p>
33 <p class="p3"><span class="s1">see also <a href="SC://MIDIResponder"><span class="s2">MIDIResponder</span></a></span></p>
34 <p class="p2"><br></p>
35 <p class="p4"><b>CCResponder(function, src, chan, num, value, install = true,swallowEvent = false)</b></p>
36 <p class="p5"><br></p>
37 <p class="p4"><b>src</b></p>
38 <p class="p6"><span class="Apple-tab-span"> </span>The src number may be the system UID (obtained from MIDIClient.sources[index].uid)<span class="Apple-converted-space"> </span></p>
39 <p class="p6"><span class="Apple-tab-span"> </span>or the index of the source in the MIDIClient.sources array.</p>
40 <p class="p6"><span class="Apple-tab-span"> </span>nil matches all</p>
41 <p class="p4"><b>chan</b></p>
42 <p class="p4"><span class="Apple-tab-span"> </span>0 .. 15</p>
43 <p class="p4"><span class="Apple-tab-span"> </span>nil matches all</p>
44 <p class="p4"><b>num</b></p>
45 <p class="p4"><span class="Apple-tab-span"> </span>0 .. 127</p>
46 <p class="p4"><span class="Apple-tab-span"> </span>nil matches all</p>
47 <p class="p4"><b>value</b></p>
48 <p class="p4"><span class="Apple-tab-span"> </span>0 .. 127</p>
49 <p class="p4"><span class="Apple-tab-span"> </span>nil matches all</p>
50 <p class="p5"><br></p>
51 <p class="p4">any of these may also be a function which will be evaluated to determine the match:</p>
52 <p class="p4"><span class="Apple-tab-span"> </span>eg: { |val| val &lt; 50 }</p>
53 <p class="p5"><span class="Apple-tab-span"> </span></p>
54 <p class="p7">(</p>
55 <p class="p8"><span class="s1"><span class="Apple-tab-span"> </span>c = CCResponder({ |src,chan,num,value|</p>
56 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[src,chan,num,value].postln;</p>
57 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>},</p>
58 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">nil</span>, // any source</p>
59 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">nil</span>, // any channel</p>
60 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">nil</span>, // any CC number</p>
61 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">nil</span> // any value</p>
62 <p class="p9"><span class="Apple-tab-span"> </span>)</p>
63 <p class="p7">)</p>
64 <p class="p2"><br></p>
65 <p class="p7">c.remove</p>
66 <p class="p2"><br></p>
67 <p class="p2"><br></p>
68 <p class="p7">(</p>
69 <p class="p8"><span class="s1"><span class="Apple-tab-span"> </span>c = CCResponder({ |src,chan,num,value|</p>
70 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[src,chan,num,value].postln;</p>
71 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>},</p>
72 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">nil</span>, // any source</p>
73 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">nil</span>, // any channel</p>
74 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>80, // CC number 80</p>
75 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>{ <span class="s3">|val|</span> val &lt; 50 } // any value less than 50</p>
76 <p class="p9"><span class="Apple-tab-span"> </span>)</p>
77 <p class="p7">)</p>
78 <p class="p2"><br></p>
79 <p class="p7">c.remove</p>
80 <p class="p2"><br></p>
81 <p class="p11"><b></b><br></p>
82 <p class="p12"><b>learn</b></p>
83 <p class="p2"><br></p>
84 <p class="p12">wait for the next CC message, reset to match src,chan, cc num</p>
85 <p class="p7">(</p>
86 <p class="p13"><br></p>
87 <p class="p8"><span class="s1"><span class="Apple-tab-span"> </span>c = CCResponder({ |src,chan,num,value|</p>
88 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[src,chan,num,value].postln;</p>
89 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
90 <p class="p10"><span class="s1"><span class="Apple-tab-span"> </span>c.learn; // wait for the first controller</p>
91 <p class="p7">)</p>
92 <p class="p14">CCResponder.removeAll</p>
93 <p class="p2"><br></p>
94 <p class="p5"><br></p>
95 </body>
96 </html>