49 ADSR (
unsigned int attack = 0,
unsigned int decay = 0,
float sustain = 1.0,
unsigned int release = 1000 );
52 ADSR(
const std::shared_ptr<ADSR> other );
107 bool applyADSR(
float *pLeft,
float *pRight,
int nFinalBufferPos,
int nReleaseFrame,
float fStep );
129 QString
toQString(
const QString& sPrefix =
"",
bool bShort =
true )
const override;
Attack Decay Sustain Release envelope.
void attack()
Sets m_state to State::Attack.
static QString StateToQString(State state)
ADSR(unsigned int attack=0, unsigned int decay=0, float sustain=1.0, unsigned int release=1000)
constructor
float m_fValue
current value
float release()
Sets m_state to State::Release and return the current m_fReleaseValue.
unsigned int getRelease()
unsigned int m_nDecay
Decay phase duration in frames.
unsigned int m_nAttack
Attack phase duration in frames.
void setSustain(float value)
double m_fQ
exponential decay state
void setAttack(unsigned int value)
void setRelease(unsigned int value)
float m_fSustain
Sustain level.
State m_state
current state
QString toQString(const QString &sPrefix="", bool bShort=true) const override
Formatted string version for debugging purposes.
bool applyADSR(float *pLeft, float *pRight, int nFinalBufferPos, int nReleaseFrame, float fStep)
Compute and apply successive ADSR values to stereo buffers.
unsigned int m_nRelease
Release phase duration in frames.
float m_fReleaseValue
value when the release state was entered
void setDecay(unsigned int value)
float m_fFramesInState
Tracks the number of frames passed in the current m_state.