3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2002 TransGaming Technologies, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "wine/debug.h"
35 #include "dsound_private.h"
39 #ifdef NONAMELESSSTRUCT
45 WINE_DEFAULT_DEBUG_CHANNEL(dsound);
48 /*******************************************************************************
49 * IKsBufferPropertySet
52 /* IUnknown methods */
53 static HRESULT WINAPI IKsBufferPropertySetImpl_QueryInterface(
54 LPKSPROPERTYSET iface,
58 IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
59 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
61 return IDirectSoundBuffer_QueryInterface((LPDIRECTSOUNDBUFFER8)This->dsb, riid, ppobj);
64 static ULONG WINAPI IKsBufferPropertySetImpl_AddRef(LPKSPROPERTYSET iface)
66 IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
67 ULONG ref = InterlockedIncrement(&(This->ref));
68 TRACE("(%p) ref was %ld\n", This, ref - 1);
72 static ULONG WINAPI IKsBufferPropertySetImpl_Release(LPKSPROPERTYSET iface)
74 IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
75 ULONG ref = InterlockedDecrement(&(This->ref));
76 TRACE("(%p) ref was %ld\n", This, ref + 1);
80 IDirectSoundBuffer_Release((LPDIRECTSOUND3DBUFFER)This->dsb);
81 HeapFree(GetProcessHeap(), 0, This);
82 TRACE("(%p) released\n", This);
87 static HRESULT WINAPI IKsBufferPropertySetImpl_Get(
88 LPKSPROPERTYSET iface,
97 IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
98 PIDSDRIVERPROPERTYSET ps;
99 TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
100 This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
102 if (This->dsb->hwbuf) {
103 IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
109 S(prop).Set = *guidPropSet;
110 S(prop).Id = dwPropID;
111 S(prop).Flags = 0; /* unused */
112 S(prop).InstanceId = (ULONG)This->dsb->dsound;
114 hres = IDsDriverPropertySet_Get(ps, &prop, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned);
116 IDsDriverPropertySet_Release(ps);
122 return E_PROP_ID_UNSUPPORTED;
125 static HRESULT WINAPI IKsBufferPropertySetImpl_Set(
126 LPKSPROPERTYSET iface,
129 LPVOID pInstanceData,
130 ULONG cbInstanceData,
134 IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
135 PIDSDRIVERPROPERTYSET ps;
136 TRACE("(%p,%s,%ld,%p,%ld,%p,%ld)\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
138 if (This->dsb->hwbuf) {
139 IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
145 S(prop).Set = *guidPropSet;
146 S(prop).Id = dwPropID;
147 S(prop).Flags = 0; /* unused */
148 S(prop).InstanceId = (ULONG)This->dsb->dsound;
149 hres = IDsDriverPropertySet_Set(ps,&prop,pInstanceData,cbInstanceData,pPropData,cbPropData);
151 IDsDriverPropertySet_Release(ps);
157 return E_PROP_ID_UNSUPPORTED;
160 static HRESULT WINAPI IKsBufferPropertySetImpl_QuerySupport(
161 LPKSPROPERTYSET iface,
164 PULONG pTypeSupport )
166 IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
167 PIDSDRIVERPROPERTYSET ps;
168 TRACE("(%p,%s,%ld,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
170 if (This->dsb->hwbuf) {
171 IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
176 hres = IDsDriverPropertySet_QuerySupport(ps,guidPropSet, dwPropID,pTypeSupport);
178 IDsDriverPropertySet_Release(ps);
184 return E_PROP_ID_UNSUPPORTED;
187 static IKsPropertySetVtbl iksbvt = {
188 IKsBufferPropertySetImpl_QueryInterface,
189 IKsBufferPropertySetImpl_AddRef,
190 IKsBufferPropertySetImpl_Release,
191 IKsBufferPropertySetImpl_Get,
192 IKsBufferPropertySetImpl_Set,
193 IKsBufferPropertySetImpl_QuerySupport
196 HRESULT WINAPI IKsBufferPropertySetImpl_Create(
197 IDirectSoundBufferImpl *dsb,
198 IKsBufferPropertySetImpl **piks)
200 IKsBufferPropertySetImpl *iks;
201 TRACE("(%p,%p)\n",dsb,piks);
203 iks = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*iks));
205 WARN("out of memory\n");
207 return DSERR_OUTOFMEMORY;
213 iks->lpVtbl = &iksbvt;
215 IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER)dsb);
221 HRESULT WINAPI IKsBufferPropertySetImpl_Destroy(
222 IKsBufferPropertySetImpl *piks)
224 TRACE("(%p)\n",piks);
226 while (IKsBufferPropertySetImpl_Release((LPKSPROPERTYSET)piks) > 0);
231 /*******************************************************************************
232 * IKsPrivatePropertySet
235 /* IUnknown methods */
236 static HRESULT WINAPI IKsPrivatePropertySetImpl_QueryInterface(
237 LPKSPROPERTYSET iface,
241 IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
242 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
245 return DSERR_INVALIDPARAM;
248 static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface)
250 IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
251 ULONG ref = InterlockedIncrement(&(This->ref));
252 TRACE("(%p) ref was %ld\n", This, ref - 1);
256 static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface)
258 IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
259 ULONG ref = InterlockedDecrement(&(This->ref));
260 TRACE("(%p) ref was %ld\n", This, ref + 1);
263 HeapFree(GetProcessHeap(), 0, This);
264 TRACE("(%p) released\n", This);
269 static HRESULT WINAPI DSPROPERTY_WaveDeviceMappingA(
275 PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA ppd;
276 FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p) not implemented!\n",
277 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
279 ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA) pPropData;
282 WARN("invalid parameter: pPropData\n");
283 return DSERR_INVALIDPARAM;
286 FIXME("DeviceName=%s\n",ppd->DeviceName);
287 FIXME("DataFlow=%s\n",
288 ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "DIRECTSOUNDDEVICE_DATAFLOW_RENDER" :
289 ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ? "DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE" : "UNKNOWN");
291 /* FIXME: match the name to a wave device somehow. */
292 ppd->DeviceId = GUID_NULL;
295 *pcbReturned = cbPropData;
296 FIXME("*pcbReturned=%ld\n", *pcbReturned);
302 static HRESULT WINAPI DSPROPERTY_WaveDeviceMappingW(
308 PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA ppd;
309 FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p) not implemented!\n",
310 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
312 ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA) pPropData;
315 WARN("invalid parameter: pPropData\n");
316 return DSERR_INVALIDPARAM;
319 FIXME("DeviceName=%s\n",debugstr_w(ppd->DeviceName));
320 FIXME("DataFlow=%s\n",
321 ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "DIRECTSOUNDDEVICE_DATAFLOW_RENDER" :
322 ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ? "DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE" : "UNKNOWN");
324 /* FIXME: match the name to a wave device somehow. */
325 ppd->DeviceId = GUID_NULL;
328 *pcbReturned = cbPropData;
329 FIXME("*pcbReturned=%ld\n", *pcbReturned);
335 static HRESULT WINAPI DSPROPERTY_Description1(
343 PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA ppd;
344 TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
345 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
347 ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA) pPropData;
350 WARN("invalid parameter: pPropData\n");
351 return DSERR_INVALIDPARAM;
354 TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
355 if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
356 /* default device of type specified by ppd->DataFlow */
357 if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
358 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
359 } else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
360 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
362 TRACE("DataFlow=Unknown(%d)\n", ppd->DataFlow);
364 FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p) GUID_NULL not implemented!\n",
365 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
366 return E_PROP_ID_UNSUPPORTED;
369 ppd->Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
370 GetDeviceID(&ppd->DeviceId, &dev_guid);
372 if ( IsEqualGUID( &ppd->DeviceId, &DSDEVID_DefaultPlayback) ||
373 IsEqualGUID( &ppd->DeviceId, &DSDEVID_DefaultVoicePlayback) ) {
376 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
377 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
378 wodn = waveOutGetNumDevs();
379 for (wod = 0; wod < wodn; wod++) {
380 if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) {
382 ppd->WaveDeviceId = wod;
384 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
386 PIDSDRIVER drv = NULL;
387 strncpy(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA) - 1);
388 strncpy(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA) - 1);
389 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) );
390 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) );
391 err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
392 if (err == DS_OK && drv)
393 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
395 WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
398 WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
399 return E_PROP_ID_UNSUPPORTED;
403 } else if ( IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) ||
404 IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) {
407 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
408 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
409 widn = waveInGetNumDevs();
410 for (wid = 0; wid < widn; wid++) {
411 if (IsEqualGUID( &dev_guid, &guid) ) {
413 ppd->WaveDeviceId = wid;
415 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
418 strncpy(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA) - 1);
419 strncpy(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA) - 1);
420 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) );
421 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) );
422 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
423 if (err == DS_OK && drv)
424 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
426 WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
429 WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
430 return E_PROP_ID_UNSUPPORTED;
438 /* given specific device so try the render devices first */
439 wodn = waveOutGetNumDevs();
440 for (wod = 0; wod < wodn; wod++) {
441 if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) {
443 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
444 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
445 ppd->WaveDeviceId = wod;
447 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
449 PIDSDRIVER drv = NULL;
450 strncpy(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA) - 1);
451 strncpy(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA) - 1);
452 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) );
453 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) );
454 err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
455 if (err == DS_OK && drv)
456 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
458 WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
462 WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
463 return E_PROP_ID_UNSUPPORTED;
468 if (found == FALSE) {
471 /* given specific device so try the capture devices next */
472 widn = waveInGetNumDevs();
473 for (wid = 0; wid < widn; wid++) {
474 if (IsEqualGUID( &ppd->DeviceId, &capture_guids[wid] ) ) {
476 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
477 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
478 ppd->WaveDeviceId = wid;
480 err = mmErr(waveInMessage((HWAVEIN)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
482 PIDSDRIVER drv = NULL;
483 strncpy(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA) - 1);
484 strncpy(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA) - 1);
485 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) );
486 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) );
487 err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
488 if (err == DS_OK && drv)
489 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
491 WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
495 WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
496 return E_PROP_ID_UNSUPPORTED;
501 if (found == FALSE) {
502 WARN("device not found\n");
503 return E_PROP_ID_UNSUPPORTED;
509 *pcbReturned = cbPropData;
510 TRACE("*pcbReturned=%ld\n", *pcbReturned);
516 static HRESULT WINAPI DSPROPERTY_DescriptionA(
522 PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA) pPropData;
525 TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
526 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
528 TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
529 if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
530 /* default device of type specified by ppd->DataFlow */
531 if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
532 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
533 } else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
534 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
536 TRACE("DataFlow=Unknown(%d)\n", ppd->DataFlow);
538 FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p) GUID_NULL not implemented!\n",
539 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
540 return E_PROP_ID_UNSUPPORTED;
543 ppd->Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
544 GetDeviceID(&ppd->DeviceId, &dev_guid);
546 if ( IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultPlayback) ||
547 IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoicePlayback) ) {
550 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
551 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
552 wodn = waveOutGetNumDevs();
553 for (wod = 0; wod < wodn; wod++) {
554 if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) {
556 ppd->WaveDeviceId = wod;
557 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
559 PIDSDRIVER drv = NULL;
560 /* FIXME: this is a memory leak */
561 CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
562 CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
563 CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
565 if (szDescription && szModule && szInterface) {
566 strcpy(szDescription, desc.szDesc);
567 strcpy(szModule, desc.szDrvname);
568 strcpy(szInterface, "Interface");
570 ppd->Description = szDescription;
571 ppd->Module = szModule;
572 ppd->Interface = szInterface;
573 err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
574 if (err == DS_OK && drv)
575 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
577 WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
581 HeapFree(GetProcessHeap(), 0, szDescription);
582 HeapFree(GetProcessHeap(), 0, szModule);
583 HeapFree(GetProcessHeap(), 0, szInterface);
584 return E_OUTOFMEMORY;
587 WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
588 return E_PROP_ID_UNSUPPORTED;
592 } else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) ||
593 IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) {
596 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
597 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
598 widn = waveInGetNumDevs();
599 for (wid = 0; wid < widn; wid++) {
600 if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) {
602 ppd->WaveDeviceId = wid;
603 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
606 /* FIXME: this is a memory leak */
607 CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
608 CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
609 CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
611 if (szDescription && szModule && szInterface) {
612 strcpy(szDescription, desc.szDesc);
613 strcpy(szModule, desc.szDrvname);
614 strcpy(szInterface, "Interface");
616 ppd->Description = szDescription;
617 ppd->Module = szModule;
618 ppd->Interface = szInterface;
619 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
620 if (err == DS_OK && drv)
621 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
623 WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
627 HeapFree(GetProcessHeap(), 0, szDescription);
628 HeapFree(GetProcessHeap(), 0, szModule);
629 HeapFree(GetProcessHeap(), 0, szInterface);
630 return E_OUTOFMEMORY;
633 WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
634 return E_PROP_ID_UNSUPPORTED;
642 /* given specific device so try the render devices first */
643 wodn = waveOutGetNumDevs();
644 for (wod = 0; wod < wodn; wod++) {
645 if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) {
647 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
648 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
649 ppd->WaveDeviceId = wod;
650 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
652 PIDSDRIVER drv = NULL;
653 /* FIXME: this is a memory leak */
654 CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
655 CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
656 CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
658 if (szDescription && szModule && szInterface) {
659 strcpy(szDescription, desc.szDesc);
660 strcpy(szModule, desc.szDrvname);
661 strcpy(szInterface, "Interface");
663 ppd->Description = szDescription;
664 ppd->Module = szModule;
665 ppd->Interface = szInterface;
666 err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
667 if (err == DS_OK && drv)
668 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
670 WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
675 HeapFree(GetProcessHeap(), 0, szDescription);
676 HeapFree(GetProcessHeap(), 0, szModule);
677 HeapFree(GetProcessHeap(), 0, szInterface);
678 return E_OUTOFMEMORY;
681 WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
682 return E_PROP_ID_UNSUPPORTED;
687 if (found == FALSE) {
690 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
691 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
692 widn = waveInGetNumDevs();
693 for (wid = 0; wid < widn; wid++) {
694 if (IsEqualGUID( &ppd->DeviceId, &capture_guids[wod] ) ) {
696 ppd->WaveDeviceId = wid;
697 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
700 /* FIXME: this is a memory leak */
701 CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
702 CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
703 CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
705 if (szDescription && szModule && szInterface) {
706 strcpy(szDescription, desc.szDesc);
707 strcpy(szModule, desc.szDrvname);
708 strcpy(szInterface, "Interface");
710 ppd->Description = szDescription;
711 ppd->Module = szModule;
712 ppd->Interface = szInterface;
713 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
714 if (err == DS_OK && drv)
715 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
717 WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
722 HeapFree(GetProcessHeap(), 0, szDescription);
723 HeapFree(GetProcessHeap(), 0, szModule);
724 HeapFree(GetProcessHeap(), 0, szInterface);
725 return E_OUTOFMEMORY;
728 WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
729 return E_PROP_ID_UNSUPPORTED;
735 if (found == FALSE) {
736 WARN("device not found\n");
737 return E_PROP_ID_UNSUPPORTED;
742 *pcbReturned = cbPropData;
743 TRACE("*pcbReturned=%ld\n", *pcbReturned);
749 static HRESULT WINAPI DSPROPERTY_DescriptionW(
755 PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA) pPropData;
758 TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
759 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
761 TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
762 if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
763 /* default device of type specified by ppd->DataFlow */
764 if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
765 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
766 } else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
767 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
769 TRACE("DataFlow=Unknown(%d)\n", ppd->DataFlow);
771 FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p) GUID_NULL not implemented!\n",
772 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
773 return E_PROP_ID_UNSUPPORTED;
776 ppd->Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
777 GetDeviceID(&ppd->DeviceId, &dev_guid);
779 if ( IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultPlayback) ||
780 IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoicePlayback) ) {
783 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
784 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
785 wodn = waveOutGetNumDevs();
786 for (wod = 0; wod < wodn; wod++) {
787 if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) {
789 ppd->WaveDeviceId = wod;
790 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
792 PIDSDRIVER drv = NULL;
793 /* FIXME: this is a memory leak */
794 WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
795 WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
796 WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
798 if (wDescription && wModule && wInterface) {
799 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
800 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
801 MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
803 ppd->Description = wDescription;
804 ppd->Module = wModule;
805 ppd->Interface = wInterface;
806 err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
807 if (err == DS_OK && drv)
808 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
810 WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
814 HeapFree(GetProcessHeap(), 0, wDescription);
815 HeapFree(GetProcessHeap(), 0, wModule);
816 HeapFree(GetProcessHeap(), 0, wInterface);
817 return E_OUTOFMEMORY;
820 WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
821 return E_PROP_ID_UNSUPPORTED;
825 } else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) ||
826 IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) {
829 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
830 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
831 widn = waveInGetNumDevs();
832 for (wid = 0; wid < widn; wid++) {
833 if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) {
835 ppd->WaveDeviceId = wid;
836 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
839 /* FIXME: this is a memory leak */
840 WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
841 WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
842 WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
844 if (wDescription && wModule && wInterface) {
845 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
846 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
847 MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
849 ppd->Description = wDescription;
850 ppd->Module = wModule;
851 ppd->Interface = wInterface;
852 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
853 if (err == DS_OK && drv)
854 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
856 WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
860 HeapFree(GetProcessHeap(), 0, wDescription);
861 HeapFree(GetProcessHeap(), 0, wModule);
862 HeapFree(GetProcessHeap(), 0, wInterface);
863 return E_OUTOFMEMORY;
866 WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
867 return E_PROP_ID_UNSUPPORTED;
875 /* given specific device so try the render devices first */
876 wodn = waveOutGetNumDevs();
877 for (wod = 0; wod < wodn; wod++) {
878 if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) {
880 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
881 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
882 ppd->WaveDeviceId = wod;
883 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
885 PIDSDRIVER drv = NULL;
886 /* FIXME: this is a memory leak */
887 WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
888 WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
889 WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
891 if (wDescription && wModule && wInterface) {
892 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
893 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
894 MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
896 ppd->Description = wDescription;
897 ppd->Module = wModule;
898 ppd->Interface = wInterface;
899 err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
900 if (err == DS_OK && drv)
901 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
903 WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
908 HeapFree(GetProcessHeap(), 0, wDescription);
909 HeapFree(GetProcessHeap(), 0, wModule);
910 HeapFree(GetProcessHeap(), 0, wInterface);
911 return E_OUTOFMEMORY;
914 WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
915 return E_PROP_ID_UNSUPPORTED;
920 if (found == FALSE) {
923 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
924 ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
925 widn = waveInGetNumDevs();
926 for (wid = 0; wid < widn; wid++) {
927 if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) {
929 ppd->WaveDeviceId = wid;
930 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
933 /* FIXME: this is a memory leak */
934 WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
935 WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
936 WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
938 if (wDescription && wModule && wInterface) {
939 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
940 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
941 MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
943 ppd->Description = wDescription;
944 ppd->Module = wModule;
945 ppd->Interface = wInterface;
946 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
947 if (err == DS_OK && drv)
948 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
950 WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
955 HeapFree(GetProcessHeap(), 0, wDescription);
956 HeapFree(GetProcessHeap(), 0, wModule);
957 HeapFree(GetProcessHeap(), 0, wInterface);
958 return E_OUTOFMEMORY;
961 WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
962 return E_PROP_ID_UNSUPPORTED;
968 if (found == FALSE) {
969 WARN("device not found\n");
970 return E_PROP_ID_UNSUPPORTED;
975 *pcbReturned = cbPropData;
976 TRACE("*pcbReturned=%ld\n", *pcbReturned);
982 static HRESULT WINAPI DSPROPERTY_Enumerate1(
988 PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA) pPropData;
990 TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
991 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
993 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
996 unsigned devs, wod, wid;
998 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data;
1000 devs = waveOutGetNumDevs();
1001 for (wod = 0; wod < devs; ++wod) {
1002 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
1004 ZeroMemory(&data, sizeof(data));
1005 data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
1006 data.WaveDeviceId = wod;
1007 data.DeviceId = renderer_guids[wod];
1008 strncpy(data.DescriptionA, desc.szDesc, sizeof(data.DescriptionA));
1009 strncpy(data.ModuleA, desc.szDrvname, sizeof(data.ModuleA));
1011 MultiByteToWideChar( CP_ACP, 0, data.DescriptionA, -1, data.DescriptionW, sizeof(data.DescriptionW) );
1012 MultiByteToWideChar( CP_ACP, 0, data.ModuleA, -1, data.ModuleW, sizeof(data.ModuleW) );
1014 TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
1015 (ppd->Callback)(&data, ppd->Context);
1019 devs = waveInGetNumDevs();
1020 for (wid = 0; wid < devs; ++wid) {
1021 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
1023 ZeroMemory(&data, sizeof(data));
1024 data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
1025 data.WaveDeviceId = wod;
1026 data.DeviceId = renderer_guids[wod];
1027 strncpy(data.DescriptionA, desc.szDesc, sizeof(data.DescriptionA));
1028 strncpy(data.ModuleA, desc.szDrvname, sizeof(data.ModuleA));
1030 MultiByteToWideChar( CP_ACP, 0, data.DescriptionA, -1, data.DescriptionW, sizeof(data.DescriptionW) );
1031 MultiByteToWideChar( CP_ACP, 0, data.ModuleA, -1, data.ModuleW, sizeof(data.ModuleW) );
1033 TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
1034 (ppd->Callback)(&data, ppd->Context);
1042 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
1047 FIXME("*pcbReturned=%ld\n", *pcbReturned);
1050 return E_PROP_ID_UNSUPPORTED;
1053 static HRESULT WINAPI DSPROPERTY_EnumerateA(
1054 REFGUID guidPropSet,
1057 PULONG pcbReturned )
1059 PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA) pPropData;
1061 TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
1062 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
1064 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
1066 if (ppd->Callback) {
1067 unsigned devs, wod, wid;
1069 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA data;
1071 devs = waveOutGetNumDevs();
1072 for (wod = 0; wod < devs; ++wod) {
1073 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
1076 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0));
1078 WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size);
1080 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size));
1082 CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR));
1084 ZeroMemory(&data, sizeof(data));
1085 data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
1086 data.WaveDeviceId = wod;
1087 data.DeviceId = renderer_guids[wod];
1088 data.Description = desc.szDesc;
1089 data.Module = desc.szDrvname;
1090 WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL );
1091 data.Interface = szInterface;
1093 TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
1094 (ppd->Callback)(&data, ppd->Context);
1096 HeapFree(GetProcessHeap(),0,szInterface);
1099 HeapFree(GetProcessHeap(),0,nameW);
1105 devs = waveInGetNumDevs();
1106 for (wid = 0; wid < devs; ++wid) {
1107 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
1110 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0));
1112 WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size);
1114 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size));
1116 CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR));
1118 ZeroMemory(&data, sizeof(data));
1119 data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
1120 data.WaveDeviceId = wid;
1121 data.DeviceId = capture_guids[wid];
1122 data.Description = desc.szDesc;
1123 data.Module = desc.szDrvname;
1124 WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL );
1125 data.Interface = szInterface;
1127 TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
1128 (ppd->Callback)(&data, ppd->Context);
1130 HeapFree(GetProcessHeap(),0,szInterface);
1133 HeapFree(GetProcessHeap(),0,nameW);
1143 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
1148 FIXME("*pcbReturned=%ld\n", *pcbReturned);
1151 return E_PROP_ID_UNSUPPORTED;
1154 static HRESULT WINAPI DSPROPERTY_EnumerateW(
1155 REFGUID guidPropSet,
1158 PULONG pcbReturned )
1160 PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA) pPropData;
1162 TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
1163 debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
1165 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
1167 if (ppd->Callback) {
1168 unsigned devs, wod, wid;
1170 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
1172 devs = waveOutGetNumDevs();
1173 for (wod = 0; wod < devs; ++wod) {
1174 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
1176 WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
1177 WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
1178 if (wDescription && wModule) {
1180 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0));
1182 WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
1184 err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
1186 ZeroMemory(&data, sizeof(data));
1187 data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
1188 data.WaveDeviceId = wod;
1189 data.DeviceId = renderer_guids[wod];
1191 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
1192 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
1194 data.Description = wDescription;
1195 data.Module = wModule;
1196 data.Interface = wInterface;
1198 TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
1199 (ppd->Callback)(&data, ppd->Context);
1201 HeapFree(GetProcessHeap(),0,wInterface);
1204 HeapFree(GetProcessHeap(),0,wDescription);
1205 HeapFree(GetProcessHeap(),0,wModule);
1210 devs = waveInGetNumDevs();
1211 for (wid = 0; wid < devs; ++wid) {
1212 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
1214 WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
1215 WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
1216 if (wDescription && wModule) {
1218 err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0));
1220 WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
1222 err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
1224 ZeroMemory(&data, sizeof(data));
1225 data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
1226 data.WaveDeviceId = wid;
1227 data.DeviceId = capture_guids[wid];
1229 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
1230 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
1232 data.Description = wDescription;
1233 data.Module = wModule;
1234 data.Interface = wInterface;
1235 TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
1236 (ppd->Callback)(&data, ppd->Context);
1238 HeapFree(GetProcessHeap(),0,wInterface);
1241 HeapFree(GetProcessHeap(),0,wDescription);
1242 HeapFree(GetProcessHeap(),0,wModule);
1251 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
1256 FIXME("*pcbReturned=%ld\n", *pcbReturned);
1259 return E_PROP_ID_UNSUPPORTED;
1262 static HRESULT WINAPI IKsPrivatePropertySetImpl_Get(
1263 LPKSPROPERTYSET iface,
1264 REFGUID guidPropSet,
1266 LPVOID pInstanceData,
1267 ULONG cbInstanceData,
1270 PULONG pcbReturned )
1272 IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
1273 TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
1274 This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
1276 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
1278 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
1279 return DSPROPERTY_WaveDeviceMappingA(guidPropSet,pPropData,cbPropData,pcbReturned);
1280 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
1281 return DSPROPERTY_Description1(guidPropSet,pPropData,cbPropData,pcbReturned);
1282 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
1283 return DSPROPERTY_Enumerate1(guidPropSet,pPropData,cbPropData,pcbReturned);
1284 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
1285 return DSPROPERTY_WaveDeviceMappingW(guidPropSet,pPropData,cbPropData,pcbReturned);
1286 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
1287 return DSPROPERTY_DescriptionA(guidPropSet,pPropData,cbPropData,pcbReturned);
1288 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
1289 return DSPROPERTY_DescriptionW(guidPropSet,pPropData,cbPropData,pcbReturned);
1290 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
1291 return DSPROPERTY_EnumerateA(guidPropSet,pPropData,cbPropData,pcbReturned);
1292 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
1293 return DSPROPERTY_EnumerateW(guidPropSet,pPropData,cbPropData,pcbReturned);
1295 FIXME("unsupported ID: %ld\n",dwPropID);
1299 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
1304 FIXME("*pcbReturned=%ld\n", *pcbReturned);
1307 return E_PROP_ID_UNSUPPORTED;
1310 static HRESULT WINAPI IKsPrivatePropertySetImpl_Set(
1311 LPKSPROPERTYSET iface,
1312 REFGUID guidPropSet,
1314 LPVOID pInstanceData,
1315 ULONG cbInstanceData,
1319 IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
1321 FIXME("(%p,%s,%ld,%p,%ld,%p,%ld), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
1322 return E_PROP_ID_UNSUPPORTED;
1325 static HRESULT WINAPI IKsPrivatePropertySetImpl_QuerySupport(
1326 LPKSPROPERTYSET iface,
1327 REFGUID guidPropSet,
1329 PULONG pTypeSupport )
1331 IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
1332 TRACE("(%p,%s,%ld,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
1334 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
1336 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
1337 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
1339 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
1340 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
1342 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
1343 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
1345 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
1346 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
1348 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
1349 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
1351 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
1352 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
1354 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
1355 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
1357 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
1358 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
1361 FIXME("unsupported ID: %ld\n",dwPropID);
1365 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
1368 return E_PROP_ID_UNSUPPORTED;
1371 static IKsPropertySetVtbl ikspvt = {
1372 IKsPrivatePropertySetImpl_QueryInterface,
1373 IKsPrivatePropertySetImpl_AddRef,
1374 IKsPrivatePropertySetImpl_Release,
1375 IKsPrivatePropertySetImpl_Get,
1376 IKsPrivatePropertySetImpl_Set,
1377 IKsPrivatePropertySetImpl_QuerySupport
1380 HRESULT WINAPI IKsPrivatePropertySetImpl_Create(
1381 IKsPrivatePropertySetImpl **piks)
1383 IKsPrivatePropertySetImpl *iks;
1385 iks = HeapAlloc(GetProcessHeap(),0,sizeof(*iks));
1387 iks->lpVtbl = &ikspvt;