|
LMMS
|
#include <envelope.h>
Public Types | |
| enum | env_state { STOP , ATTACK , DECAY , SUSTAIN , RELEASE , LOCKDECAY } |
Public Member Functions | |
| adsr () | |
| void | reset () |
| Stop (reset) the envelope. | |
| void | set (float a, float d, float s, float r, float er, float f=0.f) |
| bool | released () const |
| bool | stopped () const |
| void | note_on () |
| Start the envelope. | |
| void | note_off () |
| Release the envelope. | |
| void | advance () |
| Calculate next envelope value. | |
| double | interpolate (double pos) |
| float | get_amp_value () |
Public Attributes | |
| env_state | state |
| Current envelope stage. | |
| double | attack |
| double | decay |
| double | sustain |
| double | release |
| double | fade |
| double | release_time |
| Requested release time (not the rate!) in frames, used for recalculating the rate if sustain is changed. | |
| double | value |
| Current envelope (output) level. | |
| double | thisrelease |
| double | thiss |
| double | old_value |
| Value from the time before advance() was called last time. | |
Rate-based ADSFR envelope class. Note that if release rate is slower than decay rate, this envelope won't use release rate until output level falls below sustain level it's different to what certain hardware synth companies did, but it prevents the very un-musical (IMHO) behaviour known from (for example) SoundFont 2.
| enum dsp::adsr::env_state |
|
inline |
|
inline |
Calculate next envelope value.
|
inline |
|
inline |
Return a value between old_value (previous step) and value (current step)
| pos | between 0 and 1 |
|
inline |
Release the envelope.
|
inline |
Start the envelope.
|
inline |
| true | if envelope is in released state (forced decay, release or stopped) |
|
inline |
Stop (reset) the envelope.
|
inline |
| true | if envelope is stopped (has not been started or has run till its end) |
| double dsp::adsr::attack |
| double dsp::adsr::decay |
| double dsp::adsr::fade |
| double dsp::adsr::old_value |
Value from the time before advance() was called last time.
| double dsp::adsr::release |
| double dsp::adsr::release_time |
Requested release time (not the rate!) in frames, used for recalculating the rate if sustain is changed.
| env_state dsp::adsr::state |
Current envelope stage.
| double dsp::adsr::sustain |
| double dsp::adsr::thisrelease |
Release rate used for the current note (calculated from this note's sustain level, and not the current sustain level, which may have changed after note has been released)
| double dsp::adsr::thiss |
Sustain level used for the current note (used to calculate release rate if sustain changed during release stage of the current note)
| double dsp::adsr::value |
Current envelope (output) level.