3 var reducedArray = array.asArray.clump(4);
4 var mixedArray = reducedArray.collect {|a|
16 if (mixedArray.size < 3) {
20 if (mixedArray.size == 3) {
27 // support this common idiom
28 *fill { arg n, function;
29 var array = Array.fill(n, function);
33 // and these common idioms
35 var result = this.new(array);
38 { \control } { K2A.ar(result) }
39 { \scalar } { DC.ar(result) }
40 { Error("Unsupported rate % for Mix.ar".format(result.rate)).throw };
45 // 'rate' on an array returns the fastest rate
46 // ('audio' takes precedence over 'control' over 'scalar')
47 if(array.rate == \audio) {
48 "Audio rate input(s) to Mix.kr will result in signal degradation.".warn;
50 if(unit.rate == \audio) {
51 (unit + unit.rate).postln;
55 array = array.collect { |unit|
56 if(unit.rate == \audio) { A2K.kr(unit) } { unit };
59 result = this.new(array);
61 { \control } { result }
62 { \scalar } { DC.kr(result) }
63 { Error("Unsupported rate % for Mix.kr".format(result.rate)).throw };
66 *arFill { |n, function|
67 ^this.ar(Array.fill(n, function))
70 *krFill { |n, function|
71 ^this.kr(Array.fill(n, function))
78 *ar { arg input, numChannels = 2, mixdown = true;
80 if(input.size > 1) { // collection
82 .clump(input.size / numChannels)
83 .collect { arg chan, i;
95 // single ugen or single item collection
96 if(input.isSequenceableCollection) {
100 if(numChannels == 1) {
103 ^Array.fill(numChannels, input)