Commit af8e5f55 by Jacob Vosmaer

Fix note off order

parent 4f491184
......@@ -110,14 +110,20 @@ voice_acquire(uint8_t key)
uint8_t
voice_release(uint8_t key)
{
for (uint8_t v = 0; v < NUM_VOICES; v++) {
if (keys[v] == key) {
playing_release(v);
avail_enqueue(v);
return v;
{
// Find oldest voice playing key
uint8_t v = NUM_VOICES;
for (uint8_t i = playing_head; i != NUM_VOICES; i = playing[i]) {
if (keys[i] == key) {
v = i;
}
}
return NUM_VOICES;
if (v == NUM_VOICES) {
return NUM_VOICES;
}
playing_release(v);
avail_enqueue(v);
return 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