18 #ifndef CSL_Envelope_H
19 #define CSL_Envelope_H
92 Envelope(LineMode mode,
float t,
float x1,
float y1,
float x2 = 0,
float y2 = 1.0,
float x3 = 0,
float y3 = 1.0,
93 float x4 = 0,
float y4 = 1.0,
float x5 = 0,
float y5 = 1.0,
float x6 = 0,
float y6 = 1.0);
94 Envelope(LineMode mode,
float t,
unsigned int size,
float x[],
float y[]);
95 Envelope(
float t,
float x1,
float y1,
float x2 = 0,
float y2 = 1.0,
float x3 = 0,
float y3 = 1.0,
96 float x4 = 0,
float y4 = 1.0,
float x5 = 0,
float y5 = 1.0,
float x6 = 0,
float y6 = 1.0);
97 Envelope(
float t,
unsigned int size,
float x[],
float y[]);
111 virtual void reset();
158 ADSR(LineMode mode,
float t,
float a,
float d,
float s,
float r);
160 ADSR(LineMode mode,
float t,
float i,
float a,
float d,
float s,
float r);
162 ADSR(
float t,
float a,
float d,
float s,
float r);
164 ADSR(
float t,
float i,
float a,
float d,
float s,
float r);
204 AR(LineMode mode,
float t,
float a,
float r);
206 AR(LineMode mode,
float t,
float i,
float a,
float r);
208 AR(
float t,
float a,
float r);
210 AR(
float t,
float i,
float a,
float r);
218 void setAll(
float d,
float a,
float r);
232 Triangle(LineMode mode,
float duration,
float amplitude);
234 Triangle(LineMode mode,
float duration,
float initialDelay,
float amplitude);
236 Triangle(
float duration,
float amplitude = 1.0f);
238 Triangle(
float duration,
float initialDelay,
float amplitude);
249 RandEnvelope(
float frequency = 1,
float amplitude = 1,
float offset = 0,
float step = 0);
void dump()
reset internal time to restart envelope
float end()
Returns the target value of the line segment.
AR()
Various Constructors.
float mDuration
Total duration, typically in seconds.
virtual void dump()
Pretty-printer.
unsigned mCurrentFrame
cache
Triangle()
Various Constructors.
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
virtual void trigger()
reset internal time to restart envelope
void setOffset(float offset)
virtual void setDuration(float d)
set/scale durations
void setDuration(float tduration)
LineSegment mSegment
single line segment
void trigger()
reset internal time to restart envelope
void setAttack(float attack)
void setMode(LineMode tmode)
Sets the interpolation kind (linear or exponential)
RandEnvelope(float frequency=1, float amplitude=1, float offset=0, float step=0)
defaults are 1 Hz, +- 1.0 range
void setRelease(float release)
void nextSegment()
choose the values for the next line segment
void setAmplitude(float amplitude)
virtual void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
The main FrameStream work method.
map< float, LineSegment * > Breakpoints
a map between a time and a line segment
LineMode mMode
How am I to calculate the values from start to end values of the line.
void setAll(float d, float a, float r)
void initSegment()
set up the line segment
float duration()
Returns the total time it will take to get from start to end value.
void setStart(float tstart)
void createSegments()
Allocate memory for the segments.
float mCurrentValue
Internal book-keeping.
Scalable – mix-in class with scale and offset control inputs (may be constants or generators)...
A linearly interpolated segment – this has start and end values, and a duration (in seconds)...
void setDuration(unsigned tduration)
Overloaded to accept either float or unsigned.
void scaleTimes(float s)
set/scale durations
virtual void scaleTimes(float s)
scale durations
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
next buffer interpolator
Breakpoints mSegmentMap
list of envelope breakpoints
bool mWalk
whether to produce random values or a random walk
void setAttack(float attack)
void dump()
reset internal time to restart envelope
ADSR = 4-segment attack/decay/sustain/release envelope class.
float mAmplitude
scale (+-)
void setWalk(bool walk)
Accessors.
~Triangle()
Minimal version - AR.
void setDuration(float d)
print the receiver
void reset()
These are no-ops in Random envelopes.
void setDuration(float d)
Special accessors.
void reset()
reset counters
#define kLine
LineSegment flags for line interpolation.
float mStep
max step between values (+-)
void addBreakpoint(float startTime, float value)
unsigned mSegmentLength
line segment's length in frames
void calculateSegments()
Calculate the internal data.
virtual void reset()
reset internal time to restart envelope
RandEnvelope envelope class – makes random control signals using a single line segment.
Triangle envelope class – equal attack/release times.
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
scale durations
virtual bool isActive()
This answers whether I'm active (ptr < end)
virtual bool isActive()
This answers whether I'm active (ptr < end)
float mFrequency
frequency for picking new values
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
float mDuration
Length of the line segment (IN SECONDS)
virtual void scaleValues(float s)
scale values so the max is s
void setSustain(float sustain)
void setDecay(float decay)
unsigned int privateNextBuffer(CPoint *breakpoint, LineSegment *segment, float *buffer, unsigned int numFrames)
Internal helper method for computing the next buffer.
void setFrequency(float frequency)
Port – used to represent constant, control-rate or signal inputs and outputs in named maps; holds a ...
AR = 3-segment attack/release envelope class.
float mLastVal
last line segment ending value (unscaled and unoffset)
LineSegment()
empty constructor
unsigned mCurrentIndex
current index in line segment
void setDuration(float d)
Special accessors.
void setMode(LineMode mode)
Envelope: a collection of LineSegments; may have an input (scale) and act like a processor, or have no input and act like a control UGen. I inherit Scalable setScale, setOffset for inputs.
void setRelease(float release)
LineSegment ** mSegments
array of line segments that for the envelope
float mCurrentMark
How far we have read.
void release(void)
Operations.
Base class of CSL exceptions (written upper-case). Has a string message.