From 4fcace9aed211519f83f45fe209c88e37a902a03 Mon Sep 17 00:00:00 2001 From: Bernhard Schelling <14200249+schellingb@users.noreply.github.com> Date: Wed, 13 Jan 2021 02:07:21 +0900 Subject: [PATCH] Recover from messages not handled by the device When an underlying MIDI device does not understand/support a MIDI message (very common with sysex messages) it returns an error code. With this fix MIDI output can continue gracefully even after an emulated game sends an unsupported message. --- midi/drivers/winmm_midi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/midi/drivers/winmm_midi.c b/midi/drivers/winmm_midi.c index 2cec9187c0..f7d3d76475 100644 --- a/midi/drivers/winmm_midi.c +++ b/midi/drivers/winmm_midi.c @@ -605,6 +605,10 @@ static bool winmm_midi_flush(void *p) #ifdef DEBUG RARCH_ERR("[MIDI]: midiStreamOut failed with error %d.\n", mmr); #endif + // Core sent MIDI message not understood by the MIDI driver + // Make this buffer available to be used again + buf->header.dwFlags |= MHDR_DONE; + buf->header.dwFlags &= ~MHDR_INQUEUE; return false; }