From: Akihiro Sagawa Subject: [PATCH 4/4] winmm: Fix MEVT_LONGMSG handling in MIDI stream. Message-Id: <20180401234317.9094.375B48EC@gmail.com> Date: Sun, 01 Apr 2018 23:43:40 +0900 Signed-off-by: Akihiro Sagawa --- dlls/winmm/tests/midi.c | 2 +- dlls/winmm/winmm.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/winmm/tests/midi.c b/dlls/winmm/tests/midi.c index db5ae8f..9a36548 100644 --- a/dlls/winmm/tests/midi.c +++ b/dlls/winmm/tests/midi.c @@ -814,7 +814,7 @@ static void test_midiStream(UINT udev, HWND hwnd) e->dwEvent = MEVT_F_LONG | sizeof(SysEx_volume_off); memcpy(&e->dwParms[0], SysEx_volume_off, sizeof(SysEx_volume_off)); p += sizeof(MIDISHORTEVENT) + ROUNDUP4(sizeof(SysEx_volume_off)); - /* Note On (FIXME: we shouldn't hear this voice due to volume settings) */ + /* Note On (We can't hear this voice due to volume settings) */ e = (MIDIEVENT *)p; e->dwEvent = MEVT_F_SHORT | 0x6F4593; /* note #69 */ p += sizeof(MIDISHORTEVENT); diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c index 1412d5e..faeb474 100644 --- a/dlls/winmm/winmm.c +++ b/dlls/winmm/winmm.c @@ -1169,8 +1169,16 @@ start_header: /* do nothing, skip bytes */ break; case MEVT_LONGMSG: - midiOutLongMsg(lpMidiStrm->hDevice, lpMidiStrm->lpMidiHdr, MEVT_EVENTPARM(me->dwEvent)); - break; + { + MIDIHDR mh; + memset(&mh, 0, sizeof(mh)); + mh.lpData = (LPSTR)me->dwParms; + mh.dwBufferLength = MEVT_EVENTPARM(me->dwEvent); + midiOutPrepareHeader(lpMidiStrm->hDevice, &mh, sizeof(mh)); + midiOutLongMsg(lpMidiStrm->hDevice, &mh, sizeof(mh)); + midiOutUnprepareHeader(lpMidiStrm->hDevice, &mh, sizeof(mh)); + break; + } case MEVT_NOP: break; case MEVT_SHORTMSG: