43 lines
734 B
C++
43 lines
734 B
C++
#ifndef ENVELOPE
|
|
#define ENVELOPE
|
|
|
|
#include "../include/synth.hpp"
|
|
|
|
enum class Condition{
|
|
Idle,
|
|
Attack,
|
|
Decay,
|
|
Sustain,
|
|
Release
|
|
};
|
|
|
|
class Envelope{
|
|
|
|
public:
|
|
Envelope(Synth& synth) : synth_(synth){
|
|
condition = Condition::Idle;
|
|
attack = 0.0;
|
|
decay = 0.0;
|
|
sustain = 0.0;
|
|
release = 0.0;
|
|
amplitude = 0.0;
|
|
phase = 0.0;
|
|
};
|
|
void note_on();
|
|
void note_off();
|
|
double process();
|
|
|
|
private:
|
|
Condition condition;
|
|
Synth& synth_;
|
|
|
|
double attack;
|
|
double decay;
|
|
double sustain;
|
|
double release;
|
|
double amplitude;
|
|
double phase;
|
|
};
|
|
|
|
#endif
|