Buffer works, but noteoff sometimes stops the wrong note, and triggers high pitched sound, need to investigate

This commit is contained in:
Oleksiy 2021-03-03 13:06:56 +02:00
parent 16c22072a1
commit 0015cc0418
1 changed files with 6 additions and 6 deletions

View File

@ -82,12 +82,12 @@ void updateBuffer(byte bNote, bool bGate) {
for (int n = i; n <= bufferIndex; n++) {
noteBuffer[n] = noteBuffer[n + 1]; // what happens if it's the last note in buffer?
}
if (i == bufferIndex) { //this does not fire
bufferIndex--;
if (i == bufferIndex) {
bufferIndex--; //we need to play the notefrom previous cell of buffer write index, that's where -- and ++ come from
gate = 1;
playNote();
} else { //this does fire
bufferIndex--;
bufferIndex++;
}
}
}