summaryrefslogtreecommitdiffstats
path: root/src/synth_gui.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2023-04-30 19:37:23 +0300
committergramanas <anastasis.gramm2@gmail.com>2023-04-30 19:37:23 +0300
commite77d4d42cacd21bf80e4f47cba2fe85f5a5b0991 (patch)
tree52bacf020ede328f9750316db51fdf6e91dc1661 /src/synth_gui.c
parent0cceb2057e382129ae24565fdefff87e91b076ab (diff)
downloadsynth-project-e77d4d42cacd21bf80e4f47cba2fe85f5a5b0991.tar.gz
synth-project-e77d4d42cacd21bf80e4f47cba2fe85f5a5b0991.tar.bz2
synth-project-e77d4d42cacd21bf80e4f47cba2fe85f5a5b0991.zip
Preparations for interpolating synth
Diffstat (limited to 'src/synth_gui.c')
-rw-r--r--src/synth_gui.c6
1 files changed, 3 insertions, 3 deletions
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);
}
}
}