Hi,
channel numbers and array sizes in compiled synthdefs are fix.
It's one of the most common misconceptions and questions that people want to have such a number as a (control!) input. It is not possible, it would demand to change the architecture of the synthdef on the fly.
However there are workarounds, one is to define the SynthDef for maximum sizes.
In the case of PlayBuf you would always get an error message with a smaller channel number.
(
b = Buffer.read(s, Platform.resourceDir +/+ "sounds" +/+ "a11wlk01.wav");
c = Buffer.read(s, Platform.resourceDir +/+ "sounds" +/+ "SinedPink.aiff");
)
b.plot;
c.plot;
(
SynthDef(\allPlayer2_test, { |buf|
var sig = PlayBuf.ar(2, buf, 1, 1, 0, 0, 2);
Out.ar(0, sig)
}).add
)
// play stereo and mono example
// the error message in the mono case is irrelevant
Synth(\allPlayer2_test, [\buf, c])
Synth(\allPlayer2_test, [\buf, b])
A different kind of workaround would be this:
Write SynthDefs for different buffer channel numbers (can be done with a Function, that produces SynthDefs with names \player_1, \player_2 etc.) and call the Synth with a Function that checks the buffer size and selects the SynthDef accordingly.
Greetings
Daniel
-----------------------------
http://daniel-mayer.at-----------------------------
_______________________________________________
sc-users mailing list
info (subscription, etc.):
http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspxarchive:
https://listarc.bham.ac.uk/marchives/sc-users/search:
https://listarc.bham.ac.uk/lists/sc-users/search/