From: Brendan Shanks bshanks@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57805 --- dlls/winecoreaudio.drv/coremidi.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 9b1fbd28f6a..113d5d267b4 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -648,6 +648,7 @@ static UINT midi_out_data(WORD dev_id, UINT data) { struct midi_dest *dest; UInt8 bytes[3]; + size_t count = sizeof(bytes); OSStatus sc;
TRACE("dev_id = %d data = %08x\n", dev_id, data); @@ -692,7 +693,23 @@ static UINT midi_out_data(WORD dev_id, UINT data) } else { - midi_send(midi_out_port, dest->dest, bytes, sizeof(bytes)); + /* MODM_DATA always includes 3 bytes, but some message types are only + * 1 or 2 bytes long. The docs say that "The driver must parse the event + * to determine how many bytes to transfer" + * + * Sending 3 bytes seems to work for most 1/2 byte messages + * (Core MIDI must be doing some parsing), but some 2 byte messages + * result in duplicates if all 3 bytes are sent. + */ + switch (bytes[0] & 0xF0) + { + case 0xC0: /* Program Change */ + case 0xD0: /* Channel Pressure (After-touch) */ + count = 2; + break; + } + + midi_send(midi_out_port, dest->dest, bytes, count); }
return MMSYSERR_NOERROR;
This merge request was approved by Huw Davies.