linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Select.schelp
blobe870f1416b4efecd22780d3e5ed69e7ef31eafbb
1 class:: Select
2 summary:: Select output from an array of inputs.
3 categories:: UGens>Multichannel>Select
5 Description::
6 The output is selected from an array of inputs.
8 note:: All the UGens are continously running. This may not be the most efficient
9 way if each input is CPU-expensive. ::
11 Note that the array is fixed at the time of writing the SynthDef, and the
12 whole array is embedded in the SynthDef file itself.  For small arrays
13 this is more efficient than reading from a buffer.
16 classmethods::
18 method::ar, kr
20 argument::which
22 Integer index
25 argument::array
27 Input array of signals
30 Examples::
32 code::
34 SynthDef("help-Select",{ arg out=0;
36         var a,cycle;
37         a = [
38                         SinOsc.ar,
39                         Saw.ar,
40                         Pulse.ar
41                 ];
42         cycle = a.size  * 0.5;
43         Out.ar(out,
44                 Select.ar(LFSaw.kr(1.0,0.0,cycle,cycle),a) * 0.2
45         )
46 }).play;
50 //Here used as a sequencer:
52 SynthDef("help-Select-2",{ arg out=0;
54         var a,s,cycle;
55         a = Array.fill(32,{ rrand(30,80) }).midicps;
56         a.postln;
57         cycle = a.size  * 0.5;
59         s = Saw.ar(
60                         Select.kr(
61                                 LFSaw.kr(1.0,0.0,cycle,cycle),
62                                 a
63                         ),
64                         0.2
65         );
66         Out.ar(out,s )
67 }).play;