Envelope with a fixed number of exponential segments and a sustain point. More...
#include <Envelope.h>
Inherits Ts.
Public Member Functions | |
int | size () const |
Get the number of segments. | |
int | position () const |
Get the position, in samples, within the current segment. | |
int | sustainPoint () const |
Get the sustain break-point. | |
int | stage () const |
Get the envelope's current segment. | |
Tv | value () const |
Get the current envelope value. | |
bool | done () const |
Returns whether the envelope is done. | |
bool | released () const |
Returns whether the envelope is released. | |
bool | sustained () const |
Returns whether the envelope is currently sustained. | |
Tv | operator() () |
Generate next value. | |
void | release () |
Release the envelope. | |
Env & | loop (bool v) |
Set whether envelope loops. | |
Env & | sustainPoint (int v) |
Sets the point at which the envelope holds its value until released. | |
Env & | sustainDisable () |
Disable sustain. | |
void | reset () |
Reset envelope to starting point. | |
Tp * | lengths () |
Get segment lengths array. | |
template<class V > | |
Env & | lengths (const V *vals, int len) |
Set break-point values. | |
Env & | lengths (Tp a, Tp b) |
Set first two segment lengths. | |
Env & | lengths (Tp a, Tp b, Tp c) |
Set first three segment lengths. | |
Env & | lengths (Tp a, Tp b, Tp c, Tp d) |
Set first four segment lengths. | |
Env & | lengths (Tp a, Tp b, Tp c, Tp d, Tp e) |
Set first five segment lengths. | |
Tp | totalLength () const |
Get total length of all envelope segments. | |
Env & | totalLength (Tp length, int modSegment) |
Set total length of envelope by adjusting one segment length. | |
Env & | totalLength (Tp length) |
Set total length of envelope by scaling all segment lengths. | |
Tp * | curves () |
Get segment curvature array. | |
Env & | curve (Tp v) |
Set curvature of all segments. | |
Env & | segment (int i, Tp len, Tp crv) |
Set length and curvature of a segment. | |
template<class V > | |
Env & | segments (const V *lens, const V *crvs, int len, int begin=0) |
Set length and curvature of many segments. | |
Env & | segments (Tp la, Tp ca, Tp lb, Tp cb) |
Set length and curvature of first two segments. | |
Env & | segments (Tp la, Tp ca, Tp lb, Tp cb, Tp lc, Tp cc) |
Set length and curvature of first three segments. | |
Env & | segments (Tp la, Tp ca, Tp lb, Tp cb, Tp lc, Tp cc, Tp ld, Tp cd) |
Set length and curvature of first four segments. | |
Tv * | levels () |
Get break-point levels array. | |
template<class V > | |
Env & | levels (const V *vals, int len) |
Set break-point values. | |
Env & | levels (Tv a, Tv b) |
Set first two break-point levels. | |
Env & | levels (Tv a, Tv b, Tv c) |
Set first three break-point levels. | |
Env & | levels (Tv a, Tv b, Tv c, Tv d) |
Set first four break-point levels. | |
Env & | levels (Tv a, Tv b, Tv c, Tv d, Tv e) |
Set first five break-point levels. |
Envelope with a fixed number of exponential segments and a sustain point.
The envelope consists of N exponential curve 'segments' and N+1 break-point levels. The curvature and length of each segment and the break-point levels can be controlled independently. This class can be used to construct many specialized envelopes such as an AD (Attack Decay), an ADSR (Attack Decay Sustain Release), and an ADSHR (Attack Decay Sustain Hold Release). The number of envelope segments is fixed to ensure better memory locality.
N | number of segments |
Tv | value (sample) type |
Tp | parameter type |
Env& totalLength | ( | Tp | length, |
int | modSegment | ||
) |
Set total length of envelope by adjusting one segment length.
[in] | length | desired length |
[in] | modSegment | segment whose length is modified to match desired length |