From e77d4d42cacd21bf80e4f47cba2fe85f5a5b0991 Mon Sep 17 00:00:00 2001 From: gramanas Date: Sun, 30 Apr 2023 19:37:23 +0300 Subject: Preparations for interpolating synth --- src/synth_gui.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/synth_gui.c') diff --git a/src/synth_gui.c b/src/synth_gui.c index df219ba..4f9f5a3 100644 --- a/src/synth_gui.c +++ b/src/synth_gui.c @@ -101,21 +101,21 @@ draw_signals(synth_t * synth, int x, int y, int width, int height) DrawCircle(i , y + height / 2 + floor(250 * synth->viz.wave[i - x]), point_radius, MAGENTA); } + float adsr_duration = synth->adsr.a + synth->adsr.d + (synth->adsr.a + synth->adsr.d + synth->adsr.r) / 3.0 + synth->adsr.r; for (int i = x; i < WIDTH - x; i++) { for (int j = 0; j < MIDI_NOTES; j++) { if (!synth->midi_note[j].active) continue; - DrawCircle(i , y + height - 1 + 4.5*floor((WIDTH / 24) * - adsr_amplitude(&synth->adsr, synth->midi_note[j].noteOn, synth->midi_note[j].noteOff, synth->midi_note[j].elapsed)), point_radius, GREEN); + DrawCircle(i , y + height - 1 + 4.5*floor((WIDTH / 24) * - adsr_amplitude(&synth->adsr, synth->midi_note[j].noteOn, synth->midi_note[j].noteOff, (i - x) * (adsr_duration * SAMPLE_RATE) / WIDTH)), point_radius, BLUE); } } - float adsr_duration = synth->adsr.a + synth->adsr.d + (synth->adsr.a + synth->adsr.d + synth->adsr.r) / 3.0 + synth->adsr.r; for (int i = x; i < WIDTH - x; i++) { for (int j = 0; j < MIDI_NOTES; j++) { if (!synth->midi_note[j].active) continue; - DrawCircle(i , y + height - 1 + 4.5*floor((WIDTH / 24) * - adsr_amplitude(&synth->adsr, synth->midi_note[j].noteOn, synth->midi_note[j].noteOff, (i - x) * (adsr_duration * SAMPLE_RATE) / WIDTH)), point_radius, BLUE); + DrawCircle(i , y + height - 1 + 4.5*floor((WIDTH / 24) * - adsr_amplitude(&synth->adsr, synth->midi_note[j].noteOn, synth->midi_note[j].noteOff, synth->midi_note[j].elapsed)), point_radius, GREEN); } } } -- cgit v1.2.3