summaryrefslogtreecommitdiffstats
path: root/src/synth_engine_v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/synth_engine_v2.c')
-rw-r--r--src/synth_engine_v2.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/synth_engine_v2.c b/src/synth_engine_v2.c
index a3c6efa..9beae33 100644
--- a/src/synth_engine_v2.c
+++ b/src/synth_engine_v2.c
@@ -177,7 +177,11 @@ make_sample(synth_t * synth, unsigned int sample_rate, int frame)
rms = sqrt(rms / (float)synth->midi_active_n);
//float max = get_max_sample(synth, 20);
-
+ synth->adsr.a = CC_GET(adsr_a);
+ synth->adsr.d = CC_GET(adsr_d);
+ synth->adsr.s = CC_GET(adsr_s);
+ synth->adsr.r = CC_GET(adsr_r);
+
for (int i = 0; i < synth->midi_active_n; i++) {
note = synth->midi_active[i];
float adsr = fix_adsr(&synth->adsr,
@@ -240,7 +244,6 @@ get_frame(void *outputBuffer, synth_t *synth, int i)
float *out = (float*)outputBuffer + 2 * i;
float s = 0.0f;
-
if (!notes_active(synth)) {
synth->active = 0;
}
@@ -338,15 +341,16 @@ init_synth(void)
if (!synth) return NULL;
synth->cci = 0;
- CC(synth->cc_cutoff, "cutoff", 10, 22000, 30, 5000);
+ // CC(SYNTH, NAME, MIN, MAX, STEP, DEF)
+ CC(synth->cc_cutoff, "cutoff", 10, 22000, 30, 5000);
CC(synth->cc_resonance, "resonance", 1, 10, .02, 1);
CC(synth->cc_lfo_freq, "lfo_freq", 1, 1000, 2, 1);
CC(synth->cc_lfo_amp, "lfo_amp", 0, 1, .01f, 0);
CC(synth->cc_pitch, "pitch", -3, 4, 0.01f, 1);
- CC(synth->cc_adsr_a, "attack", 0, 3, 0.05f, 0.00);
- CC(synth->cc_adsr_d, "decay", 0, 2, 0.05f, 0.3);
- CC(synth->cc_adsr_s, "sustain", 0, 1.0f, 0.05f, 0.7f);
- CC(synth->cc_adsr_r, "release", 0, 5, 0.05f, 0.2f);
+ CC(synth->cc_adsr_a, "attack", 0, 3, 0.01f, 0.00);
+ CC(synth->cc_adsr_d, "decay", 0, 2, 0.01f, 0.3);
+ CC(synth->cc_adsr_s, "sustain", 0, 1.0f, 0.01f, 0.7f);
+ CC(synth->cc_adsr_r, "release", 0, 5, 0.01f, 0.2f);
synth->modi = 0;
@@ -424,12 +428,15 @@ init_synth(void)
synth->viz.fft_output_buffer = (float *)calloc(sizeof(float), RING_SIZE * 8);
synth->viz.fft_smooth_buffer = (float *)calloc(sizeof(float), RING_SIZE * 8);
- synth->viz.spectrum_enabled = 1;
+ synth->viz.spectrum_enabled = 0;
synth->viz.wave_enabled = 0;
synth->viz.adsr_enabled = 0;
+ synth->viz.adsr_graph_enabled = 1;
synth->viz.osc_enabled = 0;
synth->viz.freeze = 0;
synth->viz.tmp_index = 0;
+
+ synth->wvt_pos = 0;
}
void