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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #define NONAMELESSSTRUCT
23 #define NONAMELESSUNION
27 #include "wine/test.h"
33 #include "dsound_test.h"
35 #ifndef DSBCAPS_CTRLDEFAULT
36 #define DSBCAPS_CTRLDEFAULT \
37 DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME
40 DEFINE_GUID(DSPROPSETID_VoiceManager
, \
41 0x62A69BAE,0xDF9D,0x11D1,0x99,0xA6,0x00,0xC0,0x4F,0xC9,0x9D,0x46);
42 DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties
, \
43 0x306a6a8,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
44 DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties
, \
45 0x306a6a7,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
46 DEFINE_GUID(DSPROPSETID_I3DL2_ListenerProperties
, \
47 0xDA0F0520,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
48 DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties
, \
49 0xDA0F0521,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
50 DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties
, \
51 0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC);
53 typedef HRESULT (CALLBACK
* MYPROC
)(REFCLSID
, REFIID
, LPVOID
*);
55 static HRESULT (WINAPI
*pDirectSoundCreate8
)(LPCGUID
,LPDIRECTSOUND8
*,
57 static HRESULT (WINAPI
*pDirectSoundCaptureCreate
)(LPCGUID
,
58 LPDIRECTSOUNDCAPTURE
*,LPUNKNOWN
)=NULL
;
59 static HRESULT (WINAPI
*pDirectSoundCaptureCreate8
)(LPCGUID
,
60 LPDIRECTSOUNDCAPTURE8
*,LPUNKNOWN
)=NULL
;
61 static HRESULT (WINAPI
*pDirectSoundFullDuplexCreate
)(LPCGUID
,LPCGUID
,
62 LPCDSCBUFFERDESC
,LPCDSBUFFERDESC
,HWND
,DWORD
,LPDIRECTSOUNDFULLDUPLEX
*,
63 LPDIRECTSOUNDCAPTUREBUFFER8
*,LPDIRECTSOUNDBUFFER8
*,LPUNKNOWN
)=NULL
;
65 BOOL CALLBACK
callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data
,
68 trace(" found device:\n");
70 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
71 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
72 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
73 trace(" DataFlow: %s\n",
74 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
75 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
76 "Capture" : "Unknown");
77 trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
78 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
79 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
80 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
81 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
82 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
83 trace(" Description: %s\n", data
->Description
);
84 trace(" Module: %s\n", data
->Module
);
85 trace(" Interface: %s\n", data
->Interface
);
86 trace(" WaveDeviceId: %ld\n", data
->WaveDeviceId
);
91 BOOL CALLBACK
callback1(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data
,
94 char descriptionA
[0x100];
95 char moduleA
[MAX_PATH
];
97 trace(" found device:\n");
99 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
100 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
101 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
102 trace(" DataFlow: %s\n",
103 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
104 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
105 "Capture" : "Unknown");
106 trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
107 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
108 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
109 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
110 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
111 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
112 trace(" DescriptionA: %s\n", data
->DescriptionA
);
113 WideCharToMultiByte(CP_ACP
, 0, data
->DescriptionW
, -1, descriptionA
, sizeof(descriptionA
), NULL
, NULL
);
114 trace(" DescriptionW: %s\n", descriptionA
);
115 trace(" ModuleA: %s\n", data
->ModuleA
);
116 WideCharToMultiByte(CP_ACP
, 0, data
->ModuleW
, -1, moduleA
, sizeof(moduleA
), NULL
, NULL
);
117 trace(" ModuleW: %s\n", moduleA
);
118 trace(" WaveDeviceId: %ld\n", data
->WaveDeviceId
);
123 BOOL CALLBACK
callbackA(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA data
,
126 trace(" found device:\n");
128 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
129 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
130 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
131 trace(" DataFlow: %s\n",
132 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
133 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
134 "Capture" : "Unknown");
135 trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
136 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
137 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
138 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
139 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
140 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
141 trace(" Description: %s\n", data
->Description
);
142 trace(" Module: %s\n", data
->Module
);
143 trace(" Interface: %s\n", data
->Interface
);
144 trace(" WaveDeviceId: %ld\n", data
->WaveDeviceId
);
149 BOOL CALLBACK
callbackW(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data
,
152 char descriptionA
[0x100];
153 char moduleA
[MAX_PATH
];
154 char interfaceA
[MAX_PATH
];
156 trace("found device:\n");
157 trace("\tType: %s\n",
158 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
159 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
160 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
161 trace("\tDataFlow: %s\n",
162 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
163 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
164 "Capture" : "Unknown");
165 trace("\tDeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
166 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
167 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
168 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
169 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
170 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
171 WideCharToMultiByte(CP_ACP
, 0, data
->Description
, -1, descriptionA
, sizeof(descriptionA
), NULL
, NULL
);
172 WideCharToMultiByte(CP_ACP
, 0, data
->Module
, -1, moduleA
, sizeof(moduleA
), NULL
, NULL
);
173 WideCharToMultiByte(CP_ACP
, 0, data
->Interface
, -1, interfaceA
, sizeof(interfaceA
), NULL
, NULL
);
174 trace("\tDescription: %s\n", descriptionA
);
175 trace("\tModule: %s\n", moduleA
);
176 trace("\tInterface: %s\n", interfaceA
);
177 trace("\tWaveDeviceId: %ld\n", data
->WaveDeviceId
);
182 static void propset_private_tests(void)
187 IKsPropertySet
* pps
;
191 hDsound
= LoadLibrary("dsound.dll");
192 ok(hDsound
!=0,"LoadLibrary(dsound.dll) failed\n");
196 fProc
= (MYPROC
)GetProcAddress(hDsound
, "DllGetClassObject");
198 /* try direct sound first */
199 /* DSOUND: Error: Invalid interface buffer */
200 rc
= (fProc
)(&CLSID_DirectSound
, &IID_IClassFactory
, (void **)0);
201 ok(rc
==DSERR_INVALIDPARAM
,"DllGetClassObject(CLSID_DirectSound, "
202 "IID_IClassFactory) should have returned DSERR_INVALIDPARAM, "
203 "returned: %s\n",DXGetErrorString8(rc
));
205 rc
= (fProc
)(&CLSID_DirectSound
, &IID_IClassFactory
, (void **)(&pcf
));
206 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
207 "failed: %s\n",DXGetErrorString8(rc
));
211 /* direct sound doesn't have an IKsPropertySet */
212 /* DSOUND: Error: Invalid interface buffer */
213 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
215 ok(rc
==DSERR_INVALIDPARAM
, "CreateInstance(IID_IKsPropertySet) should have "
216 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc
));
218 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
220 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
221 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
223 /* and the direct sound 8 version */
224 if (pDirectSoundCreate8
) {
225 rc
= (fProc
)(&CLSID_DirectSound8
, &IID_IClassFactory
, (void **)(&pcf
));
226 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
227 "failed: %s\n",DXGetErrorString8(rc
));
231 /* direct sound 8 doesn't have an IKsPropertySet */
232 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
234 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
235 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
238 /* try direct sound capture next */
239 if (pDirectSoundCaptureCreate
) {
240 rc
= (fProc
)(&CLSID_DirectSoundCapture
, &IID_IClassFactory
,
242 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
243 "failed: %s\n",DXGetErrorString8(rc
));
247 /* direct sound capture doesn't have an IKsPropertySet */
248 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
250 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
251 "returned E_NOINTERFACE,returned: %s\n",DXGetErrorString8(rc
));
254 /* and the direct sound capture 8 version */
255 if (pDirectSoundCaptureCreate8
) {
256 rc
= (fProc
)(&CLSID_DirectSoundCapture8
, &IID_IClassFactory
,
258 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, "
259 "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc
));
263 /* direct sound capture 8 doesn't have an IKsPropertySet */
264 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
266 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
267 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
270 /* try direct sound full duplex next */
271 if (pDirectSoundFullDuplexCreate
) {
272 rc
= (fProc
)(&CLSID_DirectSoundFullDuplex
, &IID_IClassFactory
,
274 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, "
275 "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc
));
279 /* direct sound full duplex doesn't have an IKsPropertySet */
280 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
282 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
283 "returned NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
286 /* try direct sound private last */
287 rc
= (fProc
)(&CLSID_DirectSoundPrivate
, &IID_IClassFactory
,
290 /* some early versions of Direct Sound do not have this */
294 /* direct sound private does have an IKsPropertySet */
295 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
297 ok(rc
==DS_OK
, "CreateInstance(IID_IKsPropertySet) failed: %s\n",
298 DXGetErrorString8(rc
));
302 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION */
303 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
304 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION
,
306 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
307 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
308 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: %s\n",
309 DXGetErrorString8(rc
));
311 if (rc
==E_INVALIDARG
)
312 trace(" Not Supported\n");
316 ok(support
& KSPROPERTY_SUPPORT_GET
,
317 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
318 "support = 0x%lx\n",support
);
319 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
320 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
321 "support = 0x%lx\n",support
);
323 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 */
324 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
325 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1
,
327 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
328 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
329 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1) failed: %s\n",
330 DXGetErrorString8(rc
));
332 if (rc
==E_INVALIDARG
)
333 trace(" Not Supported\n");
337 ok(support
& KSPROPERTY_SUPPORT_GET
,
338 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: "
339 "support = 0x%lx\n",support
);
340 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
341 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: "
342 "support = 0x%lx\n",support
);
344 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A */
345 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
346 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A
,
348 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
349 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
350 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A) failed: %s\n",
351 DXGetErrorString8(rc
));
353 if (rc
==E_INVALIDARG
)
354 trace(" Not Supported\n");
358 ok(support
& KSPROPERTY_SUPPORT_GET
,
359 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: "
360 "support = 0x%lx\n",support
);
361 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
362 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: "
363 "support = 0x%lx\n",support
);
365 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W */
366 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
367 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W
,
369 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
370 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
371 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W) failed: %s\n",
372 DXGetErrorString8(rc
));
374 if (rc
==E_INVALIDARG
)
375 trace(" Not Supported\n");
379 ok(support
& KSPROPERTY_SUPPORT_GET
,
380 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: "
381 "support = 0x%lx\n",support
);
382 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
383 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: "
384 "support = 0x%lx\n",support
);
386 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING */
387 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
388 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING
, &support
);
389 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
390 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: %s\n",
391 DXGetErrorString8(rc
));
395 ok(support
& KSPROPERTY_SUPPORT_GET
,
396 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: "
397 "support = 0x%lx\n",support
);
398 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
399 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: support = "
402 /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A */
403 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
404 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A
, &support
);
405 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
406 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A) failed: %s\n",
407 DXGetErrorString8(rc
));
411 ok(support
& KSPROPERTY_SUPPORT_GET
,
412 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: "
413 "support = 0x%lx\n",support
);
414 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
415 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: support = "
418 /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W */
419 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
420 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W
, &support
);
421 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
422 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W) failed: %s\n",
423 DXGetErrorString8(rc
));
427 ok(support
& KSPROPERTY_SUPPORT_GET
,
428 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: "
429 "support = 0x%lx\n",support
);
430 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
431 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: support = "
434 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE */
435 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE ***\n");
436 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
437 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE
,
439 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
440 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: %s\n",
441 DXGetErrorString8(rc
));
445 ok(support
& KSPROPERTY_SUPPORT_GET
,
446 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: "
447 "support = 0x%lx\n",support
);
448 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
449 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: support = 0x%lx\n",support
);
451 if (support
& KSPROPERTY_SUPPORT_GET
) {
452 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA data
;
455 data
.Callback
= callback
;
458 rc
= IKsPropertySet_Get(pps
, &DSPROPSETID_DirectSoundDevice
,
459 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE
,
460 NULL
, 0, &data
, sizeof(data
), &bytes
);
461 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%lx\n",rc
);
464 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 */
465 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 ***\n");
466 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
467 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1
,
469 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
470 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1) failed: %s\n",
471 DXGetErrorString8(rc
));
475 ok(support
& KSPROPERTY_SUPPORT_GET
,
476 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: "
477 "support = 0x%lx\n",support
);
478 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
479 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: support = 0x%lx\n",support
);
481 if (support
& KSPROPERTY_SUPPORT_GET
) {
482 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA data
;
485 data
.Callback
= callback1
;
488 rc
= IKsPropertySet_Get(pps
, &DSPROPSETID_DirectSoundDevice
,
489 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1
,
490 NULL
, 0, &data
, sizeof(data
), &bytes
);
491 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%lx\n",rc
);
494 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A */
495 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A ***\n");
496 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
497 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A
,
499 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
500 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A) failed: %s\n",
501 DXGetErrorString8(rc
));
505 ok(support
& KSPROPERTY_SUPPORT_GET
,
506 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: "
507 "support = 0x%lx\n",support
);
508 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
509 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: support = 0x%lx\n",support
);
511 if (support
& KSPROPERTY_SUPPORT_GET
) {
512 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA data
;
515 data
.Callback
= callbackA
;
518 rc
= IKsPropertySet_Get(pps
, &DSPROPSETID_DirectSoundDevice
,
519 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A
,
520 NULL
, 0, &data
, sizeof(data
), &bytes
);
521 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%lx\n",rc
);
524 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W */
525 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W ***\n");
526 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
527 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W
,
529 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
530 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W) failed: %s\n",
531 DXGetErrorString8(rc
));
535 ok(support
& KSPROPERTY_SUPPORT_GET
,
536 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: "
537 "support = 0x%lx\n",support
);
538 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
539 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: support = 0x%lx\n",support
);
541 if (support
& KSPROPERTY_SUPPORT_GET
) {
542 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data
;
545 data
.Callback
= callbackW
;
548 rc
= IKsPropertySet_Get(pps
, &DSPROPSETID_DirectSoundDevice
,
549 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W
,
550 NULL
, 0, &data
, sizeof(data
), &bytes
);
551 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%lx\n",rc
);
555 FreeLibrary(hDsound
);
558 static BOOL WINAPI
dsenum_callback(LPGUID lpGuid
, LPCSTR lpcstrDescription
,
559 LPCSTR lpcstrModule
, LPVOID lpContext
)
562 LPDIRECTSOUND dso
=NULL
;
563 LPDIRECTSOUNDBUFFER primary
=NULL
,secondary
=NULL
;
564 DSBUFFERDESC bufdesc
;
568 trace("*** Testing %s - %s ***\n",lpcstrDescription
,lpcstrModule
);
570 rc
=DirectSoundCreate(lpGuid
,&dso
,NULL
);
571 ok(rc
==DS_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
||rc
==E_FAIL
,
572 "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc
));
574 if (rc
==DSERR_NODRIVER
)
575 trace(" No Driver\n");
576 else if (rc
== DSERR_ALLOCATED
)
577 trace(" Already In Use\n");
578 else if (rc
== E_FAIL
)
579 trace(" No Device\n");
583 /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
584 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
585 rc
=IDirectSound_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_PRIORITY
);
586 ok(rc
==DS_OK
,"IDirectSound_SetCooperativeLevel() failed: %s\n",
587 DXGetErrorString8(rc
));
591 /* Testing 3D buffers */
593 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
594 bufdesc
.dwSize
=sizeof(bufdesc
);
595 bufdesc
.dwFlags
=DSBCAPS_PRIMARYBUFFER
|DSBCAPS_LOCHARDWARE
|DSBCAPS_CTRL3D
;
596 rc
=IDirectSound_CreateSoundBuffer(dso
,&bufdesc
,&primary
,NULL
);
597 ok(rc
==DS_OK
&&primary
!=NULL
,"IDirectSound_CreateSoundBuffer() failed to "
598 "create a hardware 3D primary buffer: %s\n",DXGetErrorString8(rc
));
599 if (rc
==DS_OK
&&primary
!=NULL
) {
600 ZeroMemory(&wfx
, sizeof(wfx
));
601 wfx
.wFormatTag
=WAVE_FORMAT_PCM
;
603 wfx
.wBitsPerSample
=16;
604 wfx
.nSamplesPerSec
=44100;
605 wfx
.nBlockAlign
=wfx
.nChannels
*wfx
.wBitsPerSample
/8;
606 wfx
.nAvgBytesPerSec
=wfx
.nSamplesPerSec
*wfx
.nBlockAlign
;
607 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
608 bufdesc
.dwSize
=sizeof(bufdesc
);
609 bufdesc
.dwFlags
=DSBCAPS_CTRLDEFAULT
|DSBCAPS_GETCURRENTPOSITION2
;
610 bufdesc
.dwBufferBytes
=wfx
.nAvgBytesPerSec
;
611 bufdesc
.lpwfxFormat
=&wfx
;
612 trace(" Testing a secondary buffer at %ldx%dx%d\n",
613 wfx
.nSamplesPerSec
,wfx
.wBitsPerSample
,wfx
.nChannels
);
614 rc
=IDirectSound_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
615 ok(rc
==DS_OK
&&secondary
!=NULL
,"IDirectSound_CreateSoundBuffer() "
616 "failed to create a secondary buffer: %s\n",DXGetErrorString8(rc
));
617 if (rc
==DS_OK
&&secondary
!=NULL
) {
618 IKsPropertySet
* pPropertySet
=NULL
;
619 rc
=IDirectSoundBuffer_QueryInterface(secondary
,
621 (void **)&pPropertySet
);
622 /* it's not an error for this to fail */
625 trace(" Supports property sets\n");
626 /* it's not an error for these to fail */
627 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
628 &DSPROPSETID_VoiceManager
,
630 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
631 KSPROPERTY_SUPPORT_SET
)))
632 trace(" DSPROPSETID_VoiceManager supported\n");
634 trace(" DSPROPSETID_VoiceManager not supported\n");
635 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
636 &DSPROPSETID_EAX20_ListenerProperties
,0,&ulTypeSupport
);
637 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
638 KSPROPERTY_SUPPORT_SET
)))
639 trace(" DSPROPSETID_EAX20_ListenerProperties "
642 trace(" DSPROPSETID_EAX20_ListenerProperties not "
644 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
645 &DSPROPSETID_EAX20_BufferProperties
,0,&ulTypeSupport
);
646 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
647 KSPROPERTY_SUPPORT_SET
)))
648 trace(" DSPROPSETID_EAX20_BufferProperties supported\n");
650 trace(" DSPROPSETID_EAX20_BufferProperties not "
652 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
653 &DSPROPSETID_I3DL2_ListenerProperties
,0,&ulTypeSupport
);
654 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
655 KSPROPERTY_SUPPORT_SET
)))
656 trace(" DSPROPSETID_I3DL2_ListenerProperties "
659 trace(" DSPROPSETID_I3DL2_ListenerProperties not "
661 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
662 &DSPROPSETID_I3DL2_BufferProperties
,0,&ulTypeSupport
);
663 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
664 KSPROPERTY_SUPPORT_SET
)))
665 trace(" DSPROPSETID_I3DL2_BufferProperties supported\n");
667 trace(" DSPROPSETID_I3DL2_BufferProperties not "
669 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
670 &DSPROPSETID_ZOOMFX_BufferProperties
,0,&ulTypeSupport
);
671 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
672 KSPROPERTY_SUPPORT_SET
)))
673 trace(" DSPROPSETID_ZOOMFX_BufferProperties "
676 trace(" DSPROPSETID_ZOOMFX_BufferProperties not "
678 ref
=IKsPropertySet_Release(pPropertySet
);
679 /* try a few common ones */
680 ok(ref
==0,"IKsPropertySet_Release() secondary has %d "
681 "references, should have 0\n",ref
);
683 trace(" Doesn't support property sets\n");
685 ref
=IDirectSoundBuffer_Release(secondary
);
686 ok(ref
==0,"IDirectSoundBuffer_Release() secondary has %d "
687 "references, should have 0\n",ref
);
690 ref
=IDirectSoundBuffer_Release(primary
);
691 ok(ref
==0,"IDirectSoundBuffer_Release() primary has %d references, "
692 "should have 0\n",ref
);
697 ref
=IDirectSound_Release(dso
);
698 ok(ref
==0,"IDirectSound_Release() has %d references, should have 0\n",
704 static void propset_buffer_tests(void)
707 rc
=DirectSoundEnumerateA(&dsenum_callback
,NULL
);
708 ok(rc
==DS_OK
,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc
));
717 hDsound
= LoadLibraryA("dsound.dll");
719 trace("dsound.dll not found\n");
723 trace("DLL Version: %s\n", get_file_version("dsound.dll"));
725 pDirectSoundCreate8
= (void*)GetProcAddress(hDsound
, "DirectSoundCreate8");
726 pDirectSoundCaptureCreate
=(void*)GetProcAddress(hDsound
,"DirectSoundCaptureCreate");
727 pDirectSoundCaptureCreate8
=(void*)GetProcAddress(hDsound
,"DirectSoundCaptureCreate8");
728 pDirectSoundFullDuplexCreate
=(void*)GetProcAddress(hDsound
,"DirectSoundFullDuplexCreate");
730 propset_private_tests();
731 propset_buffer_tests();