адаптация s13bby/osc под vst и gui. (вайбкод)
вайбкод потому что мне в моменте стало понятно. что проще было сразу писать на фреймворке JUCE, чем адаптировать консольное приложение на MiniAudio. обновляться данный репозиторий не будет. СmakeLists адаптирован онли под linux.
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
#ifndef ENVELOPE
|
||||
#define ENVELOPE
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum class Condition{
|
||||
Idle,
|
||||
Attack,
|
||||
Decay,
|
||||
Sustain,
|
||||
Release
|
||||
};
|
||||
|
||||
class Envelope{
|
||||
|
||||
public:
|
||||
Envelope(){
|
||||
condition = Condition::Idle;
|
||||
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.0;
|
||||
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.0;
|
||||
note_is_pressed = false;
|
||||
}
|
||||
|
||||
void set_sample_rate(double sample_rate_);
|
||||
void set_attack(double value);
|
||||
void set_decay(double value);
|
||||
void set_sustain(double value);
|
||||
void set_release(double value);
|
||||
void note_on();
|
||||
void note_off();
|
||||
|
||||
double process();
|
||||
|
||||
bool is_idle() const;
|
||||
bool is_release() const;
|
||||
|
||||
private:
|
||||
Condition condition;
|
||||
|
||||
double attack_time;
|
||||
|
||||
double decay_time;
|
||||
|
||||
double sustain_level;
|
||||
|
||||
double release_time;
|
||||
|
||||
double currnet_amplitude;
|
||||
double rate;
|
||||
|
||||
double sample_rate;
|
||||
|
||||
bool note_is_pressed;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user