13
0

When muting MIDI, silence all playing notes

All-note-off event (CC 123) needs to be accompanied
with raising the sustain-pedal (CC 64).
This commit is contained in:
Robin Gareus 2019-09-09 17:10:04 +02:00
parent cd6e074e92
commit 7afb068fa6
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -233,7 +233,9 @@ Amp::apply_gain (BufferSet& bufs, samplecnt_t sample_rate, samplecnt_t nframes,
/* queue MIDI all-note-off when going silent */
if (initial > GAIN_COEFF_SMALL && rv <= GAIN_COEFF_SMALL) {
for (uint8_t channel = 0; channel <= 0xF; channel++) {
uint8_t ev[3] = { ((uint8_t) (MIDI_CMD_CONTROL | channel)), ((uint8_t) MIDI_CTL_ALL_NOTES_OFF), 0 };
uint8_t ev[3] = { ((uint8_t) (MIDI_CMD_CONTROL | channel)), ((uint8_t) MIDI_CTL_SUSTAIN), 0 };
mb.push_back (nframes - 1, 3, ev);
ev[1] = MIDI_CTL_ALL_NOTES_OFF;
mb.push_back (nframes - 1, 3, ev);
}
}