# Amuse: include/amuse/Envelope.hpp Source File

Envelope.hpp
#ifndef __AMUSE_ENVELOPE_HPP__
#define __AMUSE_ENVELOPE_HPP__
#include "AudioGroupPool.hpp"
namespace amuse
{
class Envelope
{
public:
enum class State
{
Attack,
Decay,
Sustain,
Release,
Complete
};
private:
State m_phase = State::Attack;
double m_attackTime = 0.0;
double m_decayTime = 0.0;
double m_sustainFactor = 1.0;
double m_releaseTime = 0.0;
double m_releaseStartFactor;
double m_curTime;
public:
void reset(const ADSR* adsr);
void reset(const ADSRDLS* adsr, int8_t note, int8_t vel);
void keyOff();
float nextSample(double sampleRate);
bool isComplete() const {return m_phase == State::Complete;}
};
}
#endif // __AMUSE_ENVELOPE_HPP__
amuse::ADSR
Definition: AudioGroupPool.hpp:23
amuse::ADSRDLS
Definition: AudioGroupPool.hpp:41
amuse
Definition: AudioGroup.hpp:8
amuse::Envelope
Definition: Envelope.hpp:10