linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Pindex.schelp
blob57d6b5bac4cec3ebecf8c968a39c1cb52735629b
1 class:: Pindex
2 summary:: pattern that indexes into an array
3 related:: Classes/Pswitch
4 categories:: Streams-Patterns-Events>Patterns>List>Indexing
6 description::
8 This allows an link::Classes/ArrayedCollection:: to be accessed within patterns.
10 ClassMethods::
12 method::new
14 argument::list
15 is the array and strong::index:: the value to retrieve - both of these arguments can themselves be link::Classes/Pattern::s.
17 argument::repeats
18 specifies the number of repeats.
20 Examples::
22 code::
24 SynthDef(\help_pindex, { | out, amp=0.1, freq=440, gate=1 |
25         var son = Saw.ar(freq * [0.99, 1, 1.01]).mean;
26         son = son * EnvGen.ar(Env.adsr, gate: gate, doneAction:2);
27         Out.ar(out, son.dup * amp);
28 }).add;
32 var data = [7, 13, 12, 2, 2, 2, 5];
33 var indices = [0, 0, 2, 0, 4, 6, 7];
34 Pbind(
35         \instrument, \help_pindex,
36         \choice, Prand(indices, inf),
37         \degree, Pindex(data, Pkey(\choice), inf),
38         \dur, 0.7
39 ).play