feat: adsr gui
This commit is contained in:
@@ -33,4 +33,5 @@ class ADSR : public Effect {
|
||||
// void RetriggerState() override;
|
||||
void Process(std::vector<float>& samples) override;
|
||||
void Reset();
|
||||
void SetParameters(float attack, float decay, float sustain, float release);
|
||||
};
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
#include "SynthGuiState.h"
|
||||
#include "raylib.h"
|
||||
#include <vector>
|
||||
#include "ADSR.h"
|
||||
|
||||
class Renderer {
|
||||
private:
|
||||
void draw_main_panel(const Rectangle& panel_bounds);
|
||||
void draw_add_oscillator_button(Synth& synth, SynthGuiState& synth_gui,
|
||||
Rectangle panel_bounds);
|
||||
void draw_oscillators_panels(
|
||||
float draw_oscillators_panels(
|
||||
const std::vector<Oscillator*>& oscillators,
|
||||
const std::vector<OscillatorGuiState*>& gui_oscillators,
|
||||
const Rectangle& panel_bounds);
|
||||
@@ -18,7 +19,7 @@ class Renderer {
|
||||
const std::vector<OscillatorGuiState*>& guiOscillators);
|
||||
void draw_ui(Synth& synth, SynthGuiState& synth_gui);
|
||||
void draw_signal(Synth& synth, SynthGuiState& synth_gui);
|
||||
|
||||
void draw_adsr_panel(ADSR* adsr, ADSRGuiState& gui_adsr, const Rectangle& panel_bounds, float panel_y_offset);
|
||||
public:
|
||||
Renderer(/* args */);
|
||||
~Renderer();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Oscillator.h"
|
||||
#include "Settings.h"
|
||||
#include <vector>
|
||||
#include "ADSR.h"
|
||||
|
||||
class Synth {
|
||||
private:
|
||||
@@ -32,4 +33,5 @@ class Synth {
|
||||
const std::vector<float>& GetOutSignal() { return m_out_signal; }
|
||||
const std::vector<Oscillator*>& GetOscillators() { return m_oscillators; }
|
||||
const bool& GetIsNoteTriggered() { return is_note_triggered; }
|
||||
ADSR* GetADSR() { return (ADSR*)m_effects[0]; }
|
||||
};
|
||||
@@ -11,6 +11,14 @@ struct OscillatorGuiState {
|
||||
Rectangle shape_dropdown_rect;
|
||||
};
|
||||
|
||||
struct ADSRGuiState {
|
||||
float attack;
|
||||
float decay;
|
||||
float sustain;
|
||||
float release;
|
||||
};
|
||||
|
||||
struct SynthGuiState {
|
||||
std::vector<OscillatorGuiState*> oscillators;
|
||||
ADSRGuiState adsr;
|
||||
};
|
||||
Reference in New Issue
Block a user