public class Envelope extends UGen
addSegment
. With the method
addSegment(float, float, float, Bead)
a Bead
can be provided which gets triggered when the segment has reached its destination.
At any point in time, the Envelope maintains a current value.
New segments define transitions from that current value to a destination value
over a given duration. Instead of a linear transition, a curved transition
can be used. The curve is defined as the mapping of the range [0,1]
from y=x
to y=x^p
with a given exponent p
.Modifier and Type | Class and Description |
---|---|
class |
Envelope.Segment
The nested class Segment.
|
UGen.OutputInitializationRegime, UGen.OutputPauseRegime
Modifier and Type | Field and Description |
---|---|
protected float[] |
myBufOut
The real output buffer.
|
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
Constructor and Description |
---|
Envelope(AudioContext context)
Instantiates a new Envelope with start value 0.
|
Envelope(AudioContext context,
float value)
Instantiates a new Envelope with the specified start value.
|
Modifier and Type | Method and Description |
---|---|
Envelope |
addSegment(float endValue,
float duration)
Adds a new Segment.
|
Envelope |
addSegment(float endValue,
float duration,
Bead trigger)
Adds a new Segment.
|
Envelope |
addSegment(float endValue,
float duration,
float curvature)
Adds a new Segment.
|
Envelope |
addSegment(float endValue,
float duration,
float curvature,
Bead trigger)
Adds a new Segment.
|
Envelope |
addSegments(java.util.List<Envelope.Segment> segments)
Adds the specified List of Segments.
|
void |
calculateBuffer()
Called by the signal chain to update this UGen's ouput data.
|
Envelope |
clear()
Clears the list of Segments.
|
float |
getCurrentValue()
Gets the current value.
|
float |
getValue(int i,
int j)
Gets a specific specified value from the output buffer, with indices i (channel)
and j (offset into buffer).
|
boolean |
isLocked()
Checks whether the Envelope is locked.
|
Envelope |
lock(boolean lock)
Locks/unlocks the Envelope.
|
void |
setValue(float value)
Clears the list of Segments and sets the current value of the Envelope immediately.
|
addDependent, addInput, addInput, clearDependents, clearInputConnections, containsInput, crossfadeInput, getConnectedInputs, getContext, getEnvelopes, getIns, getNumberOfConnectedUGens, getNumberOfDependents, getOutBuffer, getOuts, getTimeTakenLastUpdate, getValue, getValueDouble, getValueDouble, initializeOuts, isTimerMode, isUpdated, noInputs, pause, printInBuffers, printInputList, printOutBuffers, removeAllConnections, removeConnection, removeDependent, setOutsToPause, setTimerMode, update, zeroIns, zeroOuts
getKillListener, getName, isDeleted, isPaused, kill, message, messageReceived, setKillListener, setName, start, toString
public Envelope(AudioContext context)
context
- the AudioContext.public Envelope(AudioContext context, float value)
context
- the AudioContext.value
- the start value.public Envelope lock(boolean lock)
public boolean isLocked()
public Envelope addSegment(float endValue, float duration, float curvature)
endValue
- the destination value.duration
- the duration.curvature
- the exponent of the curve.public Envelope addSegment(float endValue, float duration, float curvature, Bead trigger)
endValue
- the destination value.duration
- the duration.curvature
- the exponent of the curve.trigger
- the trigger.public Envelope addSegment(float endValue, float duration)
endValue
- the destination value.duration
- the duration.public Envelope addSegment(float endValue, float duration, Bead trigger)
endValue
- the destination value.duration
- the duration.trigger
- the trigger.public Envelope addSegments(java.util.List<Envelope.Segment> segments)
segments
- the Segments.public void setValue(float value)
setValue
in class UGen
value
- the new value.setValue(float)
public Envelope clear()
public float getCurrentValue()
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 getValue(int i, int j)
UGen