2002-06-13 21:15:06 +02:00
|
|
|
/* DirectSound
|
|
|
|
*
|
|
|
|
* Copyright 1998 Marcus Meissner
|
|
|
|
* Copyright 1998 Rob Riggs
|
|
|
|
* Copyright 2000-2002 TransGaming Technologies, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-06-13 21:15:06 +02:00
|
|
|
*/
|
|
|
|
|
2007-04-29 18:45:44 +02:00
|
|
|
#define COBJMACROS
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2005-10-17 11:24:50 +02:00
|
|
|
#include "winuser.h"
|
2002-06-13 21:15:06 +02:00
|
|
|
#include "mmsystem.h"
|
2002-09-13 00:07:02 +02:00
|
|
|
#include "winternl.h"
|
2003-04-30 00:49:52 +02:00
|
|
|
#include "winnls.h"
|
2005-01-28 18:21:07 +01:00
|
|
|
#include "vfwmsgs.h"
|
2002-06-13 21:15:06 +02:00
|
|
|
#include "mmddk.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "dsound.h"
|
|
|
|
#include "dsdriver.h"
|
|
|
|
#include "dsound_private.h"
|
2004-07-22 21:40:44 +02:00
|
|
|
#include "dsconf.h"
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2005-01-28 18:21:07 +01:00
|
|
|
#ifdef NONAMELESSSTRUCT
|
|
|
|
# define S(x) (x).s
|
|
|
|
#else
|
|
|
|
# define S(x) (x)
|
|
|
|
#endif
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
2003-08-20 20:18:23 +02:00
|
|
|
* IKsBufferPropertySet
|
2002-06-13 21:15:06 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* IUnknown methods */
|
2003-08-20 20:18:23 +02:00
|
|
|
static HRESULT WINAPI IKsBufferPropertySetImpl_QueryInterface(
|
|
|
|
LPKSPROPERTYSET iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID *ppobj )
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
|
2003-08-20 20:18:23 +02:00
|
|
|
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
2003-08-07 00:57:24 +02:00
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
return IDirectSoundBuffer_QueryInterface((LPDIRECTSOUNDBUFFER8)This->dsb, riid, ppobj);
|
|
|
|
}
|
2003-08-07 00:57:24 +02:00
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
static ULONG WINAPI IKsBufferPropertySetImpl_AddRef(LPKSPROPERTYSET iface)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
|
2005-02-11 12:49:05 +01:00
|
|
|
ULONG ref = InterlockedIncrement(&(This->ref));
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p) ref was %d\n", This, ref - 1);
|
2005-02-11 12:49:05 +01:00
|
|
|
return ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
static ULONG WINAPI IKsBufferPropertySetImpl_Release(LPKSPROPERTYSET iface)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
|
2005-02-11 12:49:05 +01:00
|
|
|
ULONG ref = InterlockedDecrement(&(This->ref));
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p) ref was %d\n", This, ref + 1);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2005-02-11 12:49:05 +01:00
|
|
|
if (!ref) {
|
2003-09-02 01:58:43 +02:00
|
|
|
This->dsb->iks = 0;
|
|
|
|
IDirectSoundBuffer_Release((LPDIRECTSOUND3DBUFFER)This->dsb);
|
2005-02-11 12:49:05 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
TRACE("(%p) released\n", This);
|
2003-09-02 01:58:43 +02:00
|
|
|
}
|
2005-02-11 12:49:05 +01:00
|
|
|
return ref;
|
2003-08-20 20:18:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IKsBufferPropertySetImpl_Get(
|
|
|
|
LPKSPROPERTYSET iface,
|
|
|
|
REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID,
|
|
|
|
LPVOID pInstanceData,
|
|
|
|
ULONG cbInstanceData,
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
|
2003-09-03 21:28:20 +02:00
|
|
|
PIDSDRIVERPROPERTYSET ps;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(iface=%p,guidPropSet=%s,dwPropID=%d,pInstanceData=%p,cbInstanceData=%d,pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2003-08-20 20:18:23 +02:00
|
|
|
This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
|
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
if (This->dsb->hwbuf) {
|
|
|
|
IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
if (ps) {
|
|
|
|
DSPROPERTY prop;
|
|
|
|
HRESULT hres;
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2005-01-28 18:21:07 +01:00
|
|
|
S(prop).Set = *guidPropSet;
|
|
|
|
S(prop).Id = dwPropID;
|
|
|
|
S(prop).Flags = 0; /* unused */
|
2006-01-06 12:35:20 +01:00
|
|
|
S(prop).InstanceId = (ULONG)This->dsb->device;
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
hres = IDsDriverPropertySet_Get(ps, &prop, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
IDsDriverPropertySet_Release(ps);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
return hres;
|
|
|
|
}
|
2003-09-03 21:28:20 +02:00
|
|
|
}
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IKsBufferPropertySetImpl_Set(
|
|
|
|
LPKSPROPERTYSET iface,
|
|
|
|
REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID,
|
|
|
|
LPVOID pInstanceData,
|
|
|
|
ULONG cbInstanceData,
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData )
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
|
2003-09-03 21:28:20 +02:00
|
|
|
PIDSDRIVERPROPERTYSET ps;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%s,%d,%p,%d,%p,%d)\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
if (This->dsb->hwbuf) {
|
|
|
|
IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
if (ps) {
|
|
|
|
DSPROPERTY prop;
|
|
|
|
HRESULT hres;
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2005-01-28 18:21:07 +01:00
|
|
|
S(prop).Set = *guidPropSet;
|
|
|
|
S(prop).Id = dwPropID;
|
|
|
|
S(prop).Flags = 0; /* unused */
|
2006-01-06 12:35:20 +01:00
|
|
|
S(prop).InstanceId = (ULONG)This->dsb->device;
|
2004-12-06 12:42:58 +01:00
|
|
|
hres = IDsDriverPropertySet_Set(ps,&prop,pInstanceData,cbInstanceData,pPropData,cbPropData);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
IDsDriverPropertySet_Release(ps);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
return hres;
|
|
|
|
}
|
2003-09-03 21:28:20 +02:00
|
|
|
}
|
2003-08-20 20:18:23 +02:00
|
|
|
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IKsBufferPropertySetImpl_QuerySupport(
|
|
|
|
LPKSPROPERTYSET iface,
|
|
|
|
REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID,
|
|
|
|
PULONG pTypeSupport )
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
|
2003-09-03 21:28:20 +02:00
|
|
|
PIDSDRIVERPROPERTYSET ps;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%s,%d,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
if (This->dsb->hwbuf) {
|
|
|
|
IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
if (ps) {
|
|
|
|
HRESULT hres;
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
hres = IDsDriverPropertySet_QuerySupport(ps,guidPropSet, dwPropID,pTypeSupport);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
IDsDriverPropertySet_Release(ps);
|
2003-09-03 21:28:20 +02:00
|
|
|
|
2004-12-06 12:42:58 +01:00
|
|
|
return hres;
|
|
|
|
}
|
2003-09-03 21:28:20 +02:00
|
|
|
}
|
2003-08-20 20:18:23 +02:00
|
|
|
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IKsPropertySetVtbl iksbvt = {
|
2003-08-20 20:18:23 +02:00
|
|
|
IKsBufferPropertySetImpl_QueryInterface,
|
|
|
|
IKsBufferPropertySetImpl_AddRef,
|
|
|
|
IKsBufferPropertySetImpl_Release,
|
|
|
|
IKsBufferPropertySetImpl_Get,
|
|
|
|
IKsBufferPropertySetImpl_Set,
|
|
|
|
IKsBufferPropertySetImpl_QuerySupport
|
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IKsBufferPropertySetImpl_Create(
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundBufferImpl *dsb,
|
2003-08-20 20:18:23 +02:00
|
|
|
IKsBufferPropertySetImpl **piks)
|
|
|
|
{
|
|
|
|
IKsBufferPropertySetImpl *iks;
|
2003-09-03 21:28:20 +02:00
|
|
|
TRACE("(%p,%p)\n",dsb,piks);
|
2003-08-20 20:18:23 +02:00
|
|
|
|
2004-08-18 02:30:37 +02:00
|
|
|
iks = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*iks));
|
2004-12-06 12:42:58 +01:00
|
|
|
if (iks == 0) {
|
|
|
|
WARN("out of memory\n");
|
|
|
|
*piks = NULL;
|
|
|
|
return DSERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
iks->ref = 0;
|
2003-09-02 01:58:43 +02:00
|
|
|
iks->dsb = dsb;
|
|
|
|
dsb->iks = iks;
|
2003-08-20 20:18:23 +02:00
|
|
|
iks->lpVtbl = &iksbvt;
|
|
|
|
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER)dsb);
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
*piks = iks;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IKsBufferPropertySetImpl_Destroy(
|
2004-07-14 01:35:09 +02:00
|
|
|
IKsBufferPropertySetImpl *piks)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n",piks);
|
|
|
|
|
|
|
|
while (IKsBufferPropertySetImpl_Release((LPKSPROPERTYSET)piks) > 0);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* IKsPrivatePropertySet
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* IUnknown methods */
|
|
|
|
static HRESULT WINAPI IKsPrivatePropertySetImpl_QueryInterface(
|
|
|
|
LPKSPROPERTYSET iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID *ppobj )
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
|
2003-08-20 20:18:23 +02:00
|
|
|
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
|
2007-04-29 18:45:44 +02:00
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IKsPropertySet)) {
|
|
|
|
*ppobj = iface;
|
|
|
|
IUnknown_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
2003-08-20 20:18:23 +02:00
|
|
|
*ppobj = NULL;
|
2007-04-29 18:45:44 +02:00
|
|
|
return E_NOINTERFACE;
|
2003-08-20 20:18:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
|
2005-02-11 12:49:05 +01:00
|
|
|
ULONG ref = InterlockedIncrement(&(This->ref));
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p) ref was %d\n", This, ref - 1);
|
2005-02-11 12:49:05 +01:00
|
|
|
return ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
|
2005-02-11 12:49:05 +01:00
|
|
|
ULONG ref = InterlockedDecrement(&(This->ref));
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p) ref was %d\n", This, ref + 1);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2005-02-11 12:49:05 +01:00
|
|
|
if (!ref) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
TRACE("(%p) released\n", This);
|
2004-09-16 21:08:04 +02:00
|
|
|
}
|
2005-02-11 12:49:05 +01:00
|
|
|
return ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2003-04-30 00:49:52 +02:00
|
|
|
static HRESULT WINAPI DSPROPERTY_WaveDeviceMappingA(
|
2004-07-14 01:35:09 +02:00
|
|
|
LPVOID pPropData,
|
2003-04-30 00:49:52 +02:00
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
2005-04-13 16:39:49 +02:00
|
|
|
HRESULT hr = DSERR_INVALIDPARAM;
|
2003-04-30 00:49:52 +02:00
|
|
|
PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA ppd;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
2003-04-30 00:49:52 +02:00
|
|
|
|
|
|
|
ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA) pPropData;
|
|
|
|
|
|
|
|
if (!ppd) {
|
|
|
|
WARN("invalid parameter: pPropData\n");
|
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
|
2005-04-13 16:39:49 +02:00
|
|
|
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++) {
|
|
|
|
WAVEOUTCAPSA capsA;
|
|
|
|
MMRESULT res;
|
|
|
|
res = waveOutGetDevCapsA(wod, &capsA, sizeof(capsA));
|
|
|
|
if (res == MMSYSERR_NOERROR) {
|
|
|
|
if (lstrcmpA(capsA.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);
|
|
|
|
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++) {
|
|
|
|
WAVEINCAPSA capsA;
|
|
|
|
MMRESULT res;
|
|
|
|
res = waveInGetDevCapsA(wid, &capsA, sizeof(capsA));
|
|
|
|
if (res == MMSYSERR_NOERROR) {
|
|
|
|
if (lstrcmpA(capsA.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;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
|
2005-04-13 16:39:49 +02:00
|
|
|
if (pcbReturned)
|
2004-07-14 01:35:09 +02:00
|
|
|
*pcbReturned = cbPropData;
|
2003-04-30 00:49:52 +02:00
|
|
|
|
2005-04-13 16:39:49 +02:00
|
|
|
return hr;
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DSPROPERTY_WaveDeviceMappingW(
|
2004-07-14 01:35:09 +02:00
|
|
|
LPVOID pPropData,
|
2003-04-30 00:49:52 +02:00
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
2005-04-13 16:39:49 +02:00
|
|
|
HRESULT hr = DSERR_INVALIDPARAM;
|
2003-04-30 00:49:52 +02:00
|
|
|
PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA ppd;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
2003-04-30 00:49:52 +02:00
|
|
|
|
|
|
|
ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA) pPropData;
|
|
|
|
|
|
|
|
if (!ppd) {
|
|
|
|
WARN("invalid parameter: pPropData\n");
|
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
|
2005-04-13 16:39:49 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
2005-04-13 16:39:49 +02:00
|
|
|
if (pcbReturned)
|
|
|
|
*pcbReturned = cbPropData;
|
|
|
|
|
|
|
|
return hr;
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DSPROPERTY_Description1(
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
|
|
|
HRESULT err;
|
|
|
|
GUID guid, dev_guid;
|
|
|
|
PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA ppd;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
2003-04-30 00:49:52 +02:00
|
|
|
|
|
|
|
ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA) pPropData;
|
|
|
|
|
|
|
|
if (!ppd) {
|
|
|
|
WARN("invalid parameter: pPropData\n");
|
|
|
|
return DSERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
|
|
|
|
if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
|
|
|
|
/* default device of type specified by ppd->DataFlow */
|
|
|
|
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
|
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
|
|
|
|
} else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
|
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
|
|
|
|
} else {
|
|
|
|
TRACE("DataFlow=Unknown(%d)\n", ppd->DataFlow);
|
|
|
|
}
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("(pPropData=%p,cbPropData=%d,pcbReturned=%p) GUID_NULL not implemented!\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
2003-04-30 00:49:52 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2003-09-03 21:28:20 +02:00
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
|
2003-09-03 21:28:20 +02:00
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
GetDeviceID(&ppd->DeviceId, &dev_guid);
|
|
|
|
|
2004-07-14 01:35:09 +02:00
|
|
|
if ( IsEqualGUID( &ppd->DeviceId, &DSDEVID_DefaultPlayback) ||
|
2003-09-03 21:28:20 +02:00
|
|
|
IsEqualGUID( &ppd->DeviceId, &DSDEVID_DefaultVoicePlayback) ) {
|
|
|
|
ULONG wod;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int wodn;
|
2003-09-03 21:28:20 +02:00
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
|
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
wodn = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < wodn; wod++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &dev_guid, &DSOUND_renderer_guids[wod] ) ) {
|
2004-08-20 22:01:31 +02:00
|
|
|
DSDRIVERDESC desc;
|
|
|
|
ppd->WaveDeviceId = wod;
|
|
|
|
ppd->Devnode = wod;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2004-08-20 22:01:31 +02:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSDRIVER drv = NULL;
|
2005-03-28 16:17:51 +02:00
|
|
|
lstrcpynA(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA));
|
|
|
|
lstrcpynA(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA));
|
2004-08-20 22:01:31 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) );
|
2005-01-28 18:21:07 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) );
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
2004-08-20 22:01:31 +02:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
2005-03-14 11:03:54 +01:00
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2004-08-20 22:01:31 +02:00
|
|
|
break;
|
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
2004-08-20 22:01:31 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
}
|
2003-09-03 21:28:20 +02:00
|
|
|
}
|
|
|
|
} else if ( IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) ||
|
|
|
|
IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) {
|
|
|
|
ULONG wid;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int widn;
|
2003-09-03 21:28:20 +02:00
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
|
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
widn = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < widn; wid++) {
|
2004-08-20 22:01:31 +02:00
|
|
|
if (IsEqualGUID( &dev_guid, &guid) ) {
|
|
|
|
DSDRIVERDESC desc;
|
|
|
|
ppd->WaveDeviceId = wid;
|
|
|
|
ppd->Devnode = wid;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2004-08-20 22:01:31 +02:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
2005-03-28 16:17:51 +02:00
|
|
|
lstrcpynA(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA));
|
|
|
|
lstrcpynA(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA));
|
2004-08-20 22:01:31 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) );
|
2005-01-28 18:21:07 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) );
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&drv,0));
|
2004-08-20 22:01:31 +02:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
2005-03-14 11:03:54 +01:00
|
|
|
else
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2004-08-20 22:01:31 +02:00
|
|
|
break;
|
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
2004-08-20 22:01:31 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
2003-09-03 21:28:20 +02:00
|
|
|
} else {
|
2003-09-19 02:10:51 +02:00
|
|
|
BOOL found = FALSE;
|
|
|
|
ULONG wod;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int wodn;
|
2003-09-19 02:10:51 +02:00
|
|
|
/* given specific device so try the render devices first */
|
|
|
|
wodn = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < wodn; wod++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId, &DSOUND_renderer_guids[wod] ) ) {
|
2004-08-20 22:01:31 +02:00
|
|
|
DSDRIVERDESC desc;
|
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
|
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
ppd->WaveDeviceId = wod;
|
|
|
|
ppd->Devnode = wod;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2004-08-20 22:01:31 +02:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSDRIVER drv = NULL;
|
2005-03-28 16:17:51 +02:00
|
|
|
lstrcpynA(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA));
|
|
|
|
lstrcpynA(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA));
|
2004-08-20 22:01:31 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) );
|
2005-01-28 18:21:07 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) );
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
2004-08-20 22:01:31 +02:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
2005-03-14 11:03:54 +01:00
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2004-08-20 22:01:31 +02:00
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
2004-08-20 22:01:31 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
}
|
2003-09-19 02:10:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (found == FALSE) {
|
2004-08-20 22:01:31 +02:00
|
|
|
ULONG wid;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int widn;
|
2004-08-20 22:01:31 +02:00
|
|
|
/* given specific device so try the capture devices next */
|
|
|
|
widn = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < widn; wid++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId, &DSOUND_capture_guids[wid] ) ) {
|
2004-08-20 22:01:31 +02:00
|
|
|
DSDRIVERDESC desc;
|
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
|
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
ppd->WaveDeviceId = wid;
|
|
|
|
ppd->Devnode = wid;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2004-08-20 22:01:31 +02:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSDRIVER drv = NULL;
|
2005-03-28 16:17:51 +02:00
|
|
|
lstrcpynA(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA));
|
|
|
|
lstrcpynA(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA));
|
2004-08-20 22:01:31 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) );
|
2005-01-28 18:21:07 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) );
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
2004-08-20 22:01:31 +02:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
2005-03-14 11:03:54 +01:00
|
|
|
else
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2004-08-20 22:01:31 +02:00
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
2004-08-20 22:01:31 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found == FALSE) {
|
|
|
|
WARN("device not found\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
2003-09-19 02:10:51 +02:00
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pcbReturned) {
|
2004-07-14 01:35:09 +02:00
|
|
|
*pcbReturned = cbPropData;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("*pcbReturned=%d\n", *pcbReturned);
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DSPROPERTY_DescriptionA(
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
2003-09-15 22:08:05 +02:00
|
|
|
PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA) pPropData;
|
|
|
|
HRESULT err;
|
2004-08-20 22:01:31 +02:00
|
|
|
GUID dev_guid;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
2003-09-15 22:08:05 +02:00
|
|
|
|
|
|
|
TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
|
|
|
|
if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
|
|
|
|
/* default device of type specified by ppd->DataFlow */
|
|
|
|
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
|
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
|
|
|
|
} else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
|
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
|
|
|
|
} else {
|
|
|
|
TRACE("DataFlow=Unknown(%d)\n", ppd->DataFlow);
|
|
|
|
}
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("(pPropData=%p,cbPropData=%d,pcbReturned=%p) GUID_NULL not implemented!\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
2003-09-15 22:08:05 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
GetDeviceID(&ppd->DeviceId, &dev_guid);
|
|
|
|
|
|
|
|
if ( IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultPlayback) ||
|
|
|
|
IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoicePlayback) ) {
|
|
|
|
ULONG wod;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int wodn;
|
2005-06-01 22:04:06 +02:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultPlayback) )
|
|
|
|
TRACE("DSDEVID_DefaultPlayback\n");
|
|
|
|
else
|
|
|
|
TRACE("DSDEVID_DefaultVoicePlayback\n");
|
2003-09-15 22:08:05 +02:00
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
wodn = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < wodn; wod++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &dev_guid, &DSOUND_renderer_guids[wod] ) ) {
|
2005-03-14 11:03:54 +01:00
|
|
|
DSDRIVERDESC desc;
|
|
|
|
ppd->WaveDeviceId = wod;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSDRIVER drv = NULL;
|
|
|
|
/* FIXME: this is a memory leak */
|
|
|
|
CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
|
|
|
|
CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
|
|
|
|
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
|
|
|
|
|
|
|
|
if (szDescription && szModule && szInterface) {
|
|
|
|
strcpy(szDescription, desc.szDesc);
|
|
|
|
strcpy(szModule, desc.szDrvname);
|
|
|
|
strcpy(szInterface, "Interface");
|
|
|
|
|
|
|
|
ppd->Description = szDescription;
|
|
|
|
ppd->Module = szModule;
|
|
|
|
ppd->Interface = szInterface;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
|
|
|
break;
|
2003-09-15 22:08:05 +02:00
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("no memory\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, szDescription);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szModule);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szInterface);
|
|
|
|
return E_OUTOFMEMORY;
|
2003-09-15 22:08:05 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
} else {
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2003-09-15 22:08:05 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2003-09-15 22:08:05 +02:00
|
|
|
}
|
|
|
|
} else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) ||
|
|
|
|
IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) {
|
|
|
|
ULONG wid;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int widn;
|
2005-06-01 22:04:06 +02:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) )
|
|
|
|
TRACE("DSDEVID_DefaultCapture\n");
|
|
|
|
else
|
|
|
|
TRACE("DSDEVID_DefaultVoiceCapture\n");
|
2003-09-15 22:08:05 +02:00
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
widn = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < widn; wid++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &dev_guid, &DSOUND_capture_guids[wid] ) ) {
|
2005-03-14 11:03:54 +01:00
|
|
|
DSDRIVERDESC desc;
|
|
|
|
ppd->WaveDeviceId = wid;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
/* FIXME: this is a memory leak */
|
|
|
|
CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
|
|
|
|
CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
|
|
|
|
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
|
|
|
|
|
|
|
|
if (szDescription && szModule && szInterface) {
|
|
|
|
strcpy(szDescription, desc.szDesc);
|
|
|
|
strcpy(szModule, desc.szDrvname);
|
|
|
|
strcpy(szInterface, "Interface");
|
|
|
|
|
|
|
|
ppd->Description = szDescription;
|
|
|
|
ppd->Module = szModule;
|
|
|
|
ppd->Interface = szInterface;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&drv,0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
2005-06-04 11:38:14 +02:00
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2005-03-14 11:03:54 +01:00
|
|
|
break;
|
2003-09-15 22:08:05 +02:00
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("no memory\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, szDescription);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szModule);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szInterface);
|
|
|
|
return E_OUTOFMEMORY;
|
2003-09-15 22:08:05 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
} else {
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2003-09-15 22:08:05 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2003-09-15 22:08:05 +02:00
|
|
|
}
|
2003-10-09 00:35:26 +02:00
|
|
|
} else {
|
|
|
|
BOOL found = FALSE;
|
|
|
|
ULONG wod;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int wodn;
|
2003-10-09 00:35:26 +02:00
|
|
|
/* given specific device so try the render devices first */
|
2005-06-01 22:04:06 +02:00
|
|
|
TRACE("Checking renderer devices\n");
|
2003-10-09 00:35:26 +02:00
|
|
|
wodn = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < wodn; wod++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId, &DSOUND_renderer_guids[wod] ) ) {
|
2005-03-14 11:03:54 +01:00
|
|
|
DSDRIVERDESC desc;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("DSOUND_renderer_guids[%d]\n", wod);
|
2005-03-14 11:03:54 +01:00
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
ppd->WaveDeviceId = wod;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSDRIVER drv = NULL;
|
|
|
|
/* FIXME: this is a memory leak */
|
|
|
|
CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
|
|
|
|
CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
|
|
|
|
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
|
2003-10-09 00:35:26 +02:00
|
|
|
|
2005-03-14 11:03:54 +01:00
|
|
|
if (szDescription && szModule && szInterface) {
|
2003-10-09 00:35:26 +02:00
|
|
|
strcpy(szDescription, desc.szDesc);
|
2005-01-28 18:21:07 +01:00
|
|
|
strcpy(szModule, desc.szDrvname);
|
2003-10-09 00:35:26 +02:00
|
|
|
strcpy(szInterface, "Interface");
|
|
|
|
|
|
|
|
ppd->Description = szDescription;
|
|
|
|
ppd->Module = szModule;
|
|
|
|
ppd->Interface = szInterface;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
2003-10-09 00:35:26 +02:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
2005-03-14 11:03:54 +01:00
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2003-10-09 00:35:26 +02:00
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("no memory\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, szDescription);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szModule);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szInterface);
|
|
|
|
return E_OUTOFMEMORY;
|
2003-10-09 00:35:26 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
} else {
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2003-10-09 00:35:26 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found == FALSE) {
|
|
|
|
ULONG wid;
|
|
|
|
unsigned int widn;
|
2005-06-01 22:04:06 +02:00
|
|
|
TRACE("Checking capture devices\n");
|
2005-03-14 11:03:54 +01:00
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
widn = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < widn; wid++) {
|
2005-06-01 22:04:06 +02:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId, &DSOUND_capture_guids[wid] ) ) {
|
2005-03-14 11:03:54 +01:00
|
|
|
DSDRIVERDESC desc;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("DSOUND_capture_guids[%d]\n", wid);
|
2005-03-14 11:03:54 +01:00
|
|
|
ppd->WaveDeviceId = wid;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
/* FIXME: this is a memory leak */
|
|
|
|
CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
|
|
|
|
CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
|
|
|
|
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
|
|
|
|
|
|
|
|
if (szDescription && szModule && szInterface) {
|
|
|
|
strcpy(szDescription, desc.szDesc);
|
|
|
|
strcpy(szModule, desc.szDrvname);
|
|
|
|
strcpy(szInterface, "Interface");
|
|
|
|
|
|
|
|
ppd->Description = szDescription;
|
|
|
|
ppd->Module = szModule;
|
|
|
|
ppd->Interface = szInterface;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&drv,0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
2005-06-04 11:38:14 +02:00
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2005-03-14 11:03:54 +01:00
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
WARN("no memory\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, szDescription);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szModule);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szInterface);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-10-09 00:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (found == FALSE) {
|
|
|
|
WARN("device not found\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
2003-09-15 22:08:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pcbReturned) {
|
|
|
|
*pcbReturned = cbPropData;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("*pcbReturned=%d\n", *pcbReturned);
|
2003-09-15 22:08:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DSPROPERTY_DescriptionW(
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
|
|
|
PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA) pPropData;
|
|
|
|
HRESULT err;
|
2004-08-20 22:01:31 +02:00
|
|
|
GUID dev_guid;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
2003-04-30 00:49:52 +02:00
|
|
|
|
|
|
|
TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
|
|
|
|
if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
|
|
|
|
/* default device of type specified by ppd->DataFlow */
|
|
|
|
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
|
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
|
|
|
|
} else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
|
|
|
|
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
|
|
|
|
} else {
|
|
|
|
TRACE("DataFlow=Unknown(%d)\n", ppd->DataFlow);
|
|
|
|
}
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("(pPropData=%p,cbPropData=%d,pcbReturned=%p) GUID_NULL not implemented!\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
2003-04-30 00:49:52 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2003-09-03 21:28:20 +02:00
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
|
2003-09-03 21:28:20 +02:00
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
GetDeviceID(&ppd->DeviceId, &dev_guid);
|
|
|
|
|
2004-07-14 01:35:09 +02:00
|
|
|
if ( IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultPlayback) ||
|
2003-09-03 21:28:20 +02:00
|
|
|
IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoicePlayback) ) {
|
|
|
|
ULONG wod;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int wodn;
|
2005-06-01 22:04:06 +02:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultPlayback) )
|
|
|
|
TRACE("DSDEVID_DefaultPlayback\n");
|
|
|
|
else
|
|
|
|
TRACE("DSDEVID_DefaultVoicePlayback\n");
|
2003-09-03 21:28:20 +02:00
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
wodn = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < wodn; wod++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &dev_guid, &DSOUND_renderer_guids[wod] ) ) {
|
2005-03-14 11:03:54 +01:00
|
|
|
DSDRIVERDESC desc;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("DSOUND_renderer_guids[%d]\n", wod);
|
2005-03-14 11:03:54 +01:00
|
|
|
ppd->WaveDeviceId = wod;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSDRIVER drv = NULL;
|
|
|
|
/* FIXME: this is a memory leak */
|
|
|
|
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
|
|
|
|
if (wDescription && wModule && wInterface) {
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
|
|
|
|
|
|
|
|
ppd->Description = wDescription;
|
|
|
|
ppd->Module = wModule;
|
|
|
|
ppd->Interface = wInterface;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
|
|
|
break;
|
2003-09-03 21:28:20 +02:00
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("no memory\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, wDescription);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wModule);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wInterface);
|
|
|
|
return E_OUTOFMEMORY;
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
} else {
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2003-09-03 21:28:20 +02:00
|
|
|
}
|
|
|
|
} else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) ||
|
|
|
|
IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) {
|
|
|
|
ULONG wid;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int widn;
|
2005-06-01 22:04:06 +02:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture))
|
|
|
|
TRACE("DSDEVID_DefaultCapture\n");
|
|
|
|
else
|
|
|
|
TRACE("DSDEVID_DefaultVoiceCapture\n");
|
2003-09-03 21:28:20 +02:00
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
widn = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < widn; wid++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &dev_guid, &DSOUND_capture_guids[wid] ) ) {
|
2005-03-14 11:03:54 +01:00
|
|
|
DSDRIVERDESC desc;
|
|
|
|
ppd->WaveDeviceId = wid;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
/* FIXME: this is a memory leak */
|
|
|
|
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
|
|
|
|
if (wDescription && wModule && wInterface) {
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
|
|
|
|
|
|
|
|
ppd->Description = wDescription;
|
|
|
|
ppd->Module = wModule;
|
|
|
|
ppd->Interface = wInterface;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&drv,0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2003-04-30 00:49:52 +02:00
|
|
|
break;
|
2003-09-03 21:28:20 +02:00
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("no memory\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, wDescription);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wModule);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wInterface);
|
|
|
|
return E_OUTOFMEMORY;
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
} else {
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
2003-09-03 21:28:20 +02:00
|
|
|
} else {
|
2003-10-09 00:35:26 +02:00
|
|
|
BOOL found = FALSE;
|
|
|
|
ULONG wod;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int wodn;
|
2005-06-01 22:04:06 +02:00
|
|
|
TRACE("Checking renderer devices\n");
|
2003-10-09 00:35:26 +02:00
|
|
|
/* given specific device so try the render devices first */
|
|
|
|
wodn = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < wodn; wod++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &ppd->DeviceId, &DSOUND_renderer_guids[wod] ) ) {
|
2005-03-14 11:03:54 +01:00
|
|
|
DSDRIVERDESC desc;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("DSOUND_renderer_guids[%d]\n", wod);
|
2005-03-14 11:03:54 +01:00
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
ppd->WaveDeviceId = wod;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSDRIVER drv = NULL;
|
|
|
|
/* FIXME: this is a memory leak */
|
|
|
|
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
|
2003-10-09 00:35:26 +02:00
|
|
|
|
2005-03-14 11:03:54 +01:00
|
|
|
if (wDescription && wModule && wInterface) {
|
2003-10-09 00:35:26 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
|
2005-01-28 18:21:07 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
|
2003-10-09 00:35:26 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
|
|
|
|
|
|
|
|
ppd->Description = wDescription;
|
|
|
|
ppd->Module = wModule;
|
|
|
|
ppd->Interface = wInterface;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
2003-10-09 00:35:26 +02:00
|
|
|
if (err == DS_OK && drv)
|
2005-03-14 11:03:54 +01:00
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2003-10-09 00:35:26 +02:00
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
} else {
|
2005-03-14 11:03:54 +01:00
|
|
|
WARN("no memory\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, wDescription);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wModule);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wInterface);
|
|
|
|
return E_OUTOFMEMORY;
|
2003-10-09 00:35:26 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
} else {
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2003-10-09 00:35:26 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found == FALSE) {
|
|
|
|
ULONG wid;
|
|
|
|
unsigned int widn;
|
2005-06-01 22:04:06 +02:00
|
|
|
TRACE("Checking capture devices\n");
|
2005-03-14 11:03:54 +01:00
|
|
|
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
widn = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < widn; wid++) {
|
2005-03-15 16:40:35 +01:00
|
|
|
if (IsEqualGUID( &dev_guid, &DSOUND_capture_guids[wid] ) ) {
|
2005-03-14 11:03:54 +01:00
|
|
|
DSDRIVERDESC desc;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("DSOUND_capture_guids[%d]\n", wid);
|
2005-03-14 11:03:54 +01:00
|
|
|
ppd->WaveDeviceId = wid;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&(desc),0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
/* FIXME: this is a memory leak */
|
|
|
|
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
|
|
|
|
if (wDescription && wModule && wInterface) {
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
|
|
|
|
|
|
|
|
ppd->Description = wDescription;
|
|
|
|
ppd->Module = wModule;
|
|
|
|
ppd->Interface = wInterface;
|
2005-09-12 17:14:06 +02:00
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&drv,0));
|
2005-03-14 11:03:54 +01:00
|
|
|
if (err == DS_OK && drv)
|
|
|
|
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
WARN("no memory\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, wDescription);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wModule);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wInterface);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-08-22 13:36:08 +02:00
|
|
|
}
|
2003-10-09 00:35:26 +02:00
|
|
|
|
|
|
|
if (found == FALSE) {
|
|
|
|
WARN("device not found\n");
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pcbReturned) {
|
2004-07-14 01:35:09 +02:00
|
|
|
*pcbReturned = cbPropData;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("*pcbReturned=%d\n", *pcbReturned);
|
2003-04-30 00:49:52 +02:00
|
|
|
}
|
2003-05-02 22:16:48 +02:00
|
|
|
|
2003-04-30 00:49:52 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DSPROPERTY_Enumerate1(
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
2005-03-14 11:03:54 +01:00
|
|
|
PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA) pPropData;
|
|
|
|
HRESULT err;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
|
|
|
|
|
|
|
if (ppd) {
|
|
|
|
if (ppd->Callback) {
|
|
|
|
unsigned devs, wod, wid;
|
|
|
|
DSDRIVERDESC desc;
|
|
|
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data;
|
|
|
|
|
|
|
|
devs = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < devs; ++wod) {
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
ZeroMemory(&data, sizeof(data));
|
|
|
|
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
data.WaveDeviceId = wod;
|
|
|
|
data.DeviceId = DSOUND_renderer_guids[wod];
|
|
|
|
lstrcpynA(data.DescriptionA, desc.szDesc, sizeof(data.DescriptionA));
|
|
|
|
lstrcpynA(data.ModuleA, desc.szDrvname, sizeof(data.ModuleA));
|
2005-03-14 11:03:54 +01:00
|
|
|
|
2006-08-22 13:36:08 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, data.DescriptionA, -1, data.DescriptionW, sizeof(data.DescriptionW)/sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, data.ModuleA, -1, data.ModuleW, sizeof(data.ModuleW)/sizeof(WCHAR) );
|
2005-03-14 11:03:54 +01:00
|
|
|
|
2006-08-22 13:36:08 +02:00
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
|
|
|
if (err == DS_OK && drv)
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2005-05-04 11:46:41 +02:00
|
|
|
|
2006-08-22 13:36:08 +02:00
|
|
|
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
|
|
|
|
(ppd->Callback)(&data, ppd->Context);
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2006-08-22 13:36:08 +02:00
|
|
|
}
|
2005-03-14 11:03:54 +01:00
|
|
|
|
2006-08-22 13:36:08 +02:00
|
|
|
devs = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < devs; ++wid) {
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
ZeroMemory(&data, sizeof(data));
|
|
|
|
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
data.WaveDeviceId = wid;
|
|
|
|
data.DeviceId = DSOUND_capture_guids[wid];
|
|
|
|
lstrcpynA(data.DescriptionA, desc.szDesc, sizeof(data.DescriptionA));
|
|
|
|
lstrcpynA(data.ModuleA, desc.szDrvname, sizeof(data.ModuleA));
|
|
|
|
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, data.DescriptionA, -1, data.DescriptionW, sizeof(data.DescriptionW)/sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, data.ModuleA, -1, data.ModuleW, sizeof(data.ModuleW)/sizeof(WCHAR) );
|
|
|
|
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
|
|
|
if (err == DS_OK && drv)
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
2005-05-04 11:46:41 +02:00
|
|
|
|
2006-08-22 13:36:08 +02:00
|
|
|
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
|
|
|
|
(ppd->Callback)(&data, ppd->Context);
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
|
|
|
}
|
2006-08-22 13:36:08 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pcbReturned) {
|
|
|
|
*pcbReturned = 0;
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("*pcbReturned=%d\n", *pcbReturned);
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
|
|
|
|
2003-04-30 00:49:52 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DSPROPERTY_EnumerateA(
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
2003-08-07 00:57:24 +02:00
|
|
|
PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA) pPropData;
|
|
|
|
HRESULT err;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
|
|
|
|
|
|
|
if (ppd) {
|
|
|
|
if (ppd->Callback) {
|
|
|
|
unsigned devs, wod, wid;
|
|
|
|
DSDRIVERDESC desc;
|
|
|
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA data;
|
|
|
|
|
|
|
|
devs = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < devs; ++wod) {
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
DWORD size;
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size);
|
|
|
|
if (nameW) {
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR));
|
|
|
|
if (szInterface) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
ZeroMemory(&data, sizeof(data));
|
|
|
|
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
data.WaveDeviceId = wod;
|
|
|
|
data.DeviceId = DSOUND_renderer_guids[wod];
|
|
|
|
data.Description = desc.szDesc;
|
|
|
|
data.Module = desc.szDrvname;
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL );
|
|
|
|
data.Interface = szInterface;
|
|
|
|
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
|
|
|
if (err == DS_OK && drv)
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
|
|
|
|
|
|
|
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
|
|
|
|
(ppd->Callback)(&data, ppd->Context);
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2006-08-22 13:36:08 +02:00
|
|
|
HeapFree(GetProcessHeap(),0,szInterface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(),0,nameW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-08-07 00:57:24 +02:00
|
|
|
|
2006-08-22 13:36:08 +02:00
|
|
|
devs = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < devs; ++wid) {
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
DWORD size;
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size);
|
|
|
|
if (nameW) {
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR));
|
|
|
|
if (szInterface) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
ZeroMemory(&data, sizeof(data));
|
|
|
|
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
data.WaveDeviceId = wid;
|
|
|
|
data.DeviceId = DSOUND_capture_guids[wid];
|
|
|
|
data.Description = desc.szDesc;
|
|
|
|
data.Module = desc.szDrvname;
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL );
|
|
|
|
data.Interface = szInterface;
|
|
|
|
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
|
|
|
if (err == DS_OK && drv)
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
|
|
|
|
|
|
|
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
|
|
|
|
(ppd->Callback)(&data, ppd->Context);
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2006-08-22 13:36:08 +02:00
|
|
|
HeapFree(GetProcessHeap(),0,szInterface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(),0,nameW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-08-07 00:57:24 +02:00
|
|
|
|
2006-08-22 13:36:08 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
2003-08-07 00:57:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pcbReturned) {
|
2006-08-22 13:36:08 +02:00
|
|
|
*pcbReturned = 0;
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("*pcbReturned=%d\n", *pcbReturned);
|
2003-08-07 00:57:24 +02:00
|
|
|
}
|
2004-07-14 01:35:09 +02:00
|
|
|
|
2003-04-30 00:49:52 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DSPROPERTY_EnumerateW(
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData,
|
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
2003-08-07 00:57:24 +02:00
|
|
|
PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA) pPropData;
|
|
|
|
HRESULT err;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
pPropData,cbPropData,pcbReturned);
|
|
|
|
|
|
|
|
if (ppd) {
|
|
|
|
if (ppd->Callback) {
|
|
|
|
unsigned devs, wod, wid;
|
|
|
|
DSDRIVERDESC desc;
|
|
|
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
|
|
|
|
|
|
|
|
devs = waveOutGetNumDevs();
|
|
|
|
for (wod = 0; wod < devs; ++wod) {
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
if (wDescription && wModule) {
|
|
|
|
DWORD size;
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
|
|
|
|
if (wInterface) {
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
ZeroMemory(&data, sizeof(data));
|
|
|
|
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
|
|
|
data.WaveDeviceId = wod;
|
|
|
|
data.DeviceId = DSOUND_renderer_guids[wod];
|
|
|
|
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
|
|
|
|
|
|
|
|
data.Description = wDescription;
|
|
|
|
data.Module = wModule;
|
|
|
|
data.Interface = wInterface;
|
|
|
|
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
|
|
|
if (err == DS_OK && drv)
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
|
|
|
|
|
|
|
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
|
|
|
|
(ppd->Callback)(&data, ppd->Context);
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2006-08-22 13:36:08 +02:00
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(),0,wInterface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(),0,wDescription);
|
|
|
|
HeapFree(GetProcessHeap(),0,wModule);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
devs = waveInGetNumDevs();
|
|
|
|
for (wid = 0; wid < devs; ++wid) {
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
|
|
|
|
if (wDescription && wModule) {
|
|
|
|
DWORD size;
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
|
|
|
|
if (wInterface) {
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
|
|
|
|
if (err == DS_OK) {
|
|
|
|
PIDSCDRIVER drv;
|
|
|
|
ZeroMemory(&data, sizeof(data));
|
|
|
|
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
|
|
|
data.WaveDeviceId = wid;
|
|
|
|
data.DeviceId = DSOUND_capture_guids[wid];
|
|
|
|
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
|
|
|
|
|
|
|
|
data.Description = wDescription;
|
|
|
|
data.Module = wModule;
|
|
|
|
data.Interface = wInterface;
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
|
|
|
|
err = mmErr(waveInMessage((HWAVEIN)wid, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&drv, 0));
|
|
|
|
if (err == DS_OK && drv)
|
|
|
|
data.Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
|
|
|
else
|
|
|
|
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
|
|
|
|
|
|
|
|
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
|
|
|
|
(ppd->Callback)(&data, ppd->Context);
|
2005-03-14 11:03:54 +01:00
|
|
|
}
|
2006-08-22 13:36:08 +02:00
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(),0,wInterface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(),0,wDescription);
|
|
|
|
HeapFree(GetProcessHeap(),0,wModule);
|
|
|
|
}
|
|
|
|
}
|
2003-08-07 00:57:24 +02:00
|
|
|
|
2006-08-22 13:36:08 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
2003-08-07 00:57:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pcbReturned) {
|
2006-08-22 13:36:08 +02:00
|
|
|
*pcbReturned = 0;
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("*pcbReturned=%d\n", *pcbReturned);
|
2003-08-07 00:57:24 +02:00
|
|
|
}
|
2004-07-14 01:35:09 +02:00
|
|
|
|
2003-04-30 00:49:52 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
static HRESULT WINAPI IKsPrivatePropertySetImpl_Get(
|
|
|
|
LPKSPROPERTYSET iface,
|
|
|
|
REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID,
|
|
|
|
LPVOID pInstanceData,
|
|
|
|
ULONG cbInstanceData,
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData,
|
2005-03-14 11:03:54 +01:00
|
|
|
PULONG pcbReturned )
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(iface=%p,guidPropSet=%s,dwPropID=%d,pInstanceData=%p,cbInstanceData=%d,pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
2006-08-22 13:36:08 +02:00
|
|
|
This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
|
2003-08-07 00:57:24 +02:00
|
|
|
|
|
|
|
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
|
2006-08-22 13:36:08 +02:00
|
|
|
switch (dwPropID) {
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
|
|
|
|
return DSPROPERTY_WaveDeviceMappingA(pPropData,cbPropData,pcbReturned);
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
|
|
|
|
return DSPROPERTY_Description1(pPropData,cbPropData,pcbReturned);
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
|
|
|
|
return DSPROPERTY_Enumerate1(pPropData,cbPropData,pcbReturned);
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
|
|
|
|
return DSPROPERTY_WaveDeviceMappingW(pPropData,cbPropData,pcbReturned);
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
|
|
|
|
return DSPROPERTY_DescriptionA(pPropData,cbPropData,pcbReturned);
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
|
|
|
|
return DSPROPERTY_DescriptionW(pPropData,cbPropData,pcbReturned);
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
|
|
|
|
return DSPROPERTY_EnumerateA(pPropData,cbPropData,pcbReturned);
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
|
|
|
|
return DSPROPERTY_EnumerateW(pPropData,cbPropData,pcbReturned);
|
|
|
|
default:
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("unsupported ID: %d\n",dwPropID);
|
2006-08-22 13:36:08 +02:00
|
|
|
break;
|
|
|
|
}
|
2003-08-07 00:57:24 +02:00
|
|
|
} else {
|
2006-08-22 13:36:08 +02:00
|
|
|
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
|
2003-08-07 00:57:24 +02:00
|
|
|
}
|
2003-04-30 00:49:52 +02:00
|
|
|
|
2003-08-07 00:57:24 +02:00
|
|
|
if (pcbReturned) {
|
2006-08-22 13:36:08 +02:00
|
|
|
*pcbReturned = 0;
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("*pcbReturned=%d\n", *pcbReturned);
|
2003-08-07 00:57:24 +02:00
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-08-07 00:57:24 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
static HRESULT WINAPI IKsPrivatePropertySetImpl_Set(
|
|
|
|
LPKSPROPERTYSET iface,
|
|
|
|
REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID,
|
|
|
|
LPVOID pInstanceData,
|
|
|
|
ULONG cbInstanceData,
|
|
|
|
LPVOID pPropData,
|
|
|
|
ULONG cbPropData )
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("(%p,%s,%d,%p,%d,%p,%d), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
|
2003-08-20 20:18:23 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
static HRESULT WINAPI IKsPrivatePropertySetImpl_QuerySupport(
|
|
|
|
LPKSPROPERTYSET iface,
|
|
|
|
REFGUID guidPropSet,
|
|
|
|
ULONG dwPropID,
|
|
|
|
PULONG pTypeSupport )
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
|
2006-11-12 14:40:35 +01:00
|
|
|
TRACE("(%p,%s,%d,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
|
2003-08-07 00:57:24 +02:00
|
|
|
|
|
|
|
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
|
|
|
|
switch (dwPropID) {
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
|
|
|
|
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
|
|
|
|
return S_OK;
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
|
|
|
|
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
|
|
|
|
return S_OK;
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
|
|
|
|
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
|
|
|
|
return S_OK;
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
|
|
|
|
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
|
|
|
|
return S_OK;
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
|
|
|
|
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
|
|
|
|
return S_OK;
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
|
|
|
|
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
|
|
|
|
return S_OK;
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
|
|
|
|
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
|
|
|
|
return S_OK;
|
|
|
|
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
|
|
|
|
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
|
|
|
|
return S_OK;
|
|
|
|
default:
|
2006-11-12 14:40:35 +01:00
|
|
|
FIXME("unsupported ID: %d\n",dwPropID);
|
2003-08-07 00:57:24 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-08-07 00:57:24 +02:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IKsPropertySetVtbl ikspvt = {
|
2003-08-20 20:18:23 +02:00
|
|
|
IKsPrivatePropertySetImpl_QueryInterface,
|
|
|
|
IKsPrivatePropertySetImpl_AddRef,
|
|
|
|
IKsPrivatePropertySetImpl_Release,
|
|
|
|
IKsPrivatePropertySetImpl_Get,
|
|
|
|
IKsPrivatePropertySetImpl_Set,
|
|
|
|
IKsPrivatePropertySetImpl_QuerySupport
|
2002-06-13 21:15:06 +02:00
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IKsPrivatePropertySetImpl_Create(
|
2006-08-18 07:13:31 +02:00
|
|
|
REFIID riid,
|
2003-08-20 20:18:23 +02:00
|
|
|
IKsPrivatePropertySetImpl **piks)
|
2002-06-13 21:15:06 +02:00
|
|
|
{
|
2003-08-20 20:18:23 +02:00
|
|
|
IKsPrivatePropertySetImpl *iks;
|
2006-08-18 07:13:31 +02:00
|
|
|
TRACE("(%s, %p)\n", debugstr_guid(riid), piks);
|
|
|
|
|
|
|
|
if (!IsEqualIID(riid, &IID_IUnknown) &&
|
|
|
|
!IsEqualIID(riid, &IID_IKsPropertySet)) {
|
|
|
|
*piks = 0;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2004-08-18 02:30:37 +02:00
|
|
|
iks = HeapAlloc(GetProcessHeap(),0,sizeof(*iks));
|
2005-06-04 11:38:14 +02:00
|
|
|
iks->ref = 1;
|
2003-08-20 20:18:23 +02:00
|
|
|
iks->lpVtbl = &ikspvt;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-08-20 20:18:23 +02:00
|
|
|
*piks = iks;
|
|
|
|
return S_OK;
|
2002-06-13 21:15:06 +02:00
|
|
|
}
|