Akihiro Sagawa : winmm: Fix MEVT_LONGMSG handling in MIDI stream.

Alexandre Julliard julliard at winehq.org
Mon Apr 9 15:41:09 CDT 2018


Module: wine
Branch: master
Commit: 185d98bbfdbf7ef10ef52d0264a5a38aedd3b19d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=185d98bbfdbf7ef10ef52d0264a5a38aedd3b19d

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Thu Apr  5 00:41:24 2018 +0900

winmm: Fix MEVT_LONGMSG handling in MIDI stream.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 0ea3d92..97cef2d 100644
--- a/dlls/winmm/tests/midi.c
+++ b/dlls/winmm/tests/midi.c
@@ -819,7 +819,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:




More information about the wine-cvs mailing list