13
0

MidiStateTracker::flush restore CC (bank) before PGM

This commit is contained in:
Robin Gareus 2022-09-10 06:00:12 +02:00
parent 5737468768
commit 5ad7361b28
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -346,17 +346,6 @@ MidiStateTracker::flush (MidiBuffer& dst, samplepos_t time, bool reset)
flush_notes (dst, time, reset);
for (size_t chn = 0; chn < n_channels; ++chn) {
if ((program[chn] & 0x80) == 0) {
buf[0] = MIDI_CMD_PGM_CHANGE|chn;
buf[1] = program[chn] & 0x7f;
dst.write (time, Evoral::MIDI_EVENT, 2, buf);
if (reset) {
program[chn] = 0x80;
}
}
}
for (size_t chn = 0; chn < n_channels; ++chn) {
for (size_t ctl = 0; ctl < n_controls; ++ctl) {
if ((control[chn][ctl] & 0x80) == 0) {
@ -369,5 +358,14 @@ MidiStateTracker::flush (MidiBuffer& dst, samplepos_t time, bool reset)
}
}
}
if ((program[chn] & 0x80) == 0) {
buf[0] = MIDI_CMD_PGM_CHANGE|chn;
buf[1] = program[chn] & 0x7f;
dst.write (time, Evoral::MIDI_EVENT, 2, buf);
if (reset) {
program[chn] = 0x80;
}
}
}
}