3 var <>name, <>index, <>rate, <>defaultValue, <>argNum, <>lag;
5 *new { arg name, index, rate, defaultValue, argNum, lag;
6 ^super.newCopyArgs(name.asSymbol, index, rate, defaultValue, argNum, lag ? 0.0)
10 ^defaultValue.asArray.size;
14 stream << "ControlName P " << index.asString;
15 if (name.notNil) { stream << " " << name; };
16 if (rate.notNil) { stream << " " << rate; };
17 if (defaultValue.notNil) { stream << " " << defaultValue; };
23 Control : MultiOutUGen {
28 synthDef = UGen.buildSynthDef;
29 index = synthDef.controlIndex;
30 names = names.asArray;
32 synthDef.addControlName(
33 ControlName(name, index + i, 'control',
34 nil, synthDef.allControlNames.size)
39 ^this.multiNewList(['control'] ++ values.asArray)
42 ^this.multiNewList(['scalar'] ++ values.asArray)
44 init { arg ... argValues;
45 var ctlNames, lastControl;
47 if (synthDef.notNil) {
48 specialIndex = synthDef.controls.size;
49 synthDef.controls = synthDef.controls.addAll(values);
50 ctlNames = synthDef.controlNames;
52 if (ctlNames.size > 0) {
53 // the current control is always the last added, so:
54 lastControl = synthDef.controlNames.last;
55 if(lastControl.defaultValue.isNil) {
56 // only write if not there yet:
57 lastControl.defaultValue_(values.unbubble);
61 synthDef.controlIndex = synthDef.controlIndex + values.size;
64 ^this.initOutputs(values.size, rate)
66 *isControlUGen { ^true }
70 AudioControl : MultiOutUGen {
75 synthDef = UGen.buildSynthDef;
76 index = synthDef.controlIndex;
77 names = names.asArray;
79 synthDef.addControlName(
80 ControlName(name, index + i, 'audio',
81 nil, synthDef.allControlNames.size)
86 ^this.multiNewList(['audio'] ++ values.asArray)
88 init { arg ... argValues;
90 if (synthDef.notNil) {
91 specialIndex = synthDef.controls.size;
92 synthDef.controls = synthDef.controls.addAll(values);
93 synthDef.controlIndex = synthDef.controlIndex + values.size;
95 ^this.initOutputs(values.size, rate)
97 *isAudioControlUGen { ^true }
98 *isControlUGen { ^true }
101 TrigControl : Control {}
103 LagControl : Control {
104 *kr { arg values, lags;
107 values = values.asArray;
110 lags = lags ! values.size
115 if (values.size != lags.size, {
116 "LagControl values.size != lags.size".error;
119 values = values.clump(16);
120 lags = lags.clump(16);
122 values.size.do({ arg i;
123 outputs = outputs ++ this.multiNewList(['control'] ++ values.at(i) ++ lags.at(i));
128 ^this.shouldNotImplement(thisMethod)
130 init { arg ... stuff;
131 var lags, size, size2;
134 values = stuff[ .. size2-1];
135 inputs = stuff[size2 .. size-1];
136 if (synthDef.notNil, {
137 specialIndex = synthDef.controls.size;
138 synthDef.controls = synthDef.controls.addAll(values);
139 synthDef.controlIndex = synthDef.controlIndex + values.size;
141 ^this.initOutputs(values.size, rate)
145 AbstractIn : MultiOutUGen {
146 *isInputUGen { ^true }
150 *ar { arg bus = 0, numChannels = 1;
151 ^this.multiNew('audio', numChannels, bus)
153 *kr { arg bus = 0, numChannels = 1;
154 ^this.multiNew('control', numChannels, bus)
156 init { arg numChannels ... argBus;
157 inputs = argBus.asArray;
158 ^this.initOutputs(numChannels, rate)
162 LocalIn : AbstractIn {
163 *ar { arg numChannels = 1, default = 0.0;
164 ^this.multiNew('audio', numChannels, *default)
166 *kr { arg numChannels = 1, default = 0.0;
167 ^this.multiNew('control', numChannels, *default)
169 init { arg numChannels ... default;
170 inputs = default.wrapExtend(numChannels);
171 ^this.initOutputs(numChannels, rate)
177 *kr { arg bus = 0, numChannels = 1, lag = 0.1;
178 ^this.multiNew('control', numChannels, bus, lag)
180 init { arg numChannels ... argInputs;
181 inputs = argInputs.asArray;
182 ^this.initOutputs(numChannels, rate)
186 InFeedback : AbstractIn {
187 *ar { arg bus = 0, numChannels = 1;
188 ^this.multiNew('audio', numChannels, bus)
190 init { arg numChannels ... argBus;
191 inputs = argBus.asArray;
192 ^this.initOutputs(numChannels, rate)
196 InTrig : AbstractIn {
197 *kr { arg bus = 0, numChannels = 1;
198 ^this.multiNew('control', numChannels, bus)
200 init { arg numChannels ... argBus;
201 inputs = argBus.asArray;
202 ^this.initOutputs(numChannels, rate)
210 if (rate == 'audio', {
211 for(this.class.numFixedArgs, inputs.size - 1, { arg i;
212 if (inputs.at(i).rate != 'audio', {
213 ^(" input at index " + i +
214 "(" + inputs.at(i) + ") is not audio rate");
218 ^this.checkValidInputs
221 *isOutputUGen { ^true }
222 *numFixedArgs { ^this.subclassResponsibility(thisMethod) }
225 ^inputs.size - this.class.numFixedArgs
228 writesToBus { ^this.subclassResponsibility(thisMethod) }
232 *ar { arg bus, channelsArray;
233 channelsArray = this.replaceZeroesWithSilence(channelsArray.asArray);
234 this.multiNewList(['audio', bus] ++ channelsArray)
235 ^0.0 // Out has no output
237 *kr { arg bus, channelsArray;
238 this.multiNewList(['control', bus] ++ channelsArray.asArray)
239 ^0.0 // Out has no output
242 writesToBus { ^true }
247 *kr { ^this.shouldNotImplement(thisMethod) }
250 LocalOut : AbstractOut {
251 *ar { arg channelsArray;
252 channelsArray = this.replaceZeroesWithSilence(channelsArray.asArray);
253 this.multiNewList(['audio'] ++ channelsArray)
254 ^0.0 // LocalOut has no output
256 *kr { arg channelsArray;
257 this.multiNewList(['control'] ++ channelsArray.asArray)
258 ^0.0 // LocalOut has no output
261 writesToBus { ^false }
266 *ar { arg bus, xfade, channelsArray;
267 channelsArray = this.replaceZeroesWithSilence(channelsArray.asArray);
268 this.multiNewList(['audio', bus, xfade] ++ channelsArray)
269 ^0.0 // Out has no output
271 *kr { arg bus, xfade, channelsArray;
272 this.multiNewList(['control', bus, xfade] ++ channelsArray.asArray)
273 ^0.0 // Out has no output
277 if (rate == 'audio', {
278 for(2, inputs.size - 1, { arg i;
279 if (inputs.at(i).rate != 'audio', {
280 ^(" input at index " + i +
281 "(" + inputs.at(i) + ") is not audio rate");
285 ^this.checkValidInputs
287 writesToBus { ^true }
291 SharedOut : AbstractOut {
292 *kr { arg bus, channelsArray;
293 warn("SharedOut is deprecated and will be removed. Please use Bus-getSynchronous instead.");
294 this.multiNewList(['control', bus] ++ channelsArray.asArray)
295 ^0.0 // Out has no output
298 writesToBus { ^false }
301 SharedIn : AbstractIn {
302 *kr { arg bus = 0, numChannels = 1;
303 warn("SharedIn is deprecated and will be removed. Please use Bus-setSynchronous instead.");
304 ^this.multiNew('control', numChannels, bus)
306 init { arg numChannels ... argBus;
307 inputs = argBus.asArray;
308 ^this.initOutputs(numChannels, rate)