diff options
Diffstat (limited to 'src/synth_engine.h')
-rw-r--r-- | src/synth_engine.h | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/src/synth_engine.h b/src/synth_engine.h index da15fe2..d01331f 100644 --- a/src/synth_engine.h +++ b/src/synth_engine.h @@ -12,12 +12,14 @@ #include "adsr.h" #include "control.h" #include "osc.h" - +#include "pa_ringbuffer.h" #ifndef M_PI #define M_PI (3.14159265) #endif +#define RING_SIZE 65536 + typedef struct lfo_t { float freq; float amp; @@ -38,11 +40,28 @@ typedef struct midi_note_t { int active; } midi_note_t; -typedef struct viz_t { - int sample_rate_divider; - float wave[VIZ_BUF]; - int wi; -} viz_t; +typedef struct { + int spectrum_enabled; + int wave_enabled; + int adsr_enabled; + int osc_enabled; + int freeze; + int rate_divider; + + float *wave_buffer_data; + PaUtilRingBuffer wave_buffer; + + float *fft_buffer_data; + PaUtilRingBuffer fft_buffer; + + float *tmp_buffer; + float *wave_viz_buffer; + float *fft_input_buffer; + float *fft_output_buffer; + float *fft_smooth_buffer; + + int tmp_index; +} synth_viz; typedef struct { PaStream *stream; @@ -55,12 +74,18 @@ typedef struct { cc_t cc_resonance; cc_t cc_lfo_freq; cc_t cc_lfo_amp; + cc_t cc_adsr_a; + cc_t cc_adsr_d; + cc_t cc_adsr_s; + cc_t cc_adsr_r; float gain; float x; midi_note_t midi_note[MIDI_NOTES]; + midi_note_t * midi_active[MIDI_NOTES]; + int midi_active_n; adsr_t adsr; @@ -89,9 +114,8 @@ typedef struct { int active; - viz_t viz; - viz_t fftviz; - + synth_viz viz; + osc_t * osctri; } synth_t; |