I have a SynthDef receiving an audio bus as input with multiple channels.
How can I retrieve the number of channels of that bus within the SynthDef itself ?
//~unmixed=Bus.audio(s,10);
~count=5;
~unmixed=Bus.audio(s,2*~count);
SynthDef(\mixAll, { |in, count=10, out=0|
// var all=in.ar; // ERROR: Message 'ar' not understood. RECEIVER: an OutputProxy
// var c=in.numChannels; // returns 1
// var c=count*2; // ERROR: Non Boolean in test, RECEIVER: a BinaryOpUGen
// var c=~count*2; // required an external variable :-(
var c=20; // hardcoded :-(
// Reading the right number of channels from the input bus
var all=In.ar(in,c);
// Some future processing
// ...
// Mixing it all
Out.ar(out,Mix.ar(all)*0.5);
}).add;
//~mixall=Synth(\mixAll, [\in, ~unmixed, \out, 0, \count, ~count]);
~mixall=Synth(\mixAll, [\in, ~unmixed, \out, 0]);
)