arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ADSR Class Reference

Generates ADSR values between 0.0 and 1.0. More...

#include <AudioParameters.h>

Inheritance diagram for ADSR:
AbstractParameter

Public Member Functions

 ADSR (ADSR &copy)=default
 
 ADSR (float attack=0.001, float decay=0.001, float sustainLevel=0.5, float release=0.005)
 
float attackRate ()
 
float decayRate ()
 
bool isActive ()
 
void keyOff ()
 
void keyOn (float tgt=0)
 
float releaseRate ()
 
void setAttackRate (float a)
 
void setDecayRate (float d)
 
void setReleaseRate (float r)
 
void setSustainLevel (float s)
 
float sustainLevel ()
 
virtual float tick ()
 
virtual float value ()
 

Protected Types

enum  AdsrPhase {
  Idle , Attack , Decay , Sustain ,
  Release
}
 

Protected Member Functions

float update ()
 

Protected Attributes

float act_value = 0
 
const charadsrNames [5] = {"Idle", "Attack", "Decay", "Sustain", "Release"}
 
float attack
 
float decay
 
float release
 
AdsrPhase state = Idle
 
float sustain
 
float target = 0
 
int zeroCount = 0
 

Detailed Description

Generates ADSR values between 0.0 and 1.0.

Member Enumeration Documentation

◆ AdsrPhase

enum AdsrPhase
protected
Enumerator
Idle 
Attack 
Decay 
Sustain 
Release 

Constructor & Destructor Documentation

◆ ADSR() [1/2]

ADSR ( float  attack = 0.001,
float  decay = 0.001,
float  sustainLevel = 0.5,
float  release = 0.005 
)
inline

◆ ADSR() [2/2]

ADSR ( ADSR copy)
default

Member Function Documentation

◆ attackRate()

float attackRate ( )
inline

◆ decayRate()

float decayRate ( )
inline

◆ isActive()

bool isActive ( )
inline

◆ keyOff()

void keyOff ( )
inlinevirtual

Reimplemented from AbstractParameter.

◆ keyOn()

void keyOn ( float  tgt = 0)
inlinevirtual

Reimplemented from AbstractParameter.

◆ releaseRate()

float releaseRate ( )
inline

◆ setAttackRate()

void setAttackRate ( float  a)
inline

◆ setDecayRate()

void setDecayRate ( float  d)
inline

◆ setReleaseRate()

void setReleaseRate ( float  r)
inline

◆ setSustainLevel()

void setSustainLevel ( float  s)
inline

◆ sustainLevel()

float sustainLevel ( )
inline

◆ tick()

virtual float tick ( )
inlinevirtualinherited

◆ update()

float update ( )
inlineprotectedvirtual

Implements AbstractParameter.

◆ value()

virtual float value ( )
inlinevirtualinherited

Member Data Documentation

◆ act_value

float act_value = 0
protectedinherited

◆ adsrNames

const char* adsrNames[5] = {"Idle", "Attack", "Decay", "Sustain", "Release"}
protected

◆ attack

float attack
protected

◆ decay

float decay
protected

◆ release

float release
protected

◆ state

AdsrPhase state = Idle
protected

◆ sustain

float sustain
protected

◆ target

float target = 0
protected

◆ zeroCount

int zeroCount = 0
protected

The documentation for this class was generated from the following file: