diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2023-11-27 18:33:42 +0200 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2023-11-27 18:33:42 +0200 |
commit | 4f7de09c753ece6f2099512522d489b0104a59a8 (patch) | |
tree | b9983c044bee6f553b90b914bf63ee5c1aa2aaf0 /src/midi.c | |
parent | b0128e30840dff1e7db7bcfd69e6fa4f09ed5fbe (diff) | |
download | synth-project-4f7de09c753ece6f2099512522d489b0104a59a8.tar.gz synth-project-4f7de09c753ece6f2099512522d489b0104a59a8.tar.bz2 synth-project-4f7de09c753ece6f2099512522d489b0104a59a8.zip |
cc adsr and ui
Diffstat (limited to 'src/midi.c')
-rw-r--r-- | src/midi.c | 29 |
1 files changed, 20 insertions, 9 deletions
@@ -44,22 +44,26 @@ void midi_decode(uint32_t msg, synth_t * synth) { printf("Aftertouch: channel=%d, note=%d, pressure=%d\n", channel, data1, data2); break; case 0x0B: - // printf("Control Change: channel=%d, controller=%d, value=%d\n", channel, data1, data2); + printf("Control Change: channel=%d, controller=%d, value=%d\n", channel, data1, data2); int x = data2 < 64 ? 1 : -1; switch (data1) { case 0: - synth->adsr.a = synth->adsr.a + (x * 0.01); + cc_step(&synth->cc_adsr_a, x); + //synth->adsr.a = synth->adsr.a + (x * 0.01); //synth->freq_offset = synth->freq_offset + (x*5); //cc_step(&synth->cc_cutoff, x); break; case 1: - synth->adsr.d = synth->adsr.d + (x * 0.01); + cc_step(&synth->cc_adsr_d, x); + //synth->adsr.d = synth->adsr.d + (x * 0.01); break; case 2: - synth->adsr.s = synth->adsr.s + (x * 0.01); + cc_step(&synth->cc_adsr_s, x); + //synth->adsr.s = synth->adsr.s + (x * 0.01); break; case 3: - synth->adsr.r = synth->adsr.r + (x * 0.01); + cc_step(&synth->cc_adsr_r, x); + //synth->adsr.r = synth->adsr.r + (x * 0.01); break; case 4: cc_step(&synth->cc_cutoff, x); @@ -69,18 +73,25 @@ void midi_decode(uint32_t msg, synth_t * synth) { cc_step(&synth->cc_resonance, x); break; case 6: - cc_step(&synth->cc_pitch, x); + //cc_step(&synth->cc_pitch, x); + cc_step(&synth->cc_lfo_freq, x); //synth->lfo.freq = synth->lfo.freq + (x * 0.1); break; case 7: - cc_reset(&synth->cc_pitch); - synth->lfo.amp = synth->lfo.amp + (x * 0.002); + //cc_reset(&synth->cc_pitch); + cc_step(&synth->cc_lfo_amp, x); + //synth->lfo.amp = synth->lfo.amp + (x * 0.002); break; + case 8: + //cc_reset(&synth->cc_pitch); + synth->wvt_pos = data2; + //synth->lfo.amp = synth->lfo.amp + (x * 0.002); break; case 28: - synth->filter = x - 1; + if (synth->geni > 0) synth->geni--; break; case 29: + if (synth->geni < 6) synth->geni++; break; default: } |