aha
This commit is contained in:
1 parent
15ab48343a
commit
c017d27b2a
11 files changed
+1554
-263
No files matched your search
@@ -18,6 +18,7 @@ public:
|
||||
virtual void control_change(uint8_t ch, uint8_t cc, uint8_t val) = 0;
|
||||
virtual void pitch_bend(uint8_t ch, int16_t bend14) = 0; // -8192..+8191
|
||||
virtual void all_notes_off() = 0;
|
||||
virtual void reset() = 0;
|
||||
virtual void render(float* stereo_out, int frames) = 0;
|
||||
};
|
||||
|
||||
@@ -37,6 +38,7 @@ public:
|
||||
void control_change(uint8_t ch, uint8_t cc, uint8_t val) override;
|
||||
void pitch_bend(uint8_t ch, int16_t bend14) override;
|
||||
void all_notes_off() override;
|
||||
void reset() override;
|
||||
void render(float* stereo_out, int frames) override;
|
||||
|
||||
private:
|
||||
@@ -45,13 +47,14 @@ private:
|
||||
struct Operator {
|
||||
double phase = 0.0;
|
||||
double phase_inc = 0.0;
|
||||
float env = 0.0f; // 0..1 linear amplitude
|
||||
float env = 0.0f; // 0..1 linear amplitude
|
||||
float env_db = 96.0f; // 0 dB = peak, 96 dB = silence
|
||||
EnvStage stage = EnvStage::Off;
|
||||
float attack_rate = 0.0f;
|
||||
float decay_rate = 0.0f;
|
||||
float sustain_level = 0.5f;
|
||||
float release_rate = 0.0f;
|
||||
float total_level = 1.0f; // linear scale from TL + KSL + vel
|
||||
float decay_rate = 0.0f; // dB/s
|
||||
float sustain_db = 12.0f; // dB attenuation
|
||||
float release_rate = 0.0f; // dB/s
|
||||
float total_level = 1.0f; // linear scale from TL + KSL + vel
|
||||
uint8_t wave = 0;
|
||||
bool am = false;
|
||||
bool vib = false;
|
||||
@@ -60,6 +63,7 @@ private:
|
||||
|
||||
struct Voice {
|
||||
bool active = false;
|
||||
bool sustained = false;
|
||||
uint8_t channel = 0;
|
||||
uint8_t key = 0;
|
||||
uint8_t velocity = 100;
|
||||
@@ -76,14 +80,18 @@ private:
|
||||
struct ChannelState {
|
||||
uint8_t program = 0;
|
||||
uint8_t bank = 0;
|
||||
float volume = 1.0f;
|
||||
float expression = 1.0f;
|
||||
float volume_target = 1.0f;
|
||||
float vol_smooth = 1.0f;
|
||||
float expr_target = 1.0f;
|
||||
float expr_smooth = 1.0f;
|
||||
float pan = 0.0f; // -1..+1
|
||||
float pitch_bend_semitones = 0.0f;
|
||||
bool sustain_pedal = false;
|
||||
};
|
||||
|
||||
void setup_operator(Operator& op, uint8_t reg20, uint8_t reg40, uint8_t reg60,
|
||||
uint8_t reg80, uint8_t regE0, float base_freq, float vel_scale, bool is_carrier);
|
||||
uint8_t reg80, uint8_t regE0, float base_freq, float midi_note,
|
||||
float vel_scale, bool is_carrier);
|
||||
void step_envelope(Operator& op, float dt);
|
||||
static float eval_waveform(uint8_t wave, double phase);
|
||||
void update_voice_freq(Voice& v);
|
||||
|
||||
Reference in new issue
Block a user