TracktionEngine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
engine::LinEnvelope Class Reference

#include <tracktion_Envelope.h>

Classes

struct  Parameters
 Holds the parameters being used by an ADSR object. More...
 

Public Types

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

Public Member Functions

void setParameters (const Parameters &newParameters)
 Sets the parameters that will be used by an ADSR object.
 
void setSampleRate (double sr)
 
float getEnvelopeValue ()
 
State getState ()
 
void noteOn ()
 
void noteOff ()
 
void reset ()
 
float getNextSample ()
 Returns the next sample value for an ADSR object.
 
template<typename FloatType >
void applyEnvelopeToBuffer (juce::AudioBuffer< FloatType > &buffer, int startSample, int numSamples)
 This method will conveniently apply the next numSamples number of envelope values to an AudioBuffer.
 

Protected Member Functions

void calculateRates (const Parameters &parameters)
 

Protected Attributes

State currentState = State::idle
 
Parameters currentParameters
 
double sampleRate = 44100.0
 
float envelopeVal = 0.0f
 
float sustainLevel = 0.0f
 
float attackRate = 0.0f
 
float decayRate = 0.0f
 
float releaseRate = 0.0f
 

Member Enumeration Documentation

◆ State

enum class engine::LinEnvelope::State
strong
Enumerator
idle 
attack 
decay 
sustain 
release 

Member Function Documentation

◆ setParameters()

void engine::LinEnvelope::setParameters ( const Parameters newParameters)

Sets the parameters that will be used by an ADSR object.

You must have called setSampleRate() with the correct sample rate before this otherwise the values may be incorrect!

See also
getParameters

References engine::LinEnvelope::Parameters::sustain.

◆ setSampleRate()

void engine::LinEnvelope::setSampleRate ( double  sr)

◆ getEnvelopeValue()

float engine::LinEnvelope::getEnvelopeValue ( )

◆ getState()

State engine::LinEnvelope::getState ( )

◆ noteOn()

void engine::LinEnvelope::noteOn ( )

◆ noteOff()

void engine::LinEnvelope::noteOff ( )

◆ reset()

void engine::LinEnvelope::reset ( )

◆ getNextSample()

float engine::LinEnvelope::getNextSample ( )

Returns the next sample value for an ADSR object.

See also
applyEnvelopeToBuffer

◆ applyEnvelopeToBuffer()

template<typename FloatType >
void engine::LinEnvelope::applyEnvelopeToBuffer ( juce::AudioBuffer< FloatType > &  buffer,
int  startSample,
int  numSamples 
)

This method will conveniently apply the next numSamples number of envelope values to an AudioBuffer.

See also
getNextSample

◆ calculateRates()

void engine::LinEnvelope::calculateRates ( const Parameters parameters)
protected

Member Data Documentation

◆ currentState

State engine::LinEnvelope::currentState = State::idle
protected

◆ currentParameters

Parameters engine::LinEnvelope::currentParameters
protected

◆ sampleRate

double engine::LinEnvelope::sampleRate = 44100.0
protected

◆ envelopeVal

float engine::LinEnvelope::envelopeVal = 0.0f
protected

◆ sustainLevel

float engine::LinEnvelope::sustainLevel = 0.0f
protected

◆ attackRate

float engine::LinEnvelope::attackRate = 0.0f
protected

◆ decayRate

float engine::LinEnvelope::decayRate = 0.0f
protected

◆ releaseRate

float engine::LinEnvelope::releaseRate = 0.0f
protected

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