Indicates the current stage of the envelop.
Advances the main counter by one amount.
Returns true if the envelop generator is running
Sets the key position to off.
Sets the key position to on.
Sets the key position to on (no reset of counter).
Returns true if key is on
Returns the current output as a floating-point value, between 0.0 and 1.0
Returns the current stage
Changes the shape of the output using a fast and very crude power of function. Output is returned as a floating-point value between 0.0 and 1.0
The maximum possible output of the envelop generator
The minimum possible output of the envelop generator.
If set, then the envelop is running
If key is on, then it's set to true
Sets how long the attack phase will last (less = longer)
The current position of the counter + unshaped output
The current stage of the envelop generator
Sets how long the decay phase will last (less = longer)
If true, then the sustain stage is skipped
Sets how long the release phase will last (less = longer)
Controls how the sustain level will change (between -1.0 and 1.0)
Sets the level of sustain.
ADSR Envelop generator struct.
Uses floating-point arithmetics, since most targets will use that. Shaping is done through the shpF() and shp() functions. A 0.5 value should return a mostly linear output, and a 0.25 an "audio-grade logarithmic" for volume, but since the calculation is optimized for speed rather than accuracy, there will be imperfections.