class library: DUGen - the server now handles audio-rate inputs correctly
[supercollider.git] / SCClassLibrary / Common / Audio / AudioIn.sc
blobe3c75f85225f47f580a698a64abfd7ae41dee78f
1 SoundIn  {
3         *ar { arg bus = 0, mul=1.0, add=0.0;
4                 var chanOffset;
5                 chanOffset = this.channelOffset;
6                 if(bus.isArray.not,{
7                         ^In.ar(chanOffset + bus, 1).madd(mul,add)
8                 });
10                 // check to see if channels array is consecutive [n,n+1,n+2...]
11                 if(bus.every({arg item, i;
12                                 (i==0) or: {item == (bus.at(i-1)+1)}
13                         }),{
14                         ^In.ar(chanOffset + bus.first, bus.size).madd(mul,add)
15                 },{
16                         // allow In to multi channel expand
17                         ^In.ar(chanOffset + bus).madd(mul,add)
18                 })
19         }
21         *channelOffset {
22                 ^NumOutputBuses.ir
23         }
26 // backward compatible version. Only difference: starts counting from channel 1
28 AudioIn : SoundIn  {
29         *ar { arg channel = 0, mul=1.0, add=0.0;
30                 ^super.ar(channel, mul, add)
31         }
32         *channelOffset {
33                 ^NumOutputBuses.ir - 1
34         }