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"
30 #include "dsound_test.h"
32 #ifndef DSBCAPS_CTRLDEFAULT
33 #define DSBCAPS_CTRLDEFAULT \
34 DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME
39 DEFINE_GUID(DSPROPSETID_VoiceManager
,
40 0x62A69BAE,0xDF9D,0x11D1,0x99,0xA6,0x00,0xC0,0x4F,0xC9,0x9D,0x46);
41 DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties
,
42 0x306a6a8,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
43 DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties
,
44 0x306a6a7,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
45 DEFINE_GUID(DSPROPSETID_I3DL2_ListenerProperties
,
46 0xDA0F0520,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
47 DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties
,
48 0xDA0F0521,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
49 DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties
,
50 0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC);
52 static HRESULT (WINAPI
*pDirectSoundEnumerateA
)(LPDSENUMCALLBACKA
,LPVOID
)=NULL
;
53 static HRESULT (WINAPI
*pDllGetClassObject
)(REFCLSID
,REFIID
,LPVOID
*)=NULL
;
54 static HRESULT (WINAPI
*pDirectSoundCreate
)(LPCGUID
,LPDIRECTSOUND
*,
56 static HRESULT (WINAPI
*pDirectSoundCreate8
)(LPCGUID
,LPDIRECTSOUND8
*,
58 static HRESULT (WINAPI
*pDirectSoundCaptureCreate
)(LPCGUID
,
59 LPDIRECTSOUNDCAPTURE
*,LPUNKNOWN
)=NULL
;
60 static HRESULT (WINAPI
*pDirectSoundCaptureCreate8
)(LPCGUID
,
61 LPDIRECTSOUNDCAPTURE8
*,LPUNKNOWN
)=NULL
;
62 static HRESULT (WINAPI
*pDirectSoundFullDuplexCreate
)(LPCGUID
,LPCGUID
,
63 LPCDSCBUFFERDESC
,LPCDSBUFFERDESC
,HWND
,DWORD
,LPDIRECTSOUNDFULLDUPLEX
*,
64 LPDIRECTSOUNDCAPTUREBUFFER8
*,LPDIRECTSOUNDBUFFER8
*,LPUNKNOWN
)=NULL
;
66 static BOOL CALLBACK
callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data
,
69 trace(" found device:\n");
71 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
72 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
73 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
74 trace(" DataFlow: %s\n",
75 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
76 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
77 "Capture" : "Unknown");
78 trace(" DeviceId: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
79 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
80 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
81 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
82 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
83 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
84 trace(" Description: %s\n", data
->Description
);
85 trace(" Module: %s\n", data
->Module
);
86 trace(" Interface: %s\n", data
->Interface
);
87 trace(" WaveDeviceId: %d\n", data
->WaveDeviceId
);
92 static BOOL CALLBACK
callback1(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data
,
95 char descriptionA
[0x100];
96 char moduleA
[MAX_PATH
];
98 trace(" found device:\n");
100 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
101 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
102 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
103 trace(" DataFlow: %s\n",
104 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
105 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
106 "Capture" : "Unknown");
107 trace(" DeviceId: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
108 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
109 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
110 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
111 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
112 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
113 trace(" DescriptionA: %s\n", data
->DescriptionA
);
114 WideCharToMultiByte(CP_ACP
, 0, data
->DescriptionW
, -1, descriptionA
, sizeof(descriptionA
), NULL
, NULL
);
115 trace(" DescriptionW: %s\n", descriptionA
);
116 trace(" ModuleA: %s\n", data
->ModuleA
);
117 WideCharToMultiByte(CP_ACP
, 0, data
->ModuleW
, -1, moduleA
, sizeof(moduleA
), NULL
, NULL
);
118 trace(" ModuleW: %s\n", moduleA
);
119 trace(" WaveDeviceId: %d\n", data
->WaveDeviceId
);
124 static BOOL CALLBACK
callbackA(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA data
,
127 trace(" found device:\n");
129 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
130 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
131 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
132 trace(" DataFlow: %s\n",
133 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
134 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
135 "Capture" : "Unknown");
136 trace(" DeviceId: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
137 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
138 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
139 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
140 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
141 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
142 trace(" Description: %s\n", data
->Description
);
143 trace(" Module: %s\n", data
->Module
);
144 trace(" Interface: %s\n", data
->Interface
);
145 trace(" WaveDeviceId: %d\n", data
->WaveDeviceId
);
150 static BOOL CALLBACK
callbackW(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data
,
153 char descriptionA
[0x100];
154 char moduleA
[MAX_PATH
];
155 char interfaceA
[MAX_PATH
];
157 trace("found device:\n");
158 trace("\tType: %s\n",
159 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
160 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
161 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
162 trace("\tDataFlow: %s\n",
163 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
164 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
165 "Capture" : "Unknown");
166 trace("\tDeviceId: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
167 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
168 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
169 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
170 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
171 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
172 WideCharToMultiByte(CP_ACP
, 0, data
->Description
, -1, descriptionA
, sizeof(descriptionA
), NULL
, NULL
);
173 WideCharToMultiByte(CP_ACP
, 0, data
->Module
, -1, moduleA
, sizeof(moduleA
), NULL
, NULL
);
174 WideCharToMultiByte(CP_ACP
, 0, data
->Interface
, -1, interfaceA
, sizeof(interfaceA
), NULL
, NULL
);
175 trace("\tDescription: %s\n", descriptionA
);
176 trace("\tModule: %s\n", moduleA
);
177 trace("\tInterface: %s\n", interfaceA
);
178 trace("\tWaveDeviceId: %d\n", data
->WaveDeviceId
);
183 static void propset_private_tests(void)
187 IKsPropertySet
* pps
;
190 /* try direct sound first */
191 /* DSOUND: Error: Invalid interface buffer */
192 rc
= (pDllGetClassObject
)(&CLSID_DirectSound
, &IID_IClassFactory
, (void **)0);
193 ok(rc
==DSERR_INVALIDPARAM
,"DllGetClassObject(CLSID_DirectSound, "
194 "IID_IClassFactory) should have returned DSERR_INVALIDPARAM, "
195 "returned: %s\n",DXGetErrorString8(rc
));
197 rc
= (pDllGetClassObject
)(&CLSID_DirectSound
, &IID_IDirectSound
, (void **)(&pcf
));
198 ok(rc
==E_NOINTERFACE
,"DllGetClassObject(CLSID_DirectSound, "
199 "IID_IDirectSound) should have returned E_NOINTERFACE, "
200 "returned: %s\n",DXGetErrorString8(rc
));
202 rc
= (pDllGetClassObject
)(&CLSID_DirectSound
, &IID_IUnknown
, (void **)(&pcf
));
203 ok(rc
==DS_OK
,"DllGetClassObject(CLSID_DirectSound, "
204 "IID_IUnknown) failed: %s\n",DXGetErrorString8(rc
));
206 rc
= (pDllGetClassObject
)(&CLSID_DirectSound
, &IID_IClassFactory
, (void **)(&pcf
));
207 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
208 "failed: %s\n",DXGetErrorString8(rc
));
212 /* direct sound doesn't have an IKsPropertySet */
213 /* DSOUND: Error: Invalid interface buffer */
214 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
216 ok(rc
==DSERR_INVALIDPARAM
, "CreateInstance(IID_IKsPropertySet) should have "
217 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc
));
219 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
221 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
222 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
224 /* and the direct sound 8 version */
225 if (pDirectSoundCreate8
) {
226 rc
= (pDllGetClassObject
)(&CLSID_DirectSound8
, &IID_IClassFactory
, (void **)(&pcf
));
227 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
228 "failed: %s\n",DXGetErrorString8(rc
));
232 /* direct sound 8 doesn't have an IKsPropertySet */
233 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
235 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
236 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
239 /* try direct sound capture next */
240 if (pDirectSoundCaptureCreate
) {
241 rc
= (pDllGetClassObject
)(&CLSID_DirectSoundCapture
, &IID_IClassFactory
,
243 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
244 "failed: %s\n",DXGetErrorString8(rc
));
248 /* direct sound capture doesn't have an IKsPropertySet */
249 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
251 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
252 "returned E_NOINTERFACE,returned: %s\n",DXGetErrorString8(rc
));
255 /* and the direct sound capture 8 version */
256 if (pDirectSoundCaptureCreate8
) {
257 rc
= (pDllGetClassObject
)(&CLSID_DirectSoundCapture8
, &IID_IClassFactory
,
259 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, "
260 "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc
));
264 /* direct sound capture 8 doesn't have an IKsPropertySet */
265 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
267 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
268 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
271 /* try direct sound full duplex next */
272 if (pDirectSoundFullDuplexCreate
) {
273 rc
= (pDllGetClassObject
)(&CLSID_DirectSoundFullDuplex
, &IID_IClassFactory
,
275 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, "
276 "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc
));
280 /* direct sound full duplex doesn't have an IKsPropertySet */
281 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
283 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
284 "returned NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
287 /* try direct sound private last */
288 rc
= (pDllGetClassObject
)(&CLSID_DirectSoundPrivate
, &IID_IClassFactory
,
291 /* some early versions of Direct Sound do not have this */
295 /* direct sound private does have an IKsPropertySet */
296 rc
= IClassFactory_CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
298 ok(rc
==DS_OK
, "CreateInstance(IID_IKsPropertySet) failed: %s\n",
299 DXGetErrorString8(rc
));
303 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION */
304 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
305 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION
,
307 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
308 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
309 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: %s\n",
310 DXGetErrorString8(rc
));
312 if (rc
==E_INVALIDARG
)
313 trace(" Not Supported\n");
317 ok(support
& KSPROPERTY_SUPPORT_GET
,
318 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
319 "support = 0x%x\n",support
);
320 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
321 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
322 "support = 0x%x\n",support
);
324 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 */
325 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
326 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1
,
328 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
329 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
330 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1) failed: %s\n",
331 DXGetErrorString8(rc
));
333 if (rc
==E_INVALIDARG
)
334 trace(" Not Supported\n");
338 ok(support
& KSPROPERTY_SUPPORT_GET
,
339 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: "
340 "support = 0x%x\n",support
);
341 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
342 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: "
343 "support = 0x%x\n",support
);
345 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A */
346 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
347 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A
,
349 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
350 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
351 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A) failed: %s\n",
352 DXGetErrorString8(rc
));
354 if (rc
==E_INVALIDARG
)
355 trace(" Not Supported\n");
359 ok(support
& KSPROPERTY_SUPPORT_GET
,
360 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: "
361 "support = 0x%x\n",support
);
362 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
363 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: "
364 "support = 0x%x\n",support
);
366 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W */
367 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
368 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W
,
370 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
371 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
372 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W) failed: %s\n",
373 DXGetErrorString8(rc
));
375 if (rc
==E_INVALIDARG
)
376 trace(" Not Supported\n");
380 ok(support
& KSPROPERTY_SUPPORT_GET
,
381 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: "
382 "support = 0x%x\n",support
);
383 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
384 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: "
385 "support = 0x%x\n",support
);
387 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING */
388 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
389 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING
, &support
);
390 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
391 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: %s\n",
392 DXGetErrorString8(rc
));
396 ok(support
& KSPROPERTY_SUPPORT_GET
,
397 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: "
398 "support = 0x%x\n",support
);
399 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
400 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: support = "
403 /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A */
404 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
405 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A
, &support
);
406 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
407 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A) failed: %s\n",
408 DXGetErrorString8(rc
));
412 ok(support
& KSPROPERTY_SUPPORT_GET
,
413 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: "
414 "support = 0x%x\n",support
);
415 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
416 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: support = "
419 /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W */
420 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
421 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W
, &support
);
422 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
423 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W) failed: %s\n",
424 DXGetErrorString8(rc
));
428 ok(support
& KSPROPERTY_SUPPORT_GET
,
429 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: "
430 "support = 0x%x\n",support
);
431 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
432 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: support = "
435 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE */
436 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE ***\n");
437 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
438 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE
,
440 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
441 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: %s\n",
442 DXGetErrorString8(rc
));
446 ok(support
& KSPROPERTY_SUPPORT_GET
,
447 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: "
448 "support = 0x%x\n",support
);
449 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
450 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: support = 0x%x\n",support
);
452 if (support
& KSPROPERTY_SUPPORT_GET
) {
453 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA data
;
456 data
.Callback
= callback
;
459 rc
= IKsPropertySet_Get(pps
, &DSPROPSETID_DirectSoundDevice
,
460 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE
,
461 NULL
, 0, &data
, sizeof(data
), &bytes
);
462 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%x\n",rc
);
465 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 */
466 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 ***\n");
467 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
468 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1
,
470 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
471 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1) failed: %s\n",
472 DXGetErrorString8(rc
));
476 ok(support
& KSPROPERTY_SUPPORT_GET
,
477 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: "
478 "support = 0x%x\n",support
);
479 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
480 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: support = 0x%x\n",support
);
482 if (support
& KSPROPERTY_SUPPORT_GET
) {
483 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA data
;
486 data
.Callback
= callback1
;
489 rc
= IKsPropertySet_Get(pps
, &DSPROPSETID_DirectSoundDevice
,
490 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1
,
491 NULL
, 0, &data
, sizeof(data
), &bytes
);
492 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%x\n",rc
);
495 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A */
496 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A ***\n");
497 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
498 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A
,
500 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
501 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A) failed: %s\n",
502 DXGetErrorString8(rc
));
506 ok(support
& KSPROPERTY_SUPPORT_GET
,
507 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: "
508 "support = 0x%x\n",support
);
509 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
510 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: support = 0x%x\n",support
);
512 if (support
& KSPROPERTY_SUPPORT_GET
) {
513 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA data
;
516 data
.Callback
= callbackA
;
519 rc
= IKsPropertySet_Get(pps
, &DSPROPSETID_DirectSoundDevice
,
520 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A
,
521 NULL
, 0, &data
, sizeof(data
), &bytes
);
522 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%x\n",rc
);
525 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W */
526 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W ***\n");
527 rc
= IKsPropertySet_QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
528 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W
,
530 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
531 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W) failed: %s\n",
532 DXGetErrorString8(rc
));
536 ok(support
& KSPROPERTY_SUPPORT_GET
,
537 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: "
538 "support = 0x%x\n",support
);
539 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
540 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: support = 0x%x\n",support
);
542 if (support
& KSPROPERTY_SUPPORT_GET
) {
543 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data
;
546 data
.Callback
= callbackW
;
549 rc
= IKsPropertySet_Get(pps
, &DSPROPSETID_DirectSoundDevice
,
550 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W
,
551 NULL
, 0, &data
, sizeof(data
), &bytes
);
552 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%x\n",rc
);
556 static BOOL WINAPI
dsenum_callback(LPGUID lpGuid
, LPCSTR lpcstrDescription
,
557 LPCSTR lpcstrModule
, LPVOID lpContext
)
560 LPDIRECTSOUND dso
=NULL
;
561 LPDIRECTSOUNDBUFFER primary
=NULL
,secondary
=NULL
;
562 DSBUFFERDESC bufdesc
;
566 trace("*** Testing %s - %s ***\n",lpcstrDescription
,lpcstrModule
);
568 rc
=pDirectSoundCreate(lpGuid
,&dso
,NULL
);
569 ok(rc
==DS_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
||rc
==E_FAIL
,
570 "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc
));
572 if (rc
==DSERR_NODRIVER
)
573 trace(" No Driver\n");
574 else if (rc
== DSERR_ALLOCATED
)
575 trace(" Already In Use\n");
576 else if (rc
== E_FAIL
)
577 trace(" No Device\n");
581 /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
582 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
583 rc
=IDirectSound_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_PRIORITY
);
584 ok(rc
==DS_OK
,"IDirectSound_SetCooperativeLevel() failed: %s\n",
585 DXGetErrorString8(rc
));
589 /* Testing 3D buffers */
591 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
592 bufdesc
.dwSize
=sizeof(bufdesc
);
593 bufdesc
.dwFlags
=DSBCAPS_PRIMARYBUFFER
|DSBCAPS_LOCHARDWARE
|DSBCAPS_CTRL3D
;
594 rc
=IDirectSound_CreateSoundBuffer(dso
,&bufdesc
,&primary
,NULL
);
595 ok(rc
==DS_OK
&&primary
!=NULL
,"IDirectSound_CreateSoundBuffer() failed to "
596 "create a hardware 3D primary buffer: %s\n",DXGetErrorString8(rc
));
597 if (rc
==DS_OK
&&primary
!=NULL
) {
598 ZeroMemory(&wfx
, sizeof(wfx
));
599 wfx
.wFormatTag
=WAVE_FORMAT_PCM
;
601 wfx
.wBitsPerSample
=16;
602 wfx
.nSamplesPerSec
=44100;
603 wfx
.nBlockAlign
=wfx
.nChannels
*wfx
.wBitsPerSample
/8;
604 wfx
.nAvgBytesPerSec
=wfx
.nSamplesPerSec
*wfx
.nBlockAlign
;
605 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
606 bufdesc
.dwSize
=sizeof(bufdesc
);
607 bufdesc
.dwFlags
=DSBCAPS_CTRLDEFAULT
|DSBCAPS_GETCURRENTPOSITION2
;
608 bufdesc
.dwBufferBytes
=wfx
.nAvgBytesPerSec
;
609 bufdesc
.lpwfxFormat
=&wfx
;
610 trace(" Testing a secondary buffer at %dx%dx%d\n",
611 wfx
.nSamplesPerSec
,wfx
.wBitsPerSample
,wfx
.nChannels
);
612 rc
=IDirectSound_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
613 ok(rc
==DS_OK
&&secondary
!=NULL
,"IDirectSound_CreateSoundBuffer() "
614 "failed to create a secondary buffer: %s\n",DXGetErrorString8(rc
));
615 if (rc
==DS_OK
&&secondary
!=NULL
) {
616 IKsPropertySet
* pPropertySet
=NULL
;
617 rc
=IDirectSoundBuffer_QueryInterface(secondary
,
619 (void **)&pPropertySet
);
620 /* it's not an error for this to fail */
623 trace(" Supports property sets\n");
624 /* it's not an error for these to fail */
625 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
626 &DSPROPSETID_VoiceManager
,
628 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
629 KSPROPERTY_SUPPORT_SET
)))
630 trace(" DSPROPSETID_VoiceManager supported\n");
632 trace(" DSPROPSETID_VoiceManager not supported\n");
633 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
634 &DSPROPSETID_EAX20_ListenerProperties
,0,&ulTypeSupport
);
635 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
636 KSPROPERTY_SUPPORT_SET
)))
637 trace(" DSPROPSETID_EAX20_ListenerProperties "
640 trace(" DSPROPSETID_EAX20_ListenerProperties not "
642 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
643 &DSPROPSETID_EAX20_BufferProperties
,0,&ulTypeSupport
);
644 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
645 KSPROPERTY_SUPPORT_SET
)))
646 trace(" DSPROPSETID_EAX20_BufferProperties supported\n");
648 trace(" DSPROPSETID_EAX20_BufferProperties not "
650 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
651 &DSPROPSETID_I3DL2_ListenerProperties
,0,&ulTypeSupport
);
652 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
653 KSPROPERTY_SUPPORT_SET
)))
654 trace(" DSPROPSETID_I3DL2_ListenerProperties "
657 trace(" DSPROPSETID_I3DL2_ListenerProperties not "
659 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
660 &DSPROPSETID_I3DL2_BufferProperties
,0,&ulTypeSupport
);
661 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
662 KSPROPERTY_SUPPORT_SET
)))
663 trace(" DSPROPSETID_I3DL2_BufferProperties supported\n");
665 trace(" DSPROPSETID_I3DL2_BufferProperties not "
667 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
668 &DSPROPSETID_ZOOMFX_BufferProperties
,0,&ulTypeSupport
);
669 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
670 KSPROPERTY_SUPPORT_SET
)))
671 trace(" DSPROPSETID_ZOOMFX_BufferProperties "
674 trace(" DSPROPSETID_ZOOMFX_BufferProperties not "
676 ref
=IKsPropertySet_Release(pPropertySet
);
677 /* try a few common ones */
678 ok(ref
==0,"IKsPropertySet_Release() secondary has %d "
679 "references, should have 0\n",ref
);
681 trace(" Doesn't support property sets\n");
683 ref
=IDirectSoundBuffer_Release(secondary
);
684 ok(ref
==0,"IDirectSoundBuffer_Release() secondary has %d "
685 "references, should have 0\n",ref
);
688 ref
=IDirectSoundBuffer_Release(primary
);
689 ok(ref
==0,"IDirectSoundBuffer_Release() primary has %d references, "
690 "should have 0\n",ref
);
695 ref
=IDirectSound_Release(dso
);
696 ok(ref
==0,"IDirectSound_Release() has %d references, should have 0\n",
702 static void propset_buffer_tests(void)
705 rc
=pDirectSoundEnumerateA(&dsenum_callback
,NULL
);
706 ok(rc
==DS_OK
,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc
));
715 hDsound
= LoadLibrary("dsound.dll");
718 trace("DLL Version: %s\n", get_file_version("dsound.dll"));
720 pDirectSoundEnumerateA
= (void*)GetProcAddress(hDsound
,
721 "DirectSoundEnumerateA");
722 pDllGetClassObject
= (void *)GetProcAddress(hDsound
,
723 "DllGetClassObject");
724 pDirectSoundCreate
= (void*)GetProcAddress(hDsound
,
725 "DirectSoundCreate");
726 pDirectSoundCreate8
= (void*)GetProcAddress(hDsound
,
727 "DirectSoundCreate8");
728 pDirectSoundCaptureCreate
=(void*)GetProcAddress(hDsound
,
729 "DirectSoundCaptureCreate");
730 pDirectSoundCaptureCreate8
=(void*)GetProcAddress(hDsound
,
731 "DirectSoundCaptureCreate8");
732 pDirectSoundFullDuplexCreate
=(void*)GetProcAddress(hDsound
,
733 "DirectSoundFullDuplexCreate");
735 propset_private_tests();
736 propset_buffer_tests();
738 FreeLibrary(hDsound
);
741 skip("dsound.dll not found!\n");