polymorphism: better names for .binaryValue and .booleanValue are .asInteger and...
[supercollider.git] / Help / Libraries / JITLib / Patterns / PbindProxy.html
blob4c59f2bd57621d8ecf49e36c39d3cf1cdd52aa01
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.42">
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}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #a71e12}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #a71e12; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0019b7}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #326e17}
18 span.s1 {font: 18.0px Helvetica}
19 span.s2 {font: 9.0px Monaco}
20 span.s3 {color: #326e17}
21 span.s4 {color: #0019b7}
22 span.s5 {color: #5f5f5f}
23 span.s6 {color: #000000}
24 span.Apple-tab-span {white-space:pre}
25 </style>
26 </head>
27 <body>
28 <p class="p1"><span class="s1"><b>PbindProxy</b></span><span class="s2"> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><b>incremental event pattern reference</b></p>
29 <p class="p2"><br></p>
30 <p class="p1">superclass: Pattern</p>
31 <p class="p2"><br></p>
32 <p class="p2"><br></p>
33 <p class="p2"><br></p>
34 <p class="p2"><br></p>
35 <p class="p1">keeps a reference to a Pbind in which single keys can be replaced.</p>
36 <p class="p1">It plays on when the old stream ended and a new stream is set and schedules the changes to the beat.</p>
37 <p class="p2"><br></p>
38 <p class="p1">related [<b>Pbindef</b>][<b>Pdef</b>]</p>
39 <p class="p2"><br></p>
40 <p class="p2"><br></p>
41 <p class="p2"><br></p>
42 <p class="p1"><b>*new(key1, pattern1, key2, pattern2, ... )</b></p>
43 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>create a new instance of PbindProxy with the given patternpairs</p>
44 <p class="p2"><br></p>
45 <p class="p1"><b>source</b></p>
46 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns the wrapper for the Pbind</p>
47 <p class="p2"><br></p>
48 <p class="p2"><br></p>
49 <p class="p1"><b>set(key1, pattern1, key2, pattern2, ... )</b></p>
50 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>set the given patternpairs.</p>
51 <p class="p2"><br></p>
52 <p class="p1"><b>at(key)</b></p>
53 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>return a pattern at that key. this can be used to set quant value individually,</p>
54 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>so different elementary patterns can be quantized differently.</p>
55 <p class="p2"><br></p>
56 <p class="p3"><span class="Apple-tab-span"> </span>x.at(<span class="s3">\freq</span>).quant = 2;</p>
57 <p class="p4"><br></p>
58 <p class="p4"><br></p>
59 <p class="p4"><br></p>
60 <p class="p1"><b>quant_(val)</b></p>
61 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>set the quant of all elementary patterns</p>
62 <p class="p2"><br></p>
63 <p class="p2"><br></p>
64 <p class="p1"><b>quant</b></p>
65 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>return the quant value of the source pattern</p>
66 <p class="p2"><br></p>
67 <p class="p2"><br></p>
68 <p class="p5">// example:</p>
69 <p class="p6"><br></p>
70 <p class="p3">(</p>
71 <p class="p3"><span class="s4">SynthDef</span>(<span class="s5">"Pdefhelp"</span>, { <span class="s4">arg</span> out, freq, sustain=1, amp=1, pan;</p>
72 <p class="p3"><span class="s4">var</span> env, u=1;</p>
73 <p class="p3">env = <span class="s4">EnvGen</span>.kr(<span class="s4">Env</span>.perc(0.03, sustain), 1, doneAction:2);</p>
74 <p class="p3">5.do { <span class="s4">var</span> d; d = exprand(0.01, 1); u = <span class="s4">SinOsc</span>.ar(d * 300, u, rrand(0.1,1.2) * d, 1) };</p>
75 <p class="p3"><span class="s4">Out</span>.ar(out, <span class="s4">Pan2</span>.ar(<span class="s4">SinOsc</span>.ar(u + 1 * freq, 0, amp * env), pan));</p>
76 <p class="p4"><br></p>
77 <p class="p3">}).store;</p>
78 <p class="p3">)</p>
79 <p class="p3">s.boot;</p>
80 <p class="p4"><br></p>
81 <p class="p4"><br></p>
82 <p class="p7"><span class="s6">x = </span>PbindProxy<span class="s6">.new;</span></p>
83 <p class="p8"><span class="s6">x.set(</span>\instrument<span class="s6">, </span>\Pdefhelp<span class="s6">);</span></p>
84 <p class="p4"><br></p>
85 <p class="p3">x.play;</p>
86 <p class="p4"><br></p>
87 <p class="p3">x.set(<span class="s3">\degree</span>, <span class="s4">Pseq</span>([0, 2, 5b, 1b], <span class="s4">inf</span>));</p>
88 <p class="p3">x.set(<span class="s3">\dur</span>, 0.1);</p>
89 <p class="p3">x.set(<span class="s3">\degree</span>, <span class="s4">Pseq</span>([1b, 5, 3, 1b, 6, 2, 5, 0, 3, 0, 2], <span class="s4">inf</span>));</p>
90 <p class="p3">x.set(<span class="s3">\legato</span>, <span class="s4">Prand</span>([1.0, 2.4, 0.2], <span class="s4">inf</span>), <span class="s3">\mtranspose</span>, -3);</p>
91 <p class="p5"><span class="s6">x.set(</span><span class="s3">\mtranspose</span><span class="s6">, </span><span class="s4">nil</span><span class="s6">); </span>// remove key</p>
92 <p class="p6"><br></p>
93 <p class="p3">x.set(<span class="s3">\degree</span>, <span class="s4">Pseq</span>([1, 2, 3, 4, 5, 6], 1));</p>
94 <p class="p3">x.play;</p>
95 <p class="p4"><br></p>
96 <p class="p3">x.set( <span class="s3">\degree</span>, <span class="s4">Pseq</span>([1, 2, 3, 4, 5, 6], 3), <span class="s3">\dur</span>, 0.02);</p>
97 <p class="p3">x.play;</p>
98 <p class="p4"><br></p>
99 <p class="p3">x.set(<span class="s3">\degree</span>, <span class="s4">Pseq</span>([1, 2, 3, 4, 5, 6], 3), <span class="s3">\dur</span>, 0.1);</p>
100 <p class="p3">x.play;</p>
101 <p class="p4"><br></p>
102 <p class="p4"><br></p>
103 <p class="p5">// embed in other patterns:</p>
104 <p class="p5">(</p>
105 <p class="p3">x.set(<span class="s3">\degree</span>, <span class="s4">Pseq</span>([1b, 5, 3, 1b, 6, 2, 5, 0, 3, 0, 2], <span class="s4">inf</span>));</p>
106 <p class="p7">Ppar<span class="s6">([</span></p>
107 <p class="p3">x,</p>
108 <p class="p8"><span class="s4">Pbindf</span><span class="s6">(x, </span>\ctranspose<span class="s6">, 4)</span></p>
109 <p class="p3">]).play;</p>
110 <p class="p5">)</p>
111 <p class="p6"><br></p>
112 <p class="p6"><br></p>
113 <p class="p3">x.set(<span class="s3">\degree</span>, <span class="s4">Pseq</span>([1b, 5, 1b, 4, 0], <span class="s4">inf</span>), <span class="s3">\dur</span>, 0.4);</p>
114 <p class="p4"><br></p>
115 <p class="p4"><br></p>
116 <p class="p4"><br></p>
117 </body>
118 </html>