public class WaveShaper extends UGen implements DataBeadReceiver
preGain
.postGain
.-limit
and limit
.wetMix
. (1 is none of the original signal; 0 is only the
original signal.)
This UGen is a DataBeadReceiver
, so you can set its parameters with a
DataBead.
UGen.OutputInitializationRegime, UGen.OutputPauseRegime
Modifier and Type | Field and Description |
---|---|
protected int |
channels |
protected boolean |
isLimitStatic |
protected boolean |
isPostGainStatic |
protected boolean |
isPreGainStatic |
protected boolean |
isWetMixStatic |
protected float |
limit |
protected UGen |
limitUGen |
protected float |
postGain |
protected UGen |
postGainUGen |
protected float |
preGain |
protected UGen |
preGainUGen |
protected float[] |
shape |
protected int |
shapeLen |
protected float |
wetMix |
protected UGen |
wetMixUGen |
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
Constructor and Description |
---|
WaveShaper(AudioContext context)
Constructor for a mono-channel wave shaper that uses a default
cosine-based wave shape.
|
WaveShaper(AudioContext context,
Buffer shapeBuffer)
Constructor for a mono-channel wave shaperthat uses the float array from
a Buffer for its wave shape.
|
WaveShaper(AudioContext context,
float[] shape)
Constructor for a mono-channel wave shaper that uses the provided float
array for its wave shape.
|
WaveShaper(AudioContext context,
int channels)
Constructor for a multi-channel wave shaper that uses a default
cosine-based wave shape.
|
WaveShaper(AudioContext context,
int channels,
Buffer shapeBuffer)
Constructor for a multi-channel wave shaper that uses the float array
from a Buffer for its wave shape.
|
WaveShaper(AudioContext context,
int channels,
float[] shape)
Constructor for a multi-channel wave shaper that uses the provided float
array for its wave shape.
|
Modifier and Type | Method and Description |
---|---|
void |
calculateBuffer()
Called by the signal chain to update this UGen's ouput data.
|
static float[] |
generateCosineShape(int length)
Generates a nice cosine-based waveform in a float array that will provide
a little warmth when used for wave-shaping.
|
static float[] |
generateExponentialShape(int length,
float exponent)
Generates an exponentially-based waveform in a float array.
|
float |
getLimit()
Gets the current limit.
|
UGen |
getLimitUGen()
Gets the limit UGen, if there is one.
|
DataBead |
getParams()
Gets a new DataBead filled with the various parameter values stored in
the properties "preGain", "postGain", "limit", "wetMix", and "shape".
|
float |
getPostGain()
Gets the current post-gain.
|
UGen |
getPostGainUGen()
Gets the post-gain UGen, if there is one.
|
float |
getPreGain()
Gets the current pre-gain.
|
UGen |
getPreGainUGen()
Gets the pre-gain UGen, if there is one.
|
float[] |
getShape()
Gets the array of floats that represents the wave used for shaping.
|
DataBead |
getStaticParams()
Gets a new DataBead filled with the various parameter values stored in
the properties "preGain", "postGain", "limit", "wetMix", and "shape".
|
float |
getWetMix()
Gets the current wet-mix.
|
UGen |
getWetMixUGen()
Gets the wet-mix UGen, if there is one.
|
DataBeadReceiver |
sendData(DataBead db)
Sets parameters with a DataBead.
|
WaveShaper |
setLimit(float limit)
Sets the limit to a static float value.
|
WaveShaper |
setLimit(UGen limitUGen)
Sets the limit to be controlled by a UGen.
|
WaveShaper |
setPostGain(float postGain)
Sets the post-gain to a static float value.
|
WaveShaper |
setPostGain(UGen postGainUGen)
Sets the post-gain to be controlled by a UGen.
|
WaveShaper |
setPreGain(float preGain)
Sets the pre-gain to a static float value.
|
WaveShaper |
setPreGain(UGen preGainUGen)
Sets the pre-gain to be controlled by a UGen.
|
WaveShaper |
setShape(float[] shape)
Sets the array of floats to be used for WaveShaping.
|
WaveShaper |
setWetMix(float wetMix)
Sets the wet-mix to a static float value.
|
WaveShaper |
setWetMix(UGen wetMixUGen)
Sets the wetMix to be controlled by a 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
getKillListener, getName, isDeleted, isPaused, kill, message, messageReceived, setKillListener, setName, start, toString
protected float preGain
protected float postGain
protected float limit
protected float wetMix
protected UGen preGainUGen
protected UGen postGainUGen
protected UGen limitUGen
protected UGen wetMixUGen
protected boolean isPreGainStatic
protected boolean isPostGainStatic
protected boolean isLimitStatic
protected boolean isWetMixStatic
protected float[] shape
protected int shapeLen
protected int channels
public WaveShaper(AudioContext context)
context
- The audio context.public WaveShaper(AudioContext context, int channels)
context
- The audio context.channels
- The number of channels.public WaveShaper(AudioContext context, float[] shape)
context
- The audio context.shape
- The float array.public WaveShaper(AudioContext context, int channels, float[] shape)
context
- The audio context.channels
- The number of channels.shape
- The float array.public WaveShaper(AudioContext context, Buffer shapeBuffer)
context
- The audio context.shapeBuffer
- The Buffer from which to get the wave shape.public WaveShaper(AudioContext context, int channels, Buffer shapeBuffer)
context
- The audio context.channels
- The number of channels.shapeBuffer
- The Buffer from which to get the wave shape.public static float[] generateCosineShape(int length)
length
- The length of the array.public static float[] generateExponentialShape(int length, float exponent)
length
- The length of the array.exponent
- The exponent.public void calculateBuffer()
UGen
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.calculateBuffer
in class UGen
public float getPreGain()
public WaveShaper setPreGain(float preGain)
preGain
- The pre-gain.public WaveShaper setPreGain(UGen preGainUGen)
preGainUGen
- The pre-gain UGen.public UGen getPreGainUGen()
public float getPostGain()
public WaveShaper setPostGain(float postGain)
postGain
- The post-gain.public WaveShaper setPostGain(UGen postGainUGen)
postGainUGen
- The post-gain UGen.public UGen getPostGainUGen()
public float getLimit()
public WaveShaper setLimit(float limit)
limit
- The limit.public WaveShaper setLimit(UGen limitUGen)
limitUGen
- The limit UGen.public UGen getLimitUGen()
public float getWetMix()
public WaveShaper setWetMix(float wetMix)
wetMix
- The wetMix.public WaveShaper setWetMix(UGen wetMixUGen)
wetMixUGen
- The wet-mix UGen.public UGen getWetMixUGen()
public float[] getShape()
public WaveShaper setShape(float[] shape)
shape
- The array of floats.public DataBeadReceiver sendData(DataBead db)
sendData
in interface DataBeadReceiver
db
- The DataBead message.this
.public DataBead getParams()
public DataBead getStaticParams()