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

Analog ADSR. More...

Public Types

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

Public Member Functions

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

Protected Member Functions

void calculateAttack ()
 
void calculateDecay ()
 
void calculateRelease ()
 

Protected Attributes

State state = State::idle
 
double sampleRate = 44100.0
 
float attack = 0.0f
 
float decay = 0.0f
 
float sustain = 0.0f
 
float release = 0.0f
 
float attackCoeff = 0.0f
 
float decayCoeff = 0.0f
 
float releaseCoeff = 0.0f
 
float attackOffset = 0.0f
 
float decayOffset = 0.0f
 
float releaseOffset = 0.0f
 
float output = 0.0f
 

Detailed Description

Analog ADSR.

Good for controlling audio levels. Based on the ADSR from the Will Pirkle book

Member Enumeration Documentation

◆ State

enum AnalogADSR::State
strong
Enumerator
idle 
attack 
decay 
sustain 
release 

Constructor & Destructor Documentation

◆ AnalogADSR()

AnalogADSR::AnalogADSR ( )

◆ ~AnalogADSR()

AnalogADSR::~AnalogADSR ( )
default

Member Function Documentation

◆ setSampleRate()

void AnalogADSR::setSampleRate ( double  sr)

References sampleRate.

Referenced by GateEffect::setSampleRate().

◆ process() [1/4]

float AnalogADSR::process ( )

Referenced by GateEffect::process().

◆ process() [2/4]

float AnalogADSR::process ( int  num)

◆ process() [3/4]

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

◆ process() [4/4]

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

◆ processMultiplying() [1/2]

void AnalogADSR::processMultiplying ( juce::AudioSampleBuffer &  buffer)

◆ processMultiplying() [2/2]

void AnalogADSR::processMultiplying ( juce::AudioSampleBuffer &  buffer,
int  startSample,
int  numSamples 
)

◆ getOutput()

float AnalogADSR::getOutput ( )

References output.

◆ getState()

State AnalogADSR::getState ( )

References state.

◆ noteOn()

void AnalogADSR::noteOn ( )

Referenced by GateEffect::process().

◆ noteOff()

void AnalogADSR::noteOff ( )

Referenced by GateEffect::process().

◆ setAttack()

void AnalogADSR::setAttack ( float  seconds)

Referenced by GateEffect::setAttack().

◆ setDecay()

void AnalogADSR::setDecay ( float  seconds)

Referenced by GateEffect::GateEffect().

◆ setRelease()

void AnalogADSR::setRelease ( float  seconds)

Referenced by GateEffect::setRelease().

◆ setSustainLevel()

void AnalogADSR::setSustainLevel ( float  level)

Referenced by GateEffect::GateEffect().

◆ reset()

void AnalogADSR::reset ( )

Referenced by GateEffect::reset().

◆ getCurrentPhase()

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

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

◆ calculateAttack()

void AnalogADSR::calculateAttack ( )
protected

◆ calculateDecay()

void AnalogADSR::calculateDecay ( )
protected

◆ calculateRelease()

void AnalogADSR::calculateRelease ( )
protected

Member Data Documentation

◆ state

State AnalogADSR::state = State::idle
protected

Referenced by getCurrentPhase(), and getState().

◆ sampleRate

double AnalogADSR::sampleRate = 44100.0
protected

Referenced by setSampleRate().

◆ attack

float AnalogADSR::attack = 0.0f
protected

◆ decay

float AnalogADSR::decay = 0.0f
protected

◆ sustain

float AnalogADSR::sustain = 0.0f
protected

◆ release

float AnalogADSR::release = 0.0f
protected

◆ attackCoeff

float AnalogADSR::attackCoeff = 0.0f
protected

◆ decayCoeff

float AnalogADSR::decayCoeff = 0.0f
protected

◆ releaseCoeff

float AnalogADSR::releaseCoeff = 0.0f
protected

◆ attackOffset

float AnalogADSR::attackOffset = 0.0f
protected

◆ decayOffset

float AnalogADSR::decayOffset = 0.0f
protected

◆ releaseOffset

float AnalogADSR::releaseOffset = 0.0f
protected

◆ output

float AnalogADSR::output = 0.0f
protected

Referenced by getCurrentPhase(), and getOutput().


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