Commit 05dc0e84 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Keep poly1 pitch env running after note off

parent 721b7b87
......@@ -7,7 +7,8 @@
#include "midi.h"
#include "notes.h"
static uint8_t notes[NUM_VOICES];
static uint8_t playing[NUM_VOICES];
static uint8_t current_note[NUM_VOICES];
static uint16_t current_bend;
void
......@@ -16,7 +17,8 @@ poly_init(void)
voice_init();
current_bend = BEND_CENTER;
for_each_voice(v) {
notes[v] = NUM_NOTES;
playing[v] = NUM_NOTES;
current_note[v] = NUM_NOTES;
}
}
......@@ -35,17 +37,17 @@ poly_note_on(uint8_t note)
return;
}
poly_set_pitch(v, note);
gate_on(v);
notes[v] = note;
playing[v] = note;
current_note[v] = note;
}
void
poly_note_off(uint8_t note)
{
for_each_voice(v) {
if (notes[v] == note) {
notes[v] = NUM_NOTES;
if (playing[v] == note) {
playing[v] = NUM_NOTES;
voice_release(v);
gate_off(v);
}
......@@ -69,9 +71,6 @@ void
poly_pitch_bend(uint16_t bend)
{
current_bend = bend;
for_each_voice(v) {
poly_set_pitch(v, notes[v]);
}
}
void
......@@ -80,6 +79,6 @@ poly_update_clock(uint8_t delta)
(void) delta;
for_each_voice(v) {
poly_set_pitch(v, notes[v]);
poly_set_pitch(v, current_note[v]);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment