summaryrefslogtreecommitdiffstats
path: root/src/synth_gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/synth_gui.c')
-rw-r--r--src/synth_gui.c47
1 files changed, 38 insertions, 9 deletions
diff --git a/src/synth_gui.c b/src/synth_gui.c
index 89782ed..8aef751 100644
--- a/src/synth_gui.c
+++ b/src/synth_gui.c
@@ -165,7 +165,7 @@ draw_bars(synth_t * synth, int x, int y, int width, int height, int offset)
snprintf(buf, sizeof buf, "%.3f", synth->adsr.s);
synth->adsr.s = GuiSlider((Rectangle){ x, y + count++ * (height + offset), width, height }, "S: ", buf, synth->adsr.s , 0.0f, 1.0f);
snprintf(buf, sizeof buf, "%.3f", synth->adsr.r);
- synth->adsr.r = GuiSlider((Rectangle){ x, y + count++ * (height + offset), width, height }, "R: ", buf, synth->adsr.r , -0.001f, 3.0f);
+ synth->adsr.r = GuiSlider((Rectangle){ x, y + count++ * (height + offset), width, height }, "R: ", buf, synth->adsr.r , 0.001f, 3.0f);
snprintf(buf, sizeof buf, "%.3f", synth->cutoff);
synth->cutoff = GuiSliderBar((Rectangle){ x, y + count++ * (height + offset), width, height }, "fC: ", buf, synth->cutoff , 0.0f, 11000.0f);
/* snprintf(buf, sizeof buf, "%.3f", synth->resonance); */
@@ -189,10 +189,10 @@ draw_signals(synth_t * synth, int x, int y, int width, int height)
int point_radius = 1.5;
- GuiSpinner((Rectangle){ x+ 100, y - 24 - 6, 100, 24 }, "rate divider: ", &(synth->viz.sample_rate_divider), 1, 10, 0);
+ //GuiSpinner((Rectangle){ x+ 100, y - 24 - 6, 100, 24 }, "rate divider: ", &(synth->viz.sample_rate_divider), 1, 10, 0);
for (int i = x; i < WIDTH - x; i++) {
- DrawCircle(i , y + height / 2 + floor(250 * synth->viz.wave[i - x]), point_radius, MAGENTA);
+ DrawCircle(i , y + height / 2 + floor(250 * synth->viz.wave[i - x]), point_radius, RAYWHITE);
}
/* float adsr_duration = synth->adsr.a + synth->adsr.d + (synth->adsr.a + synth->adsr.d + synth->adsr.r) / 3.0 + synth->adsr.r; */
@@ -204,17 +204,46 @@ draw_signals(synth_t * synth, int x, int y, int width, int height)
/* DrawCircle(i , y + height - 1 + 4.5*floor((WIDTH / 24) * - fix_adsr(&synth->adsr, synth->midi_note[j].noteOn, synth->midi_note[j].noteOff, (i - x) * (adsr_duration * SAMPLE_RATE) / WIDTH, synth->midi_note[j].noteOffSample)), point_radius, BLUE); */
/* } */
/* } */
- for (int i = x; i < WIDTH - x; i++) {
- for (int j = 0; j < MIDI_NOTES; j++) {
- if (!synth->midi_note[j].active)
+ int c = 0;
+ for (int i = 0; i < MIDI_NOTES; i++) {
+ if (!synth->midi_note[i].active) continue;
+ c++;
+ }
+
+ int x_prev = x;
+ for (int i = 0; i < MIDI_NOTES; i++) {
+ if (!synth->midi_note[i].active)
continue;
- DrawCircle(i , y + height - 1 + 4.5*floor((WIDTH / 24) * - fix_adsr(&synth->adsr, synth->midi_note[j].noteOn, synth->midi_note[j].noteOff, synth->midi_note[j].elapsed, synth->midi_note[j].noteOffSample)), point_radius, GREEN);
+ int rec_y = y + height - 1 +
+ 4.5 * floor( (WIDTH / 24) *
+ - fix_adsr(&synth->adsr,
+ synth->midi_note[i].noteOn,
+ synth->midi_note[i].noteOff,
+ synth->midi_note[i].elapsed,
+ synth->midi_note[i].noteOffSample));
+
+ int rec_width = (WIDTH - x - x) / c;
+ int rec_height = HEIGHT - rec_y;
+
+ //DrawLine(x_prev, v, x_prev + (WIDTH - x) / c, v , WHITE);
+ DrawRectangleGradientV(x_prev, rec_y, rec_width, rec_height, ColorAlpha(GREEN, .2) ,ColorAlpha(RED, .2));
+ DrawRectangleLines(x_prev, rec_y, rec_width, rec_height, GRAY);
+ x_prev += rec_width;
}
- }
+
+
+ /* 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) * - fix_adsr(&synth->adsr, synth->midi_note[j].noteOn, synth->midi_note[j].noteOff, synth->midi_note[j].elapsed, synth->midi_note[j].noteOffSample)), point_radius, GREEN); */
+ /* } */
+ /* } */
}
-#include "raystyle.h"
+
void
rayrun(void *synthData){
synth_t * synth = (synth_t *)synthData;