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>
This commit is contained in:
Akihiro Sagawa 2018-04-05 00:40:44 +09:00 committed by Alexandre Julliard
parent 96896023ff
commit ec6bd187fe
2 changed files with 15 additions and 14 deletions

View File

@ -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 */

View File

@ -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 */