Module: wine Branch: master Commit: ec6bd187fe80a8e3109110398211658d6fb1030d URL: https://source.winehq.org/git/wine.git/?a=commit;h=ec6bd187fe80a8e3109110398...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Thu Apr 5 00:40:44 2018 +0900
midimap: Open lower devices when opening MIDI Mapper.
Without this change, the lower device can't get a long message at the beginning. The mapper didn't open it before receiving a short message in modData function.
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com Signed-off-by: Andrew Eikum aeikum@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/midimap/midimap.c | 27 ++++++++++++++------------- dlls/winmm/tests/midi.c | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/dlls/midimap/midimap.c b/dlls/midimap/midimap.c index 16707bb..1b35da7 100644 --- a/dlls/midimap/midimap.c +++ b/dlls/midimap/midimap.c @@ -283,13 +283,25 @@ static DWORD modOpen(DWORD_PTR *lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
if (MIDIMAP_LoadSettings(mom)) { + UINT chn; *lpdwUser = (DWORD_PTR)mom; mom->self = mom; - mom->wCbFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK); mom->midiDesc = *lpDesc; - MIDIMAP_NotifyClient(mom, MOM_OPEN, 0L, 0L);
+ for (chn = 0; chn < 16; chn++) + { + if (mom->ChannelMap[chn]->loaded) continue; + if (midiOutOpen(&mom->ChannelMap[chn]->hMidi, mom->ChannelMap[chn]->uDevID, + 0L, 0L, CALLBACK_NULL) == MMSYSERR_NOERROR) + mom->ChannelMap[chn]->loaded = 1; + else + mom->ChannelMap[chn]->loaded = -1; + /* FIXME: should load here the IDF midi data... and allow channel and + * patch mappings + */ + } + MIDIMAP_NotifyClient(mom, MOM_OPEN, 0L, 0L); return MMSYSERR_NOERROR; } HeapFree(GetProcessHeap(), 0, mom); @@ -381,17 +393,6 @@ static DWORD modData(MIDIMAPDATA* mom, DWORD_PTR dwParam) case 0xC0: case 0xD0: case 0xE0: - if (mom->ChannelMap[chn]->loaded == 0) - { - if (midiOutOpen(&mom->ChannelMap[chn]->hMidi, mom->ChannelMap[chn]->uDevID, - 0L, 0L, CALLBACK_NULL) == MMSYSERR_NOERROR) - mom->ChannelMap[chn]->loaded = 1; - else - mom->ChannelMap[chn]->loaded = -1; - /* FIXME: should load here the IDF midi data... and allow channel and - * patch mappings - */ - } if (mom->ChannelMap[chn]->loaded > 0) { /* change channel */ diff --git a/dlls/winmm/tests/midi.c b/dlls/winmm/tests/midi.c index 763ed2f..4805123 100644 --- a/dlls/winmm/tests/midi.c +++ b/dlls/winmm/tests/midi.c @@ -461,7 +461,7 @@ static void test_midiOut_device(UINT udev, HWND hwnd) trace("ShortMsg type %x (muted)\n", LOBYTE(LOWORD(e))); rc = midiOutShortMsg(hm, e); ok(!rc, "midiOutShortMsg rc=%s\n", mmsys_error(rc)); - /* FIXME (for MIDI Mapper): we shouldn't hear this voice due to volume settings */ + /* We can't hear this voice due to volume settings */ if (!rc) Sleep(200);
rc = midiOutShortMsg(hm, 0x00004593); /* velocity 0 */