ddf.minim.ugens
Class Summer

java.lang.Object
  extended by ddf.minim.ugens.UGen
      extended by ddf.minim.ugens.Summer
All Implemented Interfaces:
AudioSignal

public class Summer
extends UGen
implements AudioSignal

A Summer allows you to sum the outputs of multiple UGens to be sent further down the chain. Unlike most UGen effects, you can patch more than one UGen to a Summer.

Author:
Damien Di Fede

Nested Class Summary
 
Nested classes/interfaces inherited from class ddf.minim.ugens.UGen
UGen.InputType, UGen.UGenInput
 
Constructor Summary
Summer()
          Constructs a Summer that you can patch multiple UGens to.
Summer(AudioOutput output)
          Don't use this constructor, it won't stay public.
 
Method Summary
protected  void addInput(UGen input)
          If you want to do something other than the default behavior when your UGen is patched to, you can override this method in your derived class.
 void generate(float[] mono)
          Generates a buffer of samples by ticking this UGen mono.length times.
 void generate(float[] left, float[] right)
          Fills left and right with values in the range of [-1, 1].
protected  void removeInput(UGen input)
          If you need to do something specific when something is unpatched from your UGen, you can override this method.
protected  void sampleRateChanged()
          Override this method in your derived class to receive a notification when the sample rate of your UGen has changed.
protected  void uGenerate(float[] channels)
          Implement this method when you extend UGen.
 
Methods inherited from class ddf.minim.ugens.UGen
getLastValues, patch, patch, patch, printInputs, sampleRate, setSampleRate, tick, unpatch, unpatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Summer

public Summer()
Constructs a Summer that you can patch multiple UGens to.


Summer

public Summer(AudioOutput output)
Don't use this constructor, it won't stay public.

Parameters:
output -
Method Detail

addInput

protected void addInput(UGen input)
Description copied from class: UGen
If you want to do something other than the default behavior when your UGen is patched to, you can override this method in your derived class. Summer, for instance, keeps a list of all the UGens that have been patched to it, so that it can tick them and sum the results when it uGenerates.

Overrides:
addInput in class UGen

removeInput

protected void removeInput(UGen input)
Description copied from class: UGen
If you need to do something specific when something is unpatched from your UGen, you can override this method.

Overrides:
removeInput in class UGen

sampleRateChanged

protected void sampleRateChanged()
Description copied from class: UGen
Override this method in your derived class to receive a notification when the sample rate of your UGen has changed. You might need to do this to recalculate sample rate dependent values, such as the step size for an oscillator.

Overrides:
sampleRateChanged in class UGen

uGenerate

protected void uGenerate(float[] channels)
Description copied from class: UGen
Implement this method when you extend UGen. It will be called when your UGen needs to generate one sample frame of audio. It is expected that you will assign values to the array and not simply modify the existing values. In the case where you write a UGen that takes audio input and modifies it, the pattern to follow is to have the first UGenInput you create be your audio input and then in uGenerate you will use the getLastValues method of your audio UGenInput to retrieve the audio you want to modify, which you will then modify however you need to, assigning the result to the values in channels.

Specified by:
uGenerate in class UGen
Parameters:
channels - an array representing one sample frame.

generate

public void generate(float[] mono)
Generates a buffer of samples by ticking this UGen mono.length times. Like the tick method, this will result in all of the

Specified by:
generate in interface AudioSignal
Parameters:
mono - the float array to fill

generate

public void generate(float[] left,
                     float[] right)
Description copied from interface: AudioSignal
Fills left and right with values in the range of [-1, 1]. left represents the left channel of a stereo signal, right represents the right channel of that same stereo signal.

Specified by:
generate in interface AudioSignal
Parameters:
left - the left channel
right - the right channel