polymorphism: better names for .binaryValue and .booleanValue are .asInteger and...
[supercollider.git] / Help / Collections / Event_types.html
blob1ef852484d461902f2e2f02ea714d91eea8b79a6
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.54">
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 46.0px; text-indent: -46.0px; font: 12.0px Helvetica}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #ad140d}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Monaco; min-height: 17.0px}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 152.0px; text-indent: -152.0px; font: 9.0px Monaco}
19 span.s1 {font: 18.0px Helvetica}
20 span.s2 {font: 13.0px Helvetica}
21 span.s3 {color: #001bb9}
22 span.s4 {color: #2c7014}
23 span.s5 {text-decoration: underline ; color: #001bb9}
24 span.s6 {font: 12.0px Monaco}
25 span.s7 {font: 9.0px Monaco}
26 span.s8 {color: #000000}
27 span.s9 {color: #ad140d}
28 span.Apple-tab-span {white-space:pre}
29 </style>
30 </head>
31 <body>
32 <p class="p1"><span class="s1"><b>Event types<span class="Apple-tab-span"> </span></b></span><span class="s2"><b><span class="Apple-tab-span"> </span></b></span><b>Different ways that an Event can "play"</b></p>
33 <p class="p2"><br></p>
34 <p class="p1"><b>Note: this helpfile is incomplete.</b></p>
35 <p class="p2"><br></p>
36 <p class="p1">An <a href="Event.html"><span class="s3">Event</span></a> responds to a play message by evaluating ~play in the event, and the default behaviour of ~play is determined by the value of ~type. Commonly-used event types include:</p>
37 <p class="p2"><br></p>
38 <p class="p3"><b>\note</b> - used to instantiate a synth on the server, with specified arguments, and later to free it. The choice of <a href="../ServerArchitecture/SynthDef.html"><span class="s3">SynthDef</span></a> is specified using the <span class="s4">\instrument</span> key. This event type is commonly implicit in much <a href="../Streams-Patterns-Events/Patterns/Pattern.html"><span class="s3">Pattern</span></a> usage.<span class="Apple-converted-space"> </span></p>
39 <p class="p3"><b>\set</b> - used to set parameters of some already-running node(s). (See also: note in <a href="../Streams-Patterns-Events/Patterns/Pmono.html"><span class="s5">Pmono</span></a> helpfile)</p>
40 <p class="p2"><br></p>
41 <p class="p1">A more complete list of event types is given further down this document. To see how event types are normally invoked, here is a slightly simplified version of the default definition of<span class="Apple-converted-space">  </span><span class="s6">~play</span> as defined in the Event class:</p>
42 <p class="p2"><br></p>
43 <p class="p4"><span class="Apple-tab-span"> </span>{ <span class="Apple-tab-span"> </span>~eventTypes[~type].value(server); },</p>
44 <p class="p5"><br></p>
45 <p class="p1">The function uses the value of <span class="s7">~</span><span class="s6">type</span><span class="s7"> </span>to select a function from the <a href="Dictionary.html"><span class="s3">Dictionary</span></a> held in <span class="s7">~</span><span class="s6">eventTypes</span><span class="s7">.</span> The collection of eventTypes can be readily extended using <b>*addEventType(key, function)</b>. <span class="Apple-converted-space"> </span></p>
46 <p class="p2"><br></p>
47 <p class="p1">Here is an example the uses the event types<span class="Apple-converted-space">  </span><span class="s6">\group </span>and<span class="s6"> \note</span>:</p>
48 <p class="p2"><br></p>
49 <p class="p6"><span class="s8"><span class="Apple-tab-span"> </span>(type: </span><span class="s4">\group</span><span class="s8">, id: 2).play<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>// create a group with nodeID 2</p>
50 <p class="p4"><span class="Apple-tab-span"> </span>(type: <span class="s4">\note</span>, freq: 500, group: 2).play<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s9">// play a synth in that group</span></p>
51 <p class="p2"><br></p>
52 <p class="p2"><br></p>
53 <p class="p1">Here is a listing of currently existing event types:</p>
54 <p class="p7"><br></p>
55 <p class="p4"><span class="Apple-converted-space"> </span>group<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>creates group, ~id must be specified</p>
56 <p class="p4"><span class="Apple-converted-space"> </span>note<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>~instrument specifies synthdef</p>
57 <p class="p4"><span class="Apple-converted-space"> </span>note_score<span class="Apple-tab-span"> </span></p>
58 <p class="p4"><span class="Apple-converted-space"> </span>midi</p>
59 <p class="p8"><span class="Apple-converted-space"> </span></p>
60 <p class="p4"><span class="Apple-converted-space"> </span>monoNote<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>used by Pmono</p>
61 <p class="p4"><span class="Apple-converted-space"> </span>monoSet<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>used by Pmono</p>
62 <p class="p4"><span class="Apple-converted-space"> </span>monoOff<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>
63 <p class="p8"><span class="Apple-converted-space"> </span></p>
64 <p class="p4"><span class="Apple-converted-space"> </span>on<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>play synth, ~id must be specified</p>
65 <p class="p4"><span class="Apple-converted-space"> </span>off <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>release synth (or free if no gate)</p>
66 <p class="p4"><span class="Apple-converted-space"> </span>kill<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>free synth</p>
67 <p class="p4"><span class="Apple-converted-space"> </span>set<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>set parameter of synth</p>
68 <p class="p8"><span class="Apple-converted-space"> </span></p>
69 <p class="p4"><span class="Apple-converted-space"> </span>rest<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>do nothing</p>
70 <p class="p8"><span class="Apple-converted-space"> </span></p>
71 <p class="p8"><span class="Apple-converted-space"> </span></p>
72 <p class="p4"><span class="Apple-converted-space"> </span>bus<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>write ~array to control buses starting at ~out</p>
73 <p class="p8"><span class="Apple-converted-space"> </span></p>
74 <p class="p4"><span class="Apple-converted-space"> </span>alloc<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>allocate ~bufnum with ~numframes and ~numchannels</p>
75 <p class="p4"><span class="Apple-converted-space"> </span>free<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>free ~bufnum</p>
76 <p class="p4"><span class="Apple-converted-space"> </span>gen<span class="Apple-tab-span"> </span><span class="Apple-converted-space">    <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>send ~gencmd to ~bufnum</p>
77 <p class="p4"><span class="Apple-converted-space"> </span>load<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>load ~filename starting at ~frame into ~bufnum</p>
78 <p class="p4"><span class="Apple-converted-space"> </span>read</p>
79 <p class="p8"><span class="Apple-converted-space"> </span></p>
80 <p class="p4"><span class="Apple-converted-space"> </span>setProperties<span class="Apple-converted-space">  </span>~receiver, ~args<span class="Apple-converted-space"> </span></p>
81 <p class="p9"><span class="Apple-converted-space"> <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>sends setter messages to ~receiver for each key in ~args that has a nonNil value in the Event.</p>
82 <p class="p9"><span class="Apple-converted-space"> </span>tree<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>creates a tree of groups. ~tree can be an array of nodeIDs, and may contain associations to further nested arrays.</p>
83 <p class="p8"><span class="Apple-converted-space"> </span></p>
84 <p class="p9"><span class="Apple-converted-space"> </span>phrase<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>instead of playing a single synth from a SynthDef with ~instrument, it looks up a <a href="../Libraries/JITLib/Patterns/Pdef.html"><span class="s3">Pdef</span></a> and plays a cluster of sounds.</p>
85 <p class="p8"><span class="Apple-converted-space"> </span></p>
86 <p class="p8"><span class="Apple-converted-space"> </span></p>
87 </body>
88 </html>