|
hydrogen 1.1.1
|
Attack Decay Sustain Release envelope. More...
#include <Adsr.h>
Public Member Functions | |
| ADSR (unsigned int attack=0, unsigned int decay=0, float sustain=1.0, unsigned int release=1000) | |
| constructor More... | |
| ADSR (const ADSR *other) | |
| copy constructor More... | |
| ~ADSR () | |
| destructor More... | |
| void | set_attack (unsigned int value) |
| __attack setter More... | |
| unsigned int | get_attack () |
| __attack accessor More... | |
| void | set_decay (unsigned int value) |
| __decay setter More... | |
| unsigned int | get_decay () |
| __decay accessor More... | |
| void | set_sustain (float value) |
| __sustain setter More... | |
| float | get_sustain () |
| __sustain accessor More... | |
| void | set_release (unsigned int value) |
| __release setter More... | |
| unsigned int | get_release () |
| __release accessor More... | |
| void | attack () |
| sets state to ATTACK More... | |
| float | get_value (float step) |
| compute the value and return it More... | |
| float | release () |
| sets state to RELEASE, returns 0 if the state is IDLE, __value if the state is RELEASE, set state to RELEASE, save __release_value and return it. More... | |
| QString | toQString (const QString &sPrefix, bool bShort=true) const override |
| Formatted string version for debugging purposes. More... | |
Public Member Functions inherited from Object | |
| ~Object () | |
| destructor More... | |
| Object (const Object &obj) | |
| copy constructor More... | |
| Object (const char *class_name) | |
| constructor More... | |
| const char * | class_name () const |
| return the class name More... | |
| virtual QString | toQString (const QString &sPrefix, bool bShort=true) const |
| Formatted string version for debugging purposes. More... | |
| void | Print (bool bShort=true) const |
| Prints content of toQString() via DEBUGLOG. More... | |
Private Types | |
| enum | ADSRState { ATTACK =0 , DECAY , SUSTAIN , RELEASE , IDLE } |
| possible states More... | |
Private Member Functions | |
| void | normalise () |
Private Attributes | |
| unsigned int | __attack |
| Attack tick count. More... | |
| unsigned int | __decay |
| Decay tick count. More... | |
| float | __sustain |
| Sustain level. More... | |
| unsigned int | __release |
| Release tick count. More... | |
| ADSRState | __state |
| current state More... | |
| float | __ticks |
| current tick count More... | |
| float | __value |
| current value More... | |
| float | __release_value |
| value when the release state was entered More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
| static void | set_count (bool flag) |
| enable/disable class instances counting More... | |
| static bool | count_active () |
| return true if class instances counting is enabled More... | |
| static unsigned | objects_count () |
| return the number of objects More... | |
| static void | write_objects_map_to (std::ostream &out) |
| output the full objects map to a given ostream More... | |
| static void | write_objects_map_to_cerr () |
| output objects map to stderr More... | |
| static int | bootstrap (Logger *logger, bool count=false) |
| must be called before any Object instantiation ! More... | |
| static Logger * | logger () |
| return the logger instance More... | |
Static Public Attributes inherited from Object | |
| static QString | sPrintIndention = " " |
| String used to format the debugging string output of some core classes. More... | |
Static Protected Attributes inherited from Object | |
| static Logger * | __logger = nullptr |
| logger instance pointer More... | |
Attack Decay Sustain Release envelope.
|
private |
| ADSR | ( | unsigned int | attack = 0, |
| unsigned int | decay = 0, |
||
| float | sustain = 1.0, |
||
| unsigned int | release = 1000 |
||
| ) |
constructor
| attack | tick duration |
| decay | tick duration |
| sustain | level |
| release | tick duration |
| ~ADSR | ( | ) |
destructor
| void attack | ( | ) |
sets state to ATTACK
|
inline |
__attack accessor
|
inline |
__decay accessor
|
inline |
__release accessor
|
inline |
__sustain accessor
| float get_value | ( | float | step | ) |
compute the value and return it
| step | the increment to be added to __ticks |
|
private |
| float release | ( | ) |
sets state to RELEASE, returns 0 if the state is IDLE, __value if the state is RELEASE, set state to RELEASE, save __release_value and return it.
|
inline |
__attack setter
| value | the new value |
|
inline |
__decay setter
| value | the new value |
|
inline |
__release setter
| value | the new value |
|
inline |
__sustain setter
| value | the new value |
|
overridevirtual |
Formatted string version for debugging purposes.
| sPrefix | String prefix which will be added in front of every new line |
| bShort | Instead of the whole content of all classes stored as members just a single unique identifier will be displayed without line breaks. |
Reimplemented from Object.
|
private |
Attack tick count.
|
private |
Decay tick count.
|
private |
Release tick count.
|
private |
value when the release state was entered
|
private |
current state
|
private |
Sustain level.
|
private |
current tick count
|
private |
current value