net.beadsproject.beads.ugens
Class Clip

java.lang.Object
  extended by net.beadsproject.beads.core.Bead
      extended by net.beadsproject.beads.core.UGen
          extended by net.beadsproject.beads.ugens.Clip
All Implemented Interfaces:
DataBeadReceiver

public class Clip
extends UGen
implements DataBeadReceiver

Clip constrains a signal within a range. The range may be defined either by static values, or by UGens. Use RangeLimiter to strictly (and more efficiently) constrain a signal in the range [-1,1].

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
Clip(AudioContext context)
          Constructor for a one-channel Clip.
Clip(AudioContext context, int channels)
          Constructor for a new Clip with the specified number of channels.
 
Method Summary
 void calculateBuffer()
          Called by the signal chain to update this UGen's ouput data.
 float getMaximum()
          Gets the current maximum value.
 UGen getMaximumUGen()
          Gets the maximum value controller UGen, if there is one.
 float getMinimum()
          Gets the current minimum value.
 UGen getMinimumUGen()
          Gets the minimum value controller UGen, if there is one.
 DataBead getParams()
          Gets a new DataBead filled with the properties "minimum" and "maximum" set to the corresponding UGen controllers, if they exist, or to static values.
 DataBead getStaticParams()
          Gets a new DataBead filled with the properties "minimum" and "maximum" set to their current values.
 DataBeadReceiver sendData(DataBead db)
          Sets the Clip parameters according to the properties "maximum" and/or "minimum" in the specified DataBead.
 Clip setMaximum(float maximum)
          Sets the maximum to a static value.
 Clip setMaximum(UGen maximumUGen)
          Sets a UGen to control the maximum value.
 Clip setMinimum(float minimum)
          Sets the minimum to a static value.
 Clip setMinimum(UGen minimumUGen)
          Sets a UGen to control the minimum value.
 Clip setRange(float minimum, float maximum)
          Sets the range.
 
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

Clip

public Clip(AudioContext context)
Constructor for a one-channel Clip.

Parameters:
context - The audio context.

Clip

public Clip(AudioContext context,
            int channels)
Constructor for a new Clip with the specified number of channels.

Parameters:
context - The audio context.
channels - The number of channels.
Method Detail

calculateBuffer

public 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

setRange

public Clip setRange(float minimum,
                     float maximum)
Sets the range.

Parameters:
minimum - The minimum value.
maximum - The maximum value.
Returns:
This Clip instance.

getMinimum

public float getMinimum()
Gets the current minimum value.

Returns:
The minimum value.

setMinimum

public Clip setMinimum(float minimum)
Sets the minimum to a static value.

Parameters:
minimum - The new minimum value.
Returns:
This Clip instance.

setMinimum

public Clip setMinimum(UGen minimumUGen)
Sets a UGen to control the minimum value.

Parameters:
minimumUGen - The minimum value controller UGen.
Returns:
This Clip instance.

getMinimumUGen

public UGen getMinimumUGen()
Gets the minimum value controller UGen, if there is one.

Returns:
The minimum value controller UGen.

getMaximum

public float getMaximum()
Gets the current maximum value.

Returns:
The maximum value.

setMaximum

public Clip setMaximum(float maximum)
Sets the maximum to a static value.

Parameters:
maximum - The new maximum value.
Returns:
This Clip instance.

setMaximum

public Clip setMaximum(UGen maximumUGen)
Sets a UGen to control the maximum value.

Parameters:
maximumUGen - The maximum value controller UGen.
Returns:
This Clip instance.

getMaximumUGen

public UGen getMaximumUGen()
Gets the maximum value controller UGen, if there is one.

Returns:
The maximum value controller UGen.

sendData

public DataBeadReceiver sendData(DataBead db)
Sets the Clip parameters according to the properties "maximum" and/or "minimum" in the specified DataBead.

Specified by:
sendData in interface DataBeadReceiver
Parameters:
db - The parameter DataBead.
Returns:
This DataBeadReceiver instance.

getParams

public DataBead getParams()
Gets a new DataBead filled with the properties "minimum" and "maximum" set to the corresponding UGen controllers, if they exist, or to static values.

Returns:
The new parameter DataBead.

getStaticParams

public DataBead getStaticParams()
Gets a new DataBead filled with the properties "minimum" and "maximum" set to their current values.

Returns:
The new DataBead.