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

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

#include <AudioParameters.h>

Inheritance diagram for audio_tools::ADSR:
audio_tools::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 ()
 
- Public Member Functions inherited from audio_tools::AbstractParameter
virtual void keyOff ()
 
virtual void keyOn (float tgt=0)
 
virtual float tick ()
 
virtual float value ()
 

Protected Types

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

Protected Member Functions

float update ()
 
virtual float update ()=0
 

Protected Attributes

const char * adsrNames [5] = {"Idle", "Attack", "Decay", "Sustain", "Release"}
 
float attack
 
float decay
 
float release
 
AdsrPhase state = Idle
 
float sustain
 
float target = 0
 
int zeroCount = 0
 
- Protected Attributes inherited from audio_tools::AbstractParameter
float act_value = 0
 

Detailed Description

Generates ADSR values between 0.0 and 1.0.

Member Function Documentation

◆ keyOff()

void audio_tools::ADSR::keyOff ( )
inlinevirtual

Reimplemented from audio_tools::AbstractParameter.

◆ keyOn()

void audio_tools::ADSR::keyOn ( float  tgt = 0)
inlinevirtual

Reimplemented from audio_tools::AbstractParameter.

◆ update()

float audio_tools::ADSR::update ( )
inlineprotectedvirtual

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