net.beadsproject.beads.core
Class UGenChain

java.lang.Object
  extended by net.beadsproject.beads.core.Bead
      extended by net.beadsproject.beads.core.UGen
          extended by net.beadsproject.beads.core.UGenChain
Direct Known Subclasses:
MultiWrapper, Reverb

public class UGenChain
extends UGen

Organizes a series of connected UGens into one unit. It allows for users to define a custom UGen purely from other UGens, without programming the UGen.calculateBuffer() routine.

Version:
0.9.5
Author:
Benito Crawford

Nested Class Summary
 
Nested classes/interfaces inherited from class net.beadsproject.beads.core.UGen
UGen.OutputInitializationRegime, UGen.OutputPauseRegime
 
Field Summary
 
Fields inherited from class net.beadsproject.beads.core.UGen
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
 
Constructor Summary
UGenChain(AudioContext context, int ins, int outs)
           
 
Method Summary
 void addToChainOutput(int chainOutputIndex, UGen sourceUGen)
          Adds all of the outputs of a source UGen to a Chain output.
 void addToChainOutput(int chainOutputIndex, UGen sourceUGen, int sourceOutputIndex)
          Adds an output from a source UGen to a Chain output.
 void addToChainOutput(UGen sourceUGen)
          Adds the output of a source UGen to the Chain output.
 void calculateBuffer()
          Called by the signal chain to update this UGen's ouput data.
 void drawFromChainInput(int chainInputIndex, UGen targetUGen)
          Adds the specified Chain input to all of a target UGen's inputs.
 void drawFromChainInput(int chainInputIndex, UGen targetUGen, int targetInputIndex)
          Adds the specified Chain input to a target UGen's input.
 void drawFromChainInput(UGen targetUGen)
          Adds the Chain inputs to the target UGen's inputs.
protected  void postFrame()
          Called after the signal chain is updated for this Chain.
protected  void preFrame()
          Called before the signal chain is updated for this Chain.
 
Methods inherited from class net.beadsproject.beads.core.UGen
addDependent, addInput, addInput, clearDependents, clearInputConnections, containsInput, crossfadeInput, getConnectedInputs, getContext, getEnvelopes, getIns, getNumberOfConnectedUGens, getNumberOfDependents, getOutBuffer, getOuts, getTimeTakenLastUpdate, getValue, getValue, getValueDouble, getValueDouble, initializeOuts, isTimerMode, isUpdated, noInputs, pause, printInBuffers, printInputList, printOutBuffers, removeAllConnections, removeConnection, removeDependent, setOutsToPause, setTimerMode, setValue, update, zeroIns, zeroOuts
 
Methods inherited from class net.beadsproject.beads.core.Bead
getKillListener, getName, isDeleted, isPaused, kill, message, messageReceived, setKillListener, setName, start, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UGenChain

public UGenChain(AudioContext context,
                 int ins,
                 int outs)
Method Detail

drawFromChainInput

public void drawFromChainInput(UGen targetUGen)
Adds the Chain inputs to the target UGen's inputs.

Parameters:
targetUGen - The target UGen.

drawFromChainInput

public void drawFromChainInput(int chainInputIndex,
                               UGen targetUGen)
Adds the specified Chain input to all of a target UGen's inputs.

Parameters:
chainInputIndex - The index of the Chain input.
targetUGen - The UGen to which to add the Chain input.

drawFromChainInput

public void drawFromChainInput(int chainInputIndex,
                               UGen targetUGen,
                               int targetInputIndex)
Adds the specified Chain input to a target UGen's input.

Parameters:
chainInputIndex - The index of the Chain input.
targetUGen - The target UGen to which to add the Chain input.
targetInputIndex - The input of the target UGen.

addToChainOutput

public void addToChainOutput(UGen sourceUGen)
Adds the output of a source UGen to the Chain output.

Parameters:
sourceUGen - The source UGen.

addToChainOutput

public void addToChainOutput(int chainOutputIndex,
                             UGen sourceUGen)
Adds all of the outputs of a source UGen to a Chain output.

Parameters:
chainOutputIndex - The Chain output.
sourceUGen - The source UGen.

addToChainOutput

public void addToChainOutput(int chainOutputIndex,
                             UGen sourceUGen,
                             int sourceOutputIndex)
Adds an output from a source UGen to a Chain output.

Parameters:
chainOutputIndex - The Chain output.
sourceUGen - The source UGen.
sourceOutputIndex - The output of the source UGen to add to the Chain output.

calculateBuffer

public final void calculateBuffer()
Description copied from class: UGen
Called by the signal chain to update this UGen's ouput data. Subclassses of UGen should implement the UGen's DSP perform routine here. In general this involves grabbing data from UGen.bufIn and putting data into UGen.bufOut in some way. UGen.bufIn and UGen.bufOut are 2D arrays of floats of the form float[numChannels][bufferSize]. The length of the buffers is given by UGen.bufferSize, and the number of channels of the input and output buffers are given by UGen.ins and UGen.outs respectively.

Specified by:
calculateBuffer in class UGen

preFrame

protected void preFrame()
Called before the signal chain is updated for this Chain. Does nothing by default; can be implemented with code as needed.


postFrame

protected void postFrame()
Called after the signal chain is updated for this Chain. Does nothing by default; can be implemented with code as needed.