Commit 0d34e5c6 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

dsound: Implement DSPROPERTY_WaveDeviceMappingA on top of *W.

parent 7705fe64
......@@ -88,13 +88,13 @@ static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface)
return ref;
}
static HRESULT DSPROPERTY_WaveDeviceMappingA(
static HRESULT DSPROPERTY_WaveDeviceMappingW(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned )
{
HRESULT hr = DSERR_INVALIDPARAM;
PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA ppd;
PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA ppd;
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
pPropData,cbPropData,pcbReturned);
......@@ -111,15 +111,15 @@ static HRESULT DSPROPERTY_WaveDeviceMappingA(
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
wodn = waveOutGetNumDevs();
for (wod = 0; wod < wodn; wod++) {
WAVEOUTCAPSA capsA;
WAVEOUTCAPSW capsW;
MMRESULT res;
res = waveOutGetDevCapsA(wod, &capsA, sizeof(capsA));
res = waveOutGetDevCapsW(wod, &capsW, sizeof(capsW));
if (res == MMSYSERR_NOERROR) {
if (lstrcmpA(capsA.szPname, ppd->DeviceName) == 0) {
if (lstrcmpW(capsW.szPname, ppd->DeviceName) == 0) {
ppd->DeviceId = DSOUND_renderer_guids[wod];
hr = DS_OK;
TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId),
ppd->DeviceName);
debugstr_w(ppd->DeviceName));
break;
}
}
......@@ -130,15 +130,15 @@ static HRESULT DSPROPERTY_WaveDeviceMappingA(
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
widn = waveInGetNumDevs();
for (wid = 0; wid < widn; wid++) {
WAVEINCAPSA capsA;
WAVEINCAPSW capsW;
MMRESULT res;
res = waveInGetDevCapsA(wid, &capsA, sizeof(capsA));
res = waveInGetDevCapsW(wid, &capsW, sizeof(capsW));
if (res == MMSYSERR_NOERROR) {
if (lstrcmpA(capsA.szPname, ppd->DeviceName) == 0) {
if (lstrcmpW(capsW.szPname, ppd->DeviceName) == 0) {
ppd->DeviceId = DSOUND_capture_guids[wid];
TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId),
ppd->DeviceName);
hr = DS_OK;
TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId),
debugstr_w(ppd->DeviceName));
break;
}
}
......@@ -146,67 +146,39 @@ static HRESULT DSPROPERTY_WaveDeviceMappingA(
}
if (pcbReturned)
*pcbReturned = cbPropData;
*pcbReturned = cbPropData;
return hr;
}
static HRESULT DSPROPERTY_WaveDeviceMappingW(
static HRESULT DSPROPERTY_WaveDeviceMappingA(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned )
{
HRESULT hr = DSERR_INVALIDPARAM;
PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA ppd;
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
pPropData,cbPropData,pcbReturned);
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA *ppd = pPropData;
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA data;
DWORD len;
HRESULT hr;
ppd = pPropData;
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
pPropData,cbPropData,pcbReturned);
if (!ppd) {
WARN("invalid parameter: pPropData\n");
return DSERR_INVALIDPARAM;
if (!ppd || !ppd->DeviceName) {
WARN("invalid parameter: ppd=%p\n", ppd);
return DSERR_INVALIDPARAM;
}
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
ULONG wod;
unsigned int wodn;
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
wodn = waveOutGetNumDevs();
for (wod = 0; wod < wodn; wod++) {
WAVEOUTCAPSW capsW;
MMRESULT res;
res = waveOutGetDevCapsW(wod, &capsW, sizeof(capsW));
if (res == MMSYSERR_NOERROR) {
if (lstrcmpW(capsW.szPname, ppd->DeviceName) == 0) {
ppd->DeviceId = DSOUND_renderer_guids[wod];
hr = DS_OK;
TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId),
debugstr_w(ppd->DeviceName));
break;
}
}
}
} else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
ULONG wid;
unsigned int widn;
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
widn = waveInGetNumDevs();
for (wid = 0; wid < widn; wid++) {
WAVEINCAPSW capsW;
MMRESULT res;
res = waveInGetDevCapsW(wid, &capsW, sizeof(capsW));
if (res == MMSYSERR_NOERROR) {
if (lstrcmpW(capsW.szPname, ppd->DeviceName) == 0) {
ppd->DeviceId = DSOUND_capture_guids[wid];
hr = DS_OK;
TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId),
debugstr_w(ppd->DeviceName));
break;
}
}
}
}
data.DataFlow = ppd->DataFlow;
len = MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, NULL, 0);
data.DeviceName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!data.DeviceName)
return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, data.DeviceName, len);
hr = DSPROPERTY_WaveDeviceMappingW(&data, cbPropData, pcbReturned);
HeapFree(GetProcessHeap(), 0, data.DeviceName);
ppd->DeviceId = data.DeviceId;
if (pcbReturned)
*pcbReturned = cbPropData;
......
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