работа над envelope закончена
envelope работает. без щелчков
This commit is contained in:
+38
-16
@@ -1,7 +1,7 @@
|
||||
#ifndef ENVELOPE
|
||||
#define ENVELOPE
|
||||
|
||||
#include "../include/synth.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
enum class Condition{
|
||||
Idle,
|
||||
@@ -14,29 +14,51 @@ enum class Condition{
|
||||
class Envelope{
|
||||
|
||||
public:
|
||||
Envelope(Synth& synth) : synth_(synth){
|
||||
Envelope(){
|
||||
condition = Condition::Idle;
|
||||
attack = 0.0;
|
||||
decay = 0.0;
|
||||
sustain = 0.0;
|
||||
release = 0.0;
|
||||
amplitude = 0.0;
|
||||
phase = 0.0;
|
||||
};
|
||||
attack_time = 0.8;
|
||||
decay_time = 1.0;
|
||||
sustain_level = 0.7;
|
||||
release_time = 0.2;
|
||||
currnet_amplitude = 0.0;
|
||||
rate = 0.0;
|
||||
sample_rate = 48000;
|
||||
note_is_pressed = false;
|
||||
}
|
||||
|
||||
Envelope(double attack, double decay, double sustain, double release){
|
||||
condition = Condition::Idle;
|
||||
attack_time = attack;
|
||||
decay_time = decay;
|
||||
sustain_level = sustain;
|
||||
release_time = release;
|
||||
currnet_amplitude = 0.0;
|
||||
rate = 0.0;
|
||||
sample_rate = 48000;
|
||||
note_is_pressed = false;
|
||||
}
|
||||
|
||||
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;
|
||||
double attack_time;
|
||||
|
||||
double decay_time;
|
||||
|
||||
double sustain_level;
|
||||
|
||||
double release_time;
|
||||
|
||||
double currnet_amplitude;
|
||||
double rate;
|
||||
|
||||
uint32_t sample_rate;
|
||||
|
||||
bool note_is_pressed;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user