Browse Source

MIDI CV: When sustain pedal is released, disable gate if no notes are held.

tags/v2.6.0
Andrew Belt 11 months ago
parent
commit
195bae86bc
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      src/core/MIDI_CV.cpp

+ 7
- 0
src/core/MIDI_CV.cpp View File

@@ -399,16 +399,23 @@ struct MIDI_CV : Module {
// Set last note if monophonic // Set last note if monophonic
if (channels == 1) { if (channels == 1) {
if (!heldNotes.empty()) { if (!heldNotes.empty()) {
// Replace note with last held note
uint8_t lastNote = heldNotes.back(); uint8_t lastNote = heldNotes.back();
notes[0] = lastNote; notes[0] = lastNote;
} }
else {
// Disable gate
gates[0] = false;
}
} }
// Clear notes that are not held if polyphonic // Clear notes that are not held if polyphonic
else { else {
for (int c = 0; c < channels; c++) { for (int c = 0; c < channels; c++) {
if (!gates[c]) if (!gates[c])
continue; continue;
// Disable all gates
gates[c] = false; gates[c] = false;
// Re-enable gate if channel's note is still held
for (uint8_t note : heldNotes) { for (uint8_t note : heldNotes) {
if (notes[c] == note) { if (notes[c] == note) {
gates[c] = true; gates[c] = true;


Loading…
Cancel
Save