From f170fb058a07175e6e753f2a6d20283dc7200a88 Mon Sep 17 00:00:00 2001 From: gramanas Date: Wed, 28 Jun 2023 22:41:03 +0300 Subject: Add wavetable synthesis --- src/synth_gui.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/synth_gui.c') diff --git a/src/synth_gui.c b/src/synth_gui.c index d39995b..ee4ae05 100644 --- a/src/synth_gui.c +++ b/src/synth_gui.c @@ -14,18 +14,17 @@ keyboard(void *synthData, PaStream *stream) for (int i = 0; keys[i]; i++) { if (IsKeyPressed(keys[i])) { - note = notes[i % 12][(synth->octave + (i / 12)) % 8]; - if (note) { - //printf("Note On : %s[%d] %fHz\n", int_to_note(i % 12), (synth->octave + (i / 12)) % 8, note); - synth->midi_note[i].freq = 16.35160 * pow(2, (synth->octave + i / 12.0)); //notes[i % 12][(synth->octave + (i / 12)) % 8]; - //synth->midi_note[i].freq = notes[i % 12][(synth->octave + (i / 12)) % 8]; - synth->midi_note[i].channel = -1; - synth->midi_note[i].noteOn = Pa_GetStreamTime(synth->stream); - synth->midi_note[i].noteOff = 0; - synth->midi_note[i].velocity = 1.0; - synth->midi_note[i].elapsed = 0; - synth->midi_note[i].active = 1; - } + //printf("Note On : %s[%d] %fHz\n", int_to_note(i % 12), (synth->octave + (i / 12)) % 8, note); + synth->midi_note[i].freq = 16.35160 * pow(2, (synth->octave + i / 12.0)); + //synth->midi_note[i].freq = notes[i % 12][(synth->octave + (i / 12)) % 8]; + synth->midi_note[i].channel = -1; + synth->midi_note[i].noteOn = Pa_GetStreamTime(synth->stream); + synth->midi_note[i].noteOff = 0; + synth->midi_note[i].velocity = 1.0; + synth->midi_note[i].elapsed = 0; + synth->midi_note[i].active = 1; + //synth->adsr.elapsed = 0; + synth->active = 1; } } for (int i = 0; keys[i]; i++) { -- cgit v1.2.3