2 * Unit tests for CLSID_DirectSoundPrivate property set functions
5 * Copyright (c) 2003 Robert Reif
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/test.h"
31 #include "dsound_test.h"
33 #ifndef DSBCAPS_CTRLDEFAULT
34 #define DSBCAPS_CTRLDEFAULT \
35 DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME
38 DEFINE_GUID(DSPROPSETID_VoiceManager, \
39 0x62A69BAE,0xDF9D,0x11D1,0x99,0xA6,0x00,0xC0,0x4F,0xC9,0x9D,0x46);
40 DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties, \
41 0x306a6a8,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
42 DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties, \
43 0x306a6a7,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
44 DEFINE_GUID(DSPROPSETID_I3DL2_ListenerProperties, \
45 0xDA0F0520,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
46 DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties, \
47 0xDA0F0521,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
48 DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties, \
49 0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC);
51 typedef HRESULT (CALLBACK * MYPROC)(REFCLSID, REFIID, LPVOID *);
53 static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,
55 static HRESULT (WINAPI *pDirectSoundCaptureCreate)(LPCGUID,
56 LPDIRECTSOUNDCAPTURE*,LPUNKNOWN)=NULL;
57 static HRESULT (WINAPI *pDirectSoundCaptureCreate8)(LPCGUID,
58 LPDIRECTSOUNDCAPTURE8*,LPUNKNOWN)=NULL;
59 static HRESULT (WINAPI *pDirectSoundFullDuplexCreate)(LPCGUID,LPCGUID,
60 LPCDSCBUFFERDESC,LPCDSBUFFERDESC,HWND,DWORD,LPDIRECTSOUNDFULLDUPLEX*,
61 LPDIRECTSOUNDCAPTUREBUFFER8*,LPDIRECTSOUNDBUFFER8*,LPUNKNOWN)=NULL;
63 BOOL CALLBACK callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data,
66 trace(" found device:\n");
68 data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" :
69 data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" :
70 data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown");
71 trace(" DataFlow: %s\n",
72 data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" :
73 data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ?
74 "Capture" : "Unknown");
75 trace(" DeviceId: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
76 data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3,
77 data->DeviceId.Data4[0],data->DeviceId.Data4[1],
78 data->DeviceId.Data4[2],data->DeviceId.Data4[3],
79 data->DeviceId.Data4[4],data->DeviceId.Data4[5],
80 data->DeviceId.Data4[6],data->DeviceId.Data4[7]);
81 trace(" Description: %s\n", data->Description);
82 trace(" Module: %s\n", data->Module);
83 trace(" Interface: %s\n", data->Interface);
84 trace(" WaveDeviceId: %d\n", data->WaveDeviceId);
89 BOOL CALLBACK callback1(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data,
92 char descriptionA[0x100];
93 char moduleA[MAX_PATH];
95 trace(" found device:\n");
97 data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" :
98 data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" :
99 data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown");
100 trace(" DataFlow: %s\n",
101 data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" :
102 data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ?
103 "Capture" : "Unknown");
104 trace(" DeviceId: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
105 data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3,
106 data->DeviceId.Data4[0],data->DeviceId.Data4[1],
107 data->DeviceId.Data4[2],data->DeviceId.Data4[3],
108 data->DeviceId.Data4[4],data->DeviceId.Data4[5],
109 data->DeviceId.Data4[6],data->DeviceId.Data4[7]);
110 trace(" DescriptionA: %s\n", data->DescriptionA);
111 WideCharToMultiByte(CP_ACP, 0, data->DescriptionW, -1, descriptionA, sizeof(descriptionA), NULL, NULL);
112 trace(" DescriptionW: %s\n", descriptionA);
113 trace(" ModuleA: %s\n", data->ModuleA);
114 WideCharToMultiByte(CP_ACP, 0, data->ModuleW, -1, moduleA, sizeof(moduleA), NULL, NULL);
115 trace(" ModuleW: %s\n", moduleA);
116 trace(" WaveDeviceId: %d\n", data->WaveDeviceId);
121 BOOL CALLBACK callbackA(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA data,
124 trace(" found device:\n");
126 data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" :
127 data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" :
128 data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown");
129 trace(" DataFlow: %s\n",
130 data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" :
131 data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ?
132 "Capture" : "Unknown");
133 trace(" DeviceId: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
134 data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3,
135 data->DeviceId.Data4[0],data->DeviceId.Data4[1],
136 data->DeviceId.Data4[2],data->DeviceId.Data4[3],
137 data->DeviceId.Data4[4],data->DeviceId.Data4[5],
138 data->DeviceId.Data4[6],data->DeviceId.Data4[7]);
139 trace(" Description: %s\n", data->Description);
140 trace(" Module: %s\n", data->Module);
141 trace(" Interface: %s\n", data->Interface);
142 trace(" WaveDeviceId: %d\n", data->WaveDeviceId);
147 BOOL CALLBACK callbackW(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data,
150 char descriptionA[0x100];
151 char moduleA[MAX_PATH];
152 char interfaceA[MAX_PATH];
154 trace("found device:\n");
155 trace("\tType: %s\n",
156 data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" :
157 data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" :
158 data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown");
159 trace("\tDataFlow: %s\n",
160 data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" :
161 data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ?
162 "Capture" : "Unknown");
163 trace("\tDeviceId: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
164 data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3,
165 data->DeviceId.Data4[0],data->DeviceId.Data4[1],
166 data->DeviceId.Data4[2],data->DeviceId.Data4[3],
167 data->DeviceId.Data4[4],data->DeviceId.Data4[5],
168 data->DeviceId.Data4[6],data->DeviceId.Data4[7]);
169 WideCharToMultiByte(CP_ACP, 0, data->Description, -1, descriptionA, sizeof(descriptionA), NULL, NULL);
170 WideCharToMultiByte(CP_ACP, 0, data->Module, -1, moduleA, sizeof(moduleA), NULL, NULL);
171 WideCharToMultiByte(CP_ACP, 0, data->Interface, -1, interfaceA, sizeof(interfaceA), NULL, NULL);
172 trace("\tDescription: %s\n", descriptionA);
173 trace("\tModule: %s\n", moduleA);
174 trace("\tInterface: %s\n", interfaceA);
175 trace("\tWaveDeviceId: %d\n", data->WaveDeviceId);
180 static void propset_private_tests(void)
185 IKsPropertySet * pps;
189 hDsound = LoadLibrary("dsound.dll");
190 ok(hDsound!=0,"LoadLibrary(dsound.dll) failed\n");
194 fProc = (MYPROC)GetProcAddress(hDsound, "DllGetClassObject");
196 /* try direct sound first */
197 /* DSOUND: Error: Invalid interface buffer */
198 rc = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)0);
199 ok(rc==DSERR_INVALIDPARAM,"DllGetClassObject(CLSID_DirectSound, "
200 "IID_IClassFactory) should have returned DSERR_INVALIDPARAM, "
201 "returned: %s\n",DXGetErrorString8(rc));
203 rc = (fProc)(&CLSID_DirectSound, &IID_IDirectSound, (void **)(&pcf));
204 ok(rc==E_NOINTERFACE,"DllGetClassObject(CLSID_DirectSound, "
205 "IID_IDirectSound) should have returned E_NOINTERFACE, "
206 "returned: %s\n",DXGetErrorString8(rc));
208 rc = (fProc)(&CLSID_DirectSound, &IID_IUnknown, (void **)(&pcf));
209 ok(rc==DS_OK,"DllGetClassObject(CLSID_DirectSound, "
210 "IID_IUnknown) failed: %s\n",DXGetErrorString8(rc));
212 rc = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)(&pcf));
213 ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
214 "failed: %s\n",DXGetErrorString8(rc));
218 /* direct sound doesn't have an IKsPropertySet */
219 /* DSOUND: Error: Invalid interface buffer */
220 rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
222 ok(rc==DSERR_INVALIDPARAM, "CreateInstance(IID_IKsPropertySet) should have "
223 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
225 rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
227 ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
228 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc));
230 /* and the direct sound 8 version */
231 if (pDirectSoundCreate8) {
232 rc = (fProc)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf));
233 ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
234 "failed: %s\n",DXGetErrorString8(rc));
238 /* direct sound 8 doesn't have an IKsPropertySet */
239 rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
241 ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
242 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc));
245 /* try direct sound capture next */
246 if (pDirectSoundCaptureCreate) {
247 rc = (fProc)(&CLSID_DirectSoundCapture, &IID_IClassFactory,
249 ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
250 "failed: %s\n",DXGetErrorString8(rc));
254 /* direct sound capture doesn't have an IKsPropertySet */
255 rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
257 ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
258 "returned E_NOINTERFACE,returned: %s\n",DXGetErrorString8(rc));
261 /* and the direct sound capture 8 version */
262 if (pDirectSoundCaptureCreate8) {
263 rc = (fProc)(&CLSID_DirectSoundCapture8, &IID_IClassFactory,
265 ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, "
266 "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc));
270 /* direct sound capture 8 doesn't have an IKsPropertySet */
271 rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
273 ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
274 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc));
277 /* try direct sound full duplex next */
278 if (pDirectSoundFullDuplexCreate) {
279 rc = (fProc)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory,
281 ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, "
282 "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc));
286 /* direct sound full duplex doesn't have an IKsPropertySet */
287 rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
289 ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
290 "returned NOINTERFACE, returned: %s\n",DXGetErrorString8(rc));
293 /* try direct sound private last */
294 rc = (fProc)(&CLSID_DirectSoundPrivate, &IID_IClassFactory,
297 /* some early versions of Direct Sound do not have this */
301 /* direct sound private does have an IKsPropertySet */
302 rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
304 ok(rc==DS_OK, "CreateInstance(IID_IKsPropertySet) failed: %s\n",
305 DXGetErrorString8(rc));
309 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION */
310 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
311 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
313 ok(rc==DS_OK||rc==E_INVALIDARG,
314 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
315 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: %s\n",
316 DXGetErrorString8(rc));
318 if (rc==E_INVALIDARG)
319 trace(" Not Supported\n");
323 ok(support & KSPROPERTY_SUPPORT_GET,
324 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
325 "support = 0x%x\n",support);
326 ok(!(support & KSPROPERTY_SUPPORT_SET),
327 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
328 "support = 0x%x\n",support);
330 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 */
331 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
332 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1,
334 ok(rc==DS_OK||rc==E_INVALIDARG,
335 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
336 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1) failed: %s\n",
337 DXGetErrorString8(rc));
339 if (rc==E_INVALIDARG)
340 trace(" Not Supported\n");
344 ok(support & KSPROPERTY_SUPPORT_GET,
345 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: "
346 "support = 0x%x\n",support);
347 ok(!(support & KSPROPERTY_SUPPORT_SET),
348 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: "
349 "support = 0x%x\n",support);
351 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A */
352 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
353 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A,
355 ok(rc==DS_OK||rc==E_INVALIDARG,
356 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
357 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A) failed: %s\n",
358 DXGetErrorString8(rc));
360 if (rc==E_INVALIDARG)
361 trace(" Not Supported\n");
365 ok(support & KSPROPERTY_SUPPORT_GET,
366 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: "
367 "support = 0x%x\n",support);
368 ok(!(support & KSPROPERTY_SUPPORT_SET),
369 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: "
370 "support = 0x%x\n",support);
372 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W */
373 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
374 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W,
376 ok(rc==DS_OK||rc==E_INVALIDARG,
377 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
378 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W) failed: %s\n",
379 DXGetErrorString8(rc));
381 if (rc==E_INVALIDARG)
382 trace(" Not Supported\n");
386 ok(support & KSPROPERTY_SUPPORT_GET,
387 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: "
388 "support = 0x%x\n",support);
389 ok(!(support & KSPROPERTY_SUPPORT_SET),
390 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: "
391 "support = 0x%x\n",support);
393 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING */
394 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
395 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING, &support);
396 ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
397 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: %s\n",
398 DXGetErrorString8(rc));
402 ok(support & KSPROPERTY_SUPPORT_GET,
403 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: "
404 "support = 0x%x\n",support);
405 ok(!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set "
406 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: support = "
409 /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A */
410 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
411 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A, &support);
412 ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
413 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A) failed: %s\n",
414 DXGetErrorString8(rc));
418 ok(support & KSPROPERTY_SUPPORT_GET,
419 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: "
420 "support = 0x%x\n",support);
421 ok(!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set "
422 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: support = "
425 /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W */
426 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
427 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W, &support);
428 ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
429 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W) failed: %s\n",
430 DXGetErrorString8(rc));
434 ok(support & KSPROPERTY_SUPPORT_GET,
435 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: "
436 "support = 0x%x\n",support);
437 ok(!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set "
438 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: support = "
441 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE */
442 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE ***\n");
443 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
444 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE,
446 ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
447 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: %s\n",
448 DXGetErrorString8(rc));
452 ok(support & KSPROPERTY_SUPPORT_GET,
453 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: "
454 "support = 0x%x\n",support);
455 ok(!(support & KSPROPERTY_SUPPORT_SET),"Shouldn't be able to set "
456 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: support = 0x%x\n",support);
458 if (support & KSPROPERTY_SUPPORT_GET) {
459 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA data;
462 data.Callback = callback;
465 rc = IKsPropertySet_Get(pps, &DSPROPSETID_DirectSoundDevice,
466 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE,
467 NULL, 0, &data, sizeof(data), &bytes);
468 ok(rc==DS_OK, "Couldn't enumerate: 0x%x\n",rc);
471 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 */
472 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 ***\n");
473 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
474 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1,
476 ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
477 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1) failed: %s\n",
478 DXGetErrorString8(rc));
482 ok(support & KSPROPERTY_SUPPORT_GET,
483 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: "
484 "support = 0x%x\n",support);
485 ok(!(support & KSPROPERTY_SUPPORT_SET),"Shouldn't be able to set "
486 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: support = 0x%x\n",support);
488 if (support & KSPROPERTY_SUPPORT_GET) {
489 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA data;
492 data.Callback = callback1;
495 rc = IKsPropertySet_Get(pps, &DSPROPSETID_DirectSoundDevice,
496 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1,
497 NULL, 0, &data, sizeof(data), &bytes);
498 ok(rc==DS_OK, "Couldn't enumerate: 0x%x\n",rc);
501 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A */
502 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A ***\n");
503 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
504 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A,
506 ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
507 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A) failed: %s\n",
508 DXGetErrorString8(rc));
512 ok(support & KSPROPERTY_SUPPORT_GET,
513 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: "
514 "support = 0x%x\n",support);
515 ok(!(support & KSPROPERTY_SUPPORT_SET),"Shouldn't be able to set "
516 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: support = 0x%x\n",support);
518 if (support & KSPROPERTY_SUPPORT_GET) {
519 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA data;
522 data.Callback = callbackA;
525 rc = IKsPropertySet_Get(pps, &DSPROPSETID_DirectSoundDevice,
526 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A,
527 NULL, 0, &data, sizeof(data), &bytes);
528 ok(rc==DS_OK, "Couldn't enumerate: 0x%x\n",rc);
531 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W */
532 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W ***\n");
533 rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
534 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W,
536 ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
537 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W) failed: %s\n",
538 DXGetErrorString8(rc));
542 ok(support & KSPROPERTY_SUPPORT_GET,
543 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: "
544 "support = 0x%x\n",support);
545 ok(!(support & KSPROPERTY_SUPPORT_SET),"Shouldn't be able to set "
546 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: support = 0x%x\n",support);
548 if (support & KSPROPERTY_SUPPORT_GET) {
549 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
552 data.Callback = callbackW;
555 rc = IKsPropertySet_Get(pps, &DSPROPSETID_DirectSoundDevice,
556 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W,
557 NULL, 0, &data, sizeof(data), &bytes);
558 ok(rc==DS_OK, "Couldn't enumerate: 0x%x\n",rc);
562 FreeLibrary(hDsound);
565 static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
566 LPCSTR lpcstrModule, LPVOID lpContext)
569 LPDIRECTSOUND dso=NULL;
570 LPDIRECTSOUNDBUFFER primary=NULL,secondary=NULL;
571 DSBUFFERDESC bufdesc;
575 trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
577 rc=DirectSoundCreate(lpGuid,&dso,NULL);
578 ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
579 "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
581 if (rc==DSERR_NODRIVER)
582 trace(" No Driver\n");
583 else if (rc == DSERR_ALLOCATED)
584 trace(" Already In Use\n");
585 else if (rc == E_FAIL)
586 trace(" No Device\n");
590 /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
591 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
592 rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
593 ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
594 DXGetErrorString8(rc));
598 /* Testing 3D buffers */
600 ZeroMemory(&bufdesc, sizeof(bufdesc));
601 bufdesc.dwSize=sizeof(bufdesc);
602 bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_LOCHARDWARE|DSBCAPS_CTRL3D;
603 rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
604 ok(rc==DS_OK&&primary!=NULL,"IDirectSound_CreateSoundBuffer() failed to "
605 "create a hardware 3D primary buffer: %s\n",DXGetErrorString8(rc));
606 if (rc==DS_OK&&primary!=NULL) {
607 ZeroMemory(&wfx, sizeof(wfx));
608 wfx.wFormatTag=WAVE_FORMAT_PCM;
610 wfx.wBitsPerSample=16;
611 wfx.nSamplesPerSec=44100;
612 wfx.nBlockAlign=wfx.nChannels*wfx.wBitsPerSample/8;
613 wfx.nAvgBytesPerSec=wfx.nSamplesPerSec*wfx.nBlockAlign;
614 ZeroMemory(&bufdesc, sizeof(bufdesc));
615 bufdesc.dwSize=sizeof(bufdesc);
616 bufdesc.dwFlags=DSBCAPS_CTRLDEFAULT|DSBCAPS_GETCURRENTPOSITION2;
617 bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec;
618 bufdesc.lpwfxFormat=&wfx;
619 trace(" Testing a secondary buffer at %dx%dx%d\n",
620 wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
621 rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
622 ok(rc==DS_OK&&secondary!=NULL,"IDirectSound_CreateSoundBuffer() "
623 "failed to create a secondary buffer: %s\n",DXGetErrorString8(rc));
624 if (rc==DS_OK&&secondary!=NULL) {
625 IKsPropertySet * pPropertySet=NULL;
626 rc=IDirectSoundBuffer_QueryInterface(secondary,
628 (void **)&pPropertySet);
629 /* it's not an error for this to fail */
632 trace(" Supports property sets\n");
633 /* it's not an error for these to fail */
634 rc=IKsPropertySet_QuerySupport(pPropertySet,
635 &DSPROPSETID_VoiceManager,
637 if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
638 KSPROPERTY_SUPPORT_SET)))
639 trace(" DSPROPSETID_VoiceManager supported\n");
641 trace(" DSPROPSETID_VoiceManager not supported\n");
642 rc=IKsPropertySet_QuerySupport(pPropertySet,
643 &DSPROPSETID_EAX20_ListenerProperties,0,&ulTypeSupport);
644 if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
645 KSPROPERTY_SUPPORT_SET)))
646 trace(" DSPROPSETID_EAX20_ListenerProperties "
649 trace(" DSPROPSETID_EAX20_ListenerProperties not "
651 rc=IKsPropertySet_QuerySupport(pPropertySet,
652 &DSPROPSETID_EAX20_BufferProperties,0,&ulTypeSupport);
653 if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
654 KSPROPERTY_SUPPORT_SET)))
655 trace(" DSPROPSETID_EAX20_BufferProperties supported\n");
657 trace(" DSPROPSETID_EAX20_BufferProperties not "
659 rc=IKsPropertySet_QuerySupport(pPropertySet,
660 &DSPROPSETID_I3DL2_ListenerProperties,0,&ulTypeSupport);
661 if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
662 KSPROPERTY_SUPPORT_SET)))
663 trace(" DSPROPSETID_I3DL2_ListenerProperties "
666 trace(" DSPROPSETID_I3DL2_ListenerProperties not "
668 rc=IKsPropertySet_QuerySupport(pPropertySet,
669 &DSPROPSETID_I3DL2_BufferProperties,0,&ulTypeSupport);
670 if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
671 KSPROPERTY_SUPPORT_SET)))
672 trace(" DSPROPSETID_I3DL2_BufferProperties supported\n");
674 trace(" DSPROPSETID_I3DL2_BufferProperties not "
676 rc=IKsPropertySet_QuerySupport(pPropertySet,
677 &DSPROPSETID_ZOOMFX_BufferProperties,0,&ulTypeSupport);
678 if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
679 KSPROPERTY_SUPPORT_SET)))
680 trace(" DSPROPSETID_ZOOMFX_BufferProperties "
683 trace(" DSPROPSETID_ZOOMFX_BufferProperties not "
685 ref=IKsPropertySet_Release(pPropertySet);
686 /* try a few common ones */
687 ok(ref==0,"IKsPropertySet_Release() secondary has %d "
688 "references, should have 0\n",ref);
690 trace(" Doesn't support property sets\n");
692 ref=IDirectSoundBuffer_Release(secondary);
693 ok(ref==0,"IDirectSoundBuffer_Release() secondary has %d "
694 "references, should have 0\n",ref);
697 ref=IDirectSoundBuffer_Release(primary);
698 ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
699 "should have 0\n",ref);
704 ref=IDirectSound_Release(dso);
705 ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",
711 static void propset_buffer_tests(void)
714 rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
715 ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
724 hDsound = LoadLibraryA("dsound.dll");
726 trace("dsound.dll not found\n");
730 trace("DLL Version: %s\n", get_file_version("dsound.dll"));
732 pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8");
733 pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate");
734 pDirectSoundCaptureCreate8=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate8");
735 pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,"DirectSoundFullDuplexCreate");
737 propset_private_tests();
738 propset_buffer_tests();