midimap: Implement callback/notification.
This commit is contained in:
parent
788d8720e7
commit
a8b8078704
|
@ -92,6 +92,8 @@ typedef struct tagMIDIMAPDATA
|
||||||
{
|
{
|
||||||
struct tagMIDIMAPDATA* self;
|
struct tagMIDIMAPDATA* self;
|
||||||
MIDIOUTPORT* ChannelMap[16];
|
MIDIOUTPORT* ChannelMap[16];
|
||||||
|
MIDIOPENDESC midiDesc;
|
||||||
|
WORD wCbFlags;
|
||||||
} MIDIMAPDATA;
|
} MIDIMAPDATA;
|
||||||
|
|
||||||
static MIDIOUTPORT* midiOutPorts;
|
static MIDIOUTPORT* midiOutPorts;
|
||||||
|
@ -258,6 +260,13 @@ static BOOL MIDIMAP_LoadSettings(MIDIMAPDATA* mom)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void MIDIMAP_NotifyClient(MIDIMAPDATA* mom, WORD wMsg,
|
||||||
|
DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||||
|
{
|
||||||
|
DriverCallback(mom->midiDesc.dwCallback, mom->wCbFlags, (HDRVR)mom->midiDesc.hMidi,
|
||||||
|
wMsg, mom->midiDesc.dwInstance, dwParam1, dwParam2);
|
||||||
|
}
|
||||||
|
|
||||||
static DWORD modOpen(DWORD_PTR *lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
|
static DWORD modOpen(DWORD_PTR *lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
MIDIMAPDATA* mom = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIMAPDATA));
|
MIDIMAPDATA* mom = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIMAPDATA));
|
||||||
|
@ -265,11 +274,9 @@ static DWORD modOpen(DWORD_PTR *lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
|
||||||
TRACE("(%p %p %08x)\n", lpdwUser, lpDesc, dwFlags);
|
TRACE("(%p %p %08x)\n", lpdwUser, lpDesc, dwFlags);
|
||||||
|
|
||||||
if (!mom) return MMSYSERR_NOMEM;
|
if (!mom) return MMSYSERR_NOMEM;
|
||||||
|
if (!lpDesc) {
|
||||||
if (HIWORD(dwFlags & CALLBACK_TYPEMASK)) {
|
|
||||||
FIXME("NIY callback flags %08x\n", dwFlags);
|
|
||||||
HeapFree(GetProcessHeap(), 0, mom);
|
HeapFree(GetProcessHeap(), 0, mom);
|
||||||
return MMSYSERR_INVALFLAG;
|
return MMSYSERR_INVALPARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MIDIMAP_LoadSettings(mom))
|
if (MIDIMAP_LoadSettings(mom))
|
||||||
|
@ -277,6 +284,10 @@ static DWORD modOpen(DWORD_PTR *lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
|
||||||
*lpdwUser = (DWORD_PTR)mom;
|
*lpdwUser = (DWORD_PTR)mom;
|
||||||
mom->self = mom;
|
mom->self = mom;
|
||||||
|
|
||||||
|
mom->wCbFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
|
||||||
|
mom->midiDesc = *lpDesc;
|
||||||
|
MIDIMAP_NotifyClient(mom, MOM_OPEN, 0L, 0L);
|
||||||
|
|
||||||
return MMSYSERR_NOERROR;
|
return MMSYSERR_NOERROR;
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, mom);
|
HeapFree(GetProcessHeap(), 0, mom);
|
||||||
|
@ -305,8 +316,10 @@ static DWORD modClose(MIDIMAPDATA* mom)
|
||||||
ret = t;
|
ret = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == MMSYSERR_NOERROR)
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
|
MIDIMAP_NotifyClient(mom, MOM_CLOSE, 0L, 0L);
|
||||||
HeapFree(GetProcessHeap(), 0, mom);
|
HeapFree(GetProcessHeap(), 0, mom);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +355,7 @@ static DWORD modLongData(MIDIMAPDATA* mom, LPMIDIHDR lpMidiHdr, DWORD_PTR dwPara
|
||||||
}
|
}
|
||||||
lpMidiHdr->dwFlags &= ~MHDR_INQUEUE;
|
lpMidiHdr->dwFlags &= ~MHDR_INQUEUE;
|
||||||
lpMidiHdr->dwFlags |= MHDR_DONE;
|
lpMidiHdr->dwFlags |= MHDR_DONE;
|
||||||
|
MIDIMAP_NotifyClient(mom, MOM_DONE, (DWORD_PTR)lpMidiHdr, 0L);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,9 +203,6 @@ static void test_midiOut_device(UINT udev, HWND hwnd)
|
||||||
rc = midiOutOpen(&hm, udev, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
rc = midiOutOpen(&hm, udev, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
||||||
else
|
else
|
||||||
rc = midiOutOpen(&hm, udev, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
rc = midiOutOpen(&hm, udev, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
||||||
if (MIDIMAPPER==udev) todo_wine
|
|
||||||
ok(!rc, "midiOutOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
||||||
else
|
|
||||||
ok(!rc, "midiOutOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
ok(!rc, "midiOutOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
||||||
if (rc) return;
|
if (rc) return;
|
||||||
|
|
||||||
|
@ -316,9 +313,6 @@ static void test_midiStream(UINT udev, HWND hwnd)
|
||||||
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
||||||
else
|
else
|
||||||
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
||||||
if (MIDIMAPPER==udev) todo_wine
|
|
||||||
ok(!rc, "midiStreamOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
||||||
else
|
|
||||||
ok(!rc, "midiStreamOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
ok(!rc, "midiStreamOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
||||||
if (rc) return;
|
if (rc) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue