winmm: Implement CALLBACK_WINDOW.
This commit is contained in:
parent
8a5b6df483
commit
35a8ee9340
|
@ -378,8 +378,18 @@ static void mixer_test_deviceA(int device)
|
||||||
|
|
||||||
rc=mixerOpen(&mix, device, 0, 0, 0);
|
rc=mixerOpen(&mix, device, 0, 0, 0);
|
||||||
ok(rc==MMSYSERR_NOERROR,
|
ok(rc==MMSYSERR_NOERROR,
|
||||||
"mixerOpen: MMSYSERR_BADDEVICEID expected, got %s\n",mmsys_error(rc));
|
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",mmsys_error(rc));
|
||||||
if (rc==MMSYSERR_NOERROR) {
|
if (rc==MMSYSERR_NOERROR) {
|
||||||
|
rc=mixerOpen(&mix, device, 0, 0, CALLBACK_FUNCTION);
|
||||||
|
ok(rc==MMSYSERR_INVALFLAG,
|
||||||
|
"mixerOpen: MMSYSERR_INVALFLAG expected, got %s\n", mmsys_error(rc));
|
||||||
|
|
||||||
|
/* Shouldn't open without a valid HWND */
|
||||||
|
rc=mixerOpen(&mix, device, 0, 0, CALLBACK_WINDOW);
|
||||||
|
ok(rc==MMSYSERR_INVALPARAM,
|
||||||
|
"mixerOpen: MMSYSERR_INVALPARAM expected, got %s\n", mmsys_error(rc));
|
||||||
|
|
||||||
|
|
||||||
for (d=0;d<capsA.cDestinations;d++) {
|
for (d=0;d<capsA.cDestinations;d++) {
|
||||||
MIXERLINEA mixerlineA;
|
MIXERLINEA mixerlineA;
|
||||||
mixerlineA.cbStruct = 0;
|
mixerlineA.cbStruct = 0;
|
||||||
|
@ -757,10 +767,21 @@ static void mixer_test_deviceW(int device)
|
||||||
szPname, capsW.vDriverVersion >> 8,
|
szPname, capsW.vDriverVersion >> 8,
|
||||||
capsW.vDriverVersion & 0xff,capsW.wMid,capsW.wPid);
|
capsW.vDriverVersion & 0xff,capsW.wMid,capsW.wPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rc=mixerOpen(&mix, device, 0, 0, 0);
|
rc=mixerOpen(&mix, device, 0, 0, 0);
|
||||||
ok(rc==MMSYSERR_NOERROR,
|
ok(rc==MMSYSERR_NOERROR,
|
||||||
"mixerOpen: MMSYSERR_BADDEVICEID expected, got %s\n",mmsys_error(rc));
|
"mixerOpen: MMSYSERR_BADDEVICEID expected, got %s\n",mmsys_error(rc));
|
||||||
if (rc==MMSYSERR_NOERROR) {
|
if (rc==MMSYSERR_NOERROR) {
|
||||||
|
rc=mixerOpen(&mix, device, 0, 0, CALLBACK_FUNCTION);
|
||||||
|
ok(rc==MMSYSERR_INVALFLAG,
|
||||||
|
"mixerOpen: MMSYSERR_INVALFLAG expected, got %s\n", mmsys_error(rc));
|
||||||
|
|
||||||
|
/* Shouldn't open without a valid HWND */
|
||||||
|
rc=mixerOpen(&mix, device, 0, 0, CALLBACK_WINDOW);
|
||||||
|
ok(rc==MMSYSERR_INVALPARAM,
|
||||||
|
"mixerOpen: MMSYSERR_INVALPARAM expected, got %s\n", mmsys_error(rc));
|
||||||
|
|
||||||
for (d=0;d<capsW.cDestinations;d++) {
|
for (d=0;d<capsW.cDestinations;d++) {
|
||||||
MIXERLINEW mixerlineW;
|
MIXERLINEW mixerlineW;
|
||||||
mixerlineW.cbStruct = 0;
|
mixerlineW.cbStruct = 0;
|
||||||
|
|
|
@ -306,6 +306,16 @@ UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize
|
||||||
return MMDRV_Message(wmld, MXDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
|
return MMDRV_Message(wmld, MXDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CALLBACK MIXER_WCallback(HMIXEROBJ hmx, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam, DWORD_PTR param2)
|
||||||
|
{
|
||||||
|
HWND hWnd = (HWND)dwInstance;
|
||||||
|
|
||||||
|
if (!dwInstance)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PostMessageW(hWnd, MM_MIXM_CONTROL_CHANGE, (WPARAM)hmx, (LPARAM)dwParam);
|
||||||
|
}
|
||||||
|
|
||||||
UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback,
|
UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback,
|
||||||
DWORD_PTR dwInstance, DWORD fdwOpen, BOOL bFrom32)
|
DWORD_PTR dwInstance, DWORD fdwOpen, BOOL bFrom32)
|
||||||
{
|
{
|
||||||
|
@ -317,15 +327,36 @@ UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback,
|
||||||
TRACE("(%p, %d, %08lx, %08lx, %08x)\n",
|
TRACE("(%p, %d, %08lx, %08lx, %08x)\n",
|
||||||
lphMix, uDeviceID, dwCallback, dwInstance, fdwOpen);
|
lphMix, uDeviceID, dwCallback, dwInstance, fdwOpen);
|
||||||
|
|
||||||
|
mod.dwCallback = (DWORD_PTR)MIXER_WCallback;
|
||||||
|
mod.dwInstance = 0;
|
||||||
|
|
||||||
|
/* If callback is a function,
|
||||||
|
* dwCallback contains function pointer
|
||||||
|
* dwInstance private data
|
||||||
|
*
|
||||||
|
* if callback is a window
|
||||||
|
* dwCallback contains a window handle
|
||||||
|
*/
|
||||||
|
switch (fdwOpen & CALLBACK_TYPEMASK) {
|
||||||
|
default:
|
||||||
|
return MMSYSERR_INVALFLAG;
|
||||||
|
|
||||||
|
case CALLBACK_NULL:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CALLBACK_WINDOW:
|
||||||
|
mod.dwInstance = dwCallback;
|
||||||
|
if (!IsWindow((HWND)dwCallback))
|
||||||
|
return MMSYSERR_INVALPARAM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
wmld = MMDRV_Alloc(sizeof(WINE_MIXER), MMDRV_MIXER, &hMix, &fdwOpen,
|
wmld = MMDRV_Alloc(sizeof(WINE_MIXER), MMDRV_MIXER, &hMix, &fdwOpen,
|
||||||
&dwCallback, &dwInstance, bFrom32);
|
&dwCallback, &dwInstance, bFrom32);
|
||||||
|
|
||||||
wmld->uDeviceID = uDeviceID;
|
wmld->uDeviceID = uDeviceID;
|
||||||
mod.hmx = (HMIXEROBJ)hMix;
|
mod.hmx = (HMIXEROBJ)hMix;
|
||||||
mod.dwCallback = dwCallback;
|
|
||||||
mod.dwInstance = dwInstance;
|
|
||||||
|
|
||||||
dwRet = MMDRV_Open(wmld, MXDM_OPEN, (DWORD)&mod, fdwOpen);
|
dwRet = MMDRV_Open(wmld, MXDM_OPEN, (DWORD)&mod, CALLBACK_FUNCTION);
|
||||||
|
|
||||||
if (dwRet != MMSYSERR_NOERROR) {
|
if (dwRet != MMSYSERR_NOERROR) {
|
||||||
MMDRV_Free(hMix, wmld);
|
MMDRV_Free(hMix, wmld);
|
||||||
|
|
Loading…
Reference in New Issue