// Plug.source can be set dynamically to an instance of UGen, ExternalControlSource,
// ControlView, Integer, Float, or anything that responds to the 'value' message
// with an Integer or Float result

Plug : UGen
 var <>source, prevSource, <>index = 0;
 
 *kr { arg source, lagTime = 0.1, index = 0;
  ^this.multiChannelPerform('kr1', source, lagTime, index)
 }
 *kr1 { arg source, lagTime = 0.1, index;
  ^super.kr1.init(source, lagTime, index)
 }  
 *ar { arg source, lagTime = 0.1, index;
  ^this.multiChannelPerform('ar1', source, lagTime, index)
 }
 *ar1 { arg source, lagTime = 0.1, index = 0;
  ^super.ar1.init(source, lagTime, index)
 }  
 init { arg argSource, lagTime, argIndex;
  source = argSource;
  inputs = lagTime;
  index = argIndex;
 }
 line { arg end=1.0, dur=1.0;
  _Plug_Line
  ^this.primitiveFailed
 }
 xline { arg end=1.0, dur=1.0;
  _Plug_XLine
  ^this.primitiveFailed
 }
 gate { arg level=1.0, dur=0.0;
  _Plug_Gate
  ^this.primitiveFailed
 }
}

ControlIn : Plug { 
 // for compatibility
}

Scope : UGen { 
 var <>view;
 
 *window { arg name, bufsize, bounds, input, minval = -1.0, maxval = 1.0;
  // builds a scope window for you.

  var scopeBuf1, scopeBuf2, wind, view;
  
  scopeBuf1 = Signal.newClear(bufsize);
  scopeBuf2 = Signal.newClear(bufsize);
  // make window
  wind = SignalWindow.new(name, bounds, scopeBuf1, Synth.sampleRate);
  
  view = wind.at(1); // get the signal view
  // Scope requires that the SignalView has an additional signal for
  // double buffering.
  view.scopeSignal = scopeBuf2;
  view.minval = minval;
  view.maxval = maxval;
  
  // wrap output with Scope ugen
  ^Scope.ar(view, input);
 }
 
 *ar { arg argSignalView, input;
  ^this.multiChannelPerform('ar1', argSignalView, input)
 }
 *ar1 { arg argSignalView, input;
  ^super.ar1.init(argSignalView, input)
 }  
 init { arg argSignalView, theInput;
  view = argSignalView;
  inputs = theInput;
 } 
}

SetTempo : UGen { 
 var <>tempoBase;
 
 *kr { arg argTempoBase, in=0.0;
  ^this.multiChannelPerform('kr1', argTempoBase, in)
 }
 *kr1 { arg argTempoBase, in=0.0;
  ^super.kr1.init(argTempoBase, in)
 }  
 init { arg argTempoBase, theInput;
  tempoBase = argTempoBase;
  inputs = theInput;
 }
}

GetTempo : UGen { 
 
 *kr {
  ^super.kr1
 }
}


This page was created by SimpleText2Html 1.0.3 on 22-Feb-100.