Gin
Public Types | Public Member Functions | Protected Attributes | List of all members
ADSR Class Reference

Linear ADSR. More...

Public Types

enum  State {
  idle , attack , decay , sustain ,
  release , finished
}
 

Public Member Functions

 ADSR ()
 
 ~ADSR ()
 
void setSampleRate (double sr)
 
float process ()
 
float process (int num)
 
void process (juce::AudioSampleBuffer &buffer)
 
void process (juce::AudioSampleBuffer &buffer, int startSample, int numSamples)
 
float getOutput ()
 
std::pair< int, float > getCurrentPhase ()
 
State getState ()
 
void noteOn ()
 
void noteOff ()
 
void setAttack (float seconds)
 
void setDecay (float seconds)
 
void setRelease (float seconds)
 
void setSustainLevel (float level)
 
void reset ()
 

Protected Attributes

State state = idle
 
double sampleRate = 44100.0
 
float output = 0.0f
 
float attackDelta = 0.0f
 
float decayDelta = 0.0f
 
float releaseDelta = 0.0f
 
float sustainLevel = 0.0f
 

Detailed Description

Linear ADSR.

Good for a modulation source

Member Enumeration Documentation

◆ State

Enumerator
idle 
attack 
decay 
sustain 
release 
finished 

Constructor & Destructor Documentation

◆ ADSR()

ADSR::ADSR ( )

◆ ~ADSR()

ADSR::~ADSR ( )

Member Function Documentation

◆ setSampleRate()

void ADSR::setSampleRate ( double  sr)

References sampleRate.

◆ process() [1/4]

float ADSR::process ( )

◆ process() [2/4]

float ADSR::process ( int  num)

◆ process() [3/4]

void ADSR::process ( juce::AudioSampleBuffer &  buffer)

◆ process() [4/4]

void ADSR::process ( juce::AudioSampleBuffer &  buffer,
int  startSample,
int  numSamples 
)

◆ getOutput()

float ADSR::getOutput ( )

References attackDelta, idle, output, and state.

◆ getCurrentPhase()

std::pair<int, float> ADSR::getCurrentPhase ( )

References attack, decay, output, release, state, and sustain.

◆ getState()

State ADSR::getState ( )

References state.

◆ noteOn()

void ADSR::noteOn ( )

References attack, and state.

◆ noteOff()

void ADSR::noteOff ( )

References release, and state.

◆ setAttack()

void ADSR::setAttack ( float  seconds)

◆ setDecay()

void ADSR::setDecay ( float  seconds)

◆ setRelease()

void ADSR::setRelease ( float  seconds)

◆ setSustainLevel()

void ADSR::setSustainLevel ( float  level)

◆ reset()

void ADSR::reset ( )

Member Data Documentation

◆ state

State ADSR::state = idle
protected

◆ sampleRate

double ADSR::sampleRate = 44100.0
protected

Referenced by setSampleRate().

◆ output

float ADSR::output = 0.0f
protected

Referenced by getCurrentPhase(), and getOutput().

◆ attackDelta

float ADSR::attackDelta = 0.0f
protected

Referenced by getOutput().

◆ decayDelta

float ADSR::decayDelta = 0.0f
protected

◆ releaseDelta

float ADSR::releaseDelta = 0.0f
protected

◆ sustainLevel

float ADSR::sustainLevel = 0.0f
protected

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