Commit bbc5244c authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

winmm: Allow HMIXEROBJ handles in place of device IDs in mixerGetDevCaps.

parent 7b8dbc47
...@@ -395,6 +395,14 @@ static void mixer_test_deviceA(int device) ...@@ -395,6 +395,14 @@ static void mixer_test_deviceA(int device)
ok(rc==MMSYSERR_NOERROR, ok(rc==MMSYSERR_NOERROR,
"mixerOpen: MMSYSERR_NOERROR 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) {
MIXERCAPSA capsA2;
rc=mixerGetDevCapsA((UINT_PTR)mix,&capsA2,sizeof(capsA2));
ok(rc==MMSYSERR_NOERROR,
"mixerGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",
mmsys_error(rc));
ok(!strcmp(capsA2.szPname, capsA.szPname), "Got wrong device caps\n");
for (d=0;d<capsA.cDestinations;d++) { for (d=0;d<capsA.cDestinations;d++) {
MIXERLINEA mixerlineA; MIXERLINEA mixerlineA;
mixerlineA.cbStruct = 0; mixerlineA.cbStruct = 0;
...@@ -771,6 +779,14 @@ static void mixer_test_deviceW(int device) ...@@ -771,6 +779,14 @@ static void mixer_test_deviceW(int device)
ok(rc==MMSYSERR_NOERROR, ok(rc==MMSYSERR_NOERROR,
"mixerOpen: MMSYSERR_NOERROR 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) {
MIXERCAPSW capsW2;
rc=mixerGetDevCapsW((UINT_PTR)mix,&capsW2,sizeof(capsW2));
ok(rc==MMSYSERR_NOERROR,
"mixerGetDevCapsW: MMSYSERR_NOERROR expected, got %s\n",
mmsys_error(rc));
ok(!lstrcmpW(capsW2.szPname, capsW.szPname), "Got wrong device caps\n");
for (d=0;d<capsW.cDestinations;d++) { for (d=0;d<capsW.cDestinations;d++) {
MIXERLINEW mixerlineW; MIXERLINEW mixerlineW;
mixerlineW.cbStruct = 0; mixerlineW.cbStruct = 0;
......
...@@ -122,6 +122,7 @@ struct _WINMM_MMDevice { ...@@ -122,6 +122,7 @@ struct _WINMM_MMDevice {
WAVEOUTCAPSW out_caps; /* must not be modified outside of WINMM_InitMMDevices*/ WAVEOUTCAPSW out_caps; /* must not be modified outside of WINMM_InitMMDevices*/
WAVEINCAPSW in_caps; /* must not be modified outside of WINMM_InitMMDevices*/ WAVEINCAPSW in_caps; /* must not be modified outside of WINMM_InitMMDevices*/
WCHAR *dev_id; WCHAR *dev_id;
EDataFlow dataflow;
ISimpleAudioVolume *volume; ISimpleAudioVolume *volume;
...@@ -510,6 +511,7 @@ static HRESULT WINMM_InitMMDevice(EDataFlow flow, IMMDevice *device, ...@@ -510,6 +511,7 @@ static HRESULT WINMM_InitMMDevice(EDataFlow flow, IMMDevice *device,
{ {
HRESULT hr; HRESULT hr;
dev->dataflow = flow;
if(flow == eRender){ if(flow == eRender){
dev->out_caps.wMid = 0xFF; dev->out_caps.wMid = 0xFF;
dev->out_caps.wPid = 0xFF; dev->out_caps.wPid = 0xFF;
...@@ -3749,15 +3751,20 @@ UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize ...@@ -3749,15 +3751,20 @@ UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
if(uDeviceID >= g_outmmdevices_count + g_inmmdevices_count) if(uDeviceID >= g_outmmdevices_count + g_inmmdevices_count)
mmdevice = WINMM_GetMixerMMDevice((HMIXEROBJ)uDeviceID,
MIXER_OBJECTF_MIXER, NULL);
else if(uDeviceID < g_outmmdevices_count)
mmdevice = read_map(g_out_map, uDeviceID);
else
mmdevice = read_map(g_in_map, uDeviceID - g_outmmdevices_count);
if(!mmdevice)
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
if(uDeviceID < g_outmmdevices_count){ if(mmdevice->dataflow == eRender)
mmdevice = read_map(g_out_map, uDeviceID);
memcpy(caps.szPname, mmdevice->out_caps.szPname, sizeof(caps.szPname)); memcpy(caps.szPname, mmdevice->out_caps.szPname, sizeof(caps.szPname));
}else{ else
mmdevice = read_map(g_in_map, uDeviceID - g_outmmdevices_count);
memcpy(caps.szPname, mmdevice->in_caps.szPname, sizeof(caps.szPname)); memcpy(caps.szPname, mmdevice->in_caps.szPname, sizeof(caps.szPname));
}
caps.wMid = 0xFF; caps.wMid = 0xFF;
caps.wPid = 0xFF; caps.wPid = 0xFF;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment