summaryrefslogtreecommitdiffstats
path: root/src/synth_gui.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2023-06-28 22:41:03 +0300
committergramanas <anastasis.gramm2@gmail.com>2023-06-28 22:41:03 +0300
commitf170fb058a07175e6e753f2a6d20283dc7200a88 (patch)
treee43c20efa7efe12fbe1828777474669f9ac01135 /src/synth_gui.c
parent89e85142d0958d3e3a87fb155d698fc59eafd4c6 (diff)
downloadsynth-project-f170fb058a07175e6e753f2a6d20283dc7200a88.tar.gz
synth-project-f170fb058a07175e6e753f2a6d20283dc7200a88.tar.bz2
synth-project-f170fb058a07175e6e753f2a6d20283dc7200a88.zip
Add wavetable synthesis
Diffstat (limited to 'src/synth_gui.c')
-rw-r--r--src/synth_gui.c23
1 files changed, 11 insertions, 12 deletions
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++) {