Buffer works, but noteoff sometimes stops the wrong note, and triggers high pitched sound, need to investigate
This commit is contained in:
parent
16c22072a1
commit
0015cc0418
12
FM/FM.ino
12
FM/FM.ino
|
@ -81,13 +81,13 @@ void updateBuffer(byte bNote, bool bGate) {
|
||||||
// Removing the note from the array and shifting everything to close the gap
|
// Removing the note from the array and shifting everything to close the gap
|
||||||
for (int n = i; n <= bufferIndex; n++) {
|
for (int n = i; n <= bufferIndex; n++) {
|
||||||
noteBuffer[n] = noteBuffer[n + 1]; // what happens if it's the last note in buffer?
|
noteBuffer[n] = noteBuffer[n + 1]; // what happens if it's the last note in buffer?
|
||||||
}
|
}
|
||||||
if (i == bufferIndex) { //this does not fire
|
bufferIndex--;
|
||||||
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;
|
gate = 1;
|
||||||
playNote();
|
playNote();
|
||||||
} else { //this does fire
|
bufferIndex++;
|
||||||
bufferIndex--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue