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
26 #include "wine/test.h"
32 #include "dsound_test.h"
34 #ifndef DSBCAPS_CTRLDEFAULT
35 #define DSBCAPS_CTRLDEFAULT \
36 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 typedef HRESULT (CALLBACK
* MYPROC
)(REFCLSID
, REFIID
, LPVOID
*);
54 static HRESULT (WINAPI
*pDirectSoundCreate8
)(LPCGUID
,LPDIRECTSOUND8
*,
56 static HRESULT (WINAPI
*pDirectSoundCaptureCreate
)(LPCGUID
,
57 LPDIRECTSOUNDCAPTURE
*,LPUNKNOWN
)=NULL
;
58 static HRESULT (WINAPI
*pDirectSoundCaptureCreate8
)(LPCGUID
,
59 LPDIRECTSOUNDCAPTURE8
*,LPUNKNOWN
)=NULL
;
60 static HRESULT (WINAPI
*pDirectSoundFullDuplexCreate
)(LPCGUID
,LPCGUID
,
61 LPCDSCBUFFERDESC
,LPCDSBUFFERDESC
,HWND
,DWORD
,LPDIRECTSOUNDFULLDUPLEX
*,
62 LPDIRECTSOUNDCAPTUREBUFFER8
*,LPDIRECTSOUNDBUFFER8
*,LPUNKNOWN
)=NULL
;
64 BOOL CALLBACK
callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data
,
67 trace(" found device:\n");
69 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
70 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
71 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
72 trace(" DataFlow: %s\n",
73 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
74 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
75 "Capture" : "Unknown");
76 trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
77 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
78 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
79 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
80 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
81 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
82 trace(" Description: %s\n", data
->Description
);
83 trace(" Module: %s\n", data
->Module
);
84 trace(" Interface: %s\n", data
->Interface
);
85 trace(" WaveDeviceId: %ld\n", data
->WaveDeviceId
);
90 BOOL CALLBACK
callback1(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data
,
93 char descriptionA
[0x100];
94 char moduleA
[MAX_PATH
];
96 trace(" found device:\n");
98 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
99 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
100 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
101 trace(" DataFlow: %s\n",
102 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
103 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
104 "Capture" : "Unknown");
105 trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
106 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
107 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
108 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
109 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
110 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
111 trace(" DescriptionA: %s\n", data
->DescriptionA
);
112 WideCharToMultiByte(CP_ACP
, 0, data
->DescriptionW
, -1, descriptionA
, sizeof(descriptionA
), NULL
, NULL
);
113 trace(" DescriptionW: %s\n", descriptionA
);
114 trace(" ModuleA: %s\n", data
->ModuleA
);
115 WideCharToMultiByte(CP_ACP
, 0, data
->ModuleW
, -1, moduleA
, sizeof(moduleA
), NULL
, NULL
);
116 trace(" ModuleW: %s\n", moduleA
);
117 trace(" WaveDeviceId: %ld\n", data
->WaveDeviceId
);
122 BOOL CALLBACK
callbackA(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA data
,
125 trace(" found device:\n");
127 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
128 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
129 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
130 trace(" DataFlow: %s\n",
131 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
132 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
133 "Capture" : "Unknown");
134 trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
135 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
136 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
137 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
138 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
139 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
140 trace(" Description: %s\n", data
->Description
);
141 trace(" Module: %s\n", data
->Module
);
142 trace(" Interface: %s\n", data
->Interface
);
143 trace(" WaveDeviceId: %ld\n", data
->WaveDeviceId
);
148 BOOL CALLBACK
callbackW(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data
,
151 char descriptionA
[0x100];
152 char moduleA
[MAX_PATH
];
153 char interfaceA
[MAX_PATH
];
155 trace("found device:\n");
156 trace("\tType: %s\n",
157 data
->Type
== DIRECTSOUNDDEVICE_TYPE_EMULATED
? "Emulated" :
158 data
->Type
== DIRECTSOUNDDEVICE_TYPE_VXD
? "VxD" :
159 data
->Type
== DIRECTSOUNDDEVICE_TYPE_WDM
? "WDM" : "Unknown");
160 trace("\tDataFlow: %s\n",
161 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_RENDER
? "Render" :
162 data
->DataFlow
== DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
?
163 "Capture" : "Unknown");
164 trace("\tDeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
165 data
->DeviceId
.Data1
,data
->DeviceId
.Data2
,data
->DeviceId
.Data3
,
166 data
->DeviceId
.Data4
[0],data
->DeviceId
.Data4
[1],
167 data
->DeviceId
.Data4
[2],data
->DeviceId
.Data4
[3],
168 data
->DeviceId
.Data4
[4],data
->DeviceId
.Data4
[5],
169 data
->DeviceId
.Data4
[6],data
->DeviceId
.Data4
[7]);
170 WideCharToMultiByte(CP_ACP
, 0, data
->Description
, -1, descriptionA
, sizeof(descriptionA
), NULL
, NULL
);
171 WideCharToMultiByte(CP_ACP
, 0, data
->Module
, -1, moduleA
, sizeof(moduleA
), NULL
, NULL
);
172 WideCharToMultiByte(CP_ACP
, 0, data
->Interface
, -1, interfaceA
, sizeof(interfaceA
), NULL
, NULL
);
173 trace("\tDescription: %s\n", descriptionA
);
174 trace("\tModule: %s\n", moduleA
);
175 trace("\tInterface: %s\n", interfaceA
);
176 trace("\tWaveDeviceId: %ld\n", data
->WaveDeviceId
);
181 static void propset_private_tests()
186 IKsPropertySet
* pps
;
190 hDsound
= LoadLibrary("dsound.dll");
191 ok(hDsound
!=0,"LoadLibrary(dsound.dll) failed\n");
195 fProc
= (MYPROC
)GetProcAddress(hDsound
, "DllGetClassObject");
197 /* try direct sound first */
198 /* DSOUND: Error: Invalid interface buffer */
199 rc
= (fProc
)(&CLSID_DirectSound
, &IID_IClassFactory
, (void **)0);
200 ok(rc
==DSERR_INVALIDPARAM
,"DllGetClassObject(CLSID_DirectSound, "
201 "IID_IClassFactory) should have returned DSERR_INVALIDPARAM, "
202 "returned: %s\n",DXGetErrorString8(rc
));
204 rc
= (fProc
)(&CLSID_DirectSound
, &IID_IClassFactory
, (void **)(&pcf
));
205 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
206 "failed: %s\n",DXGetErrorString8(rc
));
210 /* direct sound doesn't have an IKsPropertySet */
211 /* DSOUND: Error: Invalid interface buffer */
212 rc
= pcf
->lpVtbl
->CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
214 ok(rc
==DSERR_INVALIDPARAM
, "CreateInstance(IID_IKsPropertySet) should have "
215 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc
));
217 rc
= pcf
->lpVtbl
->CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
219 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
220 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
222 /* and the direct sound 8 version */
223 if (pDirectSoundCreate8
) {
224 rc
= (fProc
)(&CLSID_DirectSound8
, &IID_IClassFactory
, (void **)(&pcf
));
225 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
226 "failed: %s\n",DXGetErrorString8(rc
));
230 /* direct sound 8 doesn't have an IKsPropertySet */
231 rc
= pcf
->lpVtbl
->CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
233 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
234 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
237 /* try direct sound capture next */
238 if (pDirectSoundCaptureCreate
) {
239 rc
= (fProc
)(&CLSID_DirectSoundCapture
, &IID_IClassFactory
,
241 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
242 "failed: %s\n",DXGetErrorString8(rc
));
246 /* direct sound capture doesn't have an IKsPropertySet */
247 rc
= pcf
->lpVtbl
->CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
249 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
250 "returned E_NOINTERFACE,returned: %s\n",DXGetErrorString8(rc
));
253 /* and the direct sound capture 8 version */
254 if (pDirectSoundCaptureCreate8
) {
255 rc
= (fProc
)(&CLSID_DirectSoundCapture8
, &IID_IClassFactory
,
257 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, "
258 "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc
));
262 /* direct sound capture 8 doesn't have an IKsPropertySet */
263 rc
= pcf
->lpVtbl
->CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
265 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
266 "returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
269 /* try direct sound full duplex next */
270 if (pDirectSoundFullDuplexCreate
) {
271 rc
= (fProc
)(&CLSID_DirectSoundFullDuplex
, &IID_IClassFactory
,
273 ok(pcf
!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, "
274 "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc
));
278 /* direct sound full duplex doesn't have an IKsPropertySet */
279 rc
= pcf
->lpVtbl
->CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
281 ok(rc
==E_NOINTERFACE
, "CreateInstance(IID_IKsPropertySet) should have "
282 "returned NOINTERFACE, returned: %s\n",DXGetErrorString8(rc
));
285 /* try direct sound private last */
286 rc
= (fProc
)(&CLSID_DirectSoundPrivate
, &IID_IClassFactory
,
289 /* some early versions of Direct Sound do not have this */
293 /* direct sound private does have an IKsPropertySet */
294 rc
= pcf
->lpVtbl
->CreateInstance(pcf
, NULL
, &IID_IKsPropertySet
,
296 ok(rc
==DS_OK
, "CreateInstance(IID_IKsPropertySet) failed: %s\n",
297 DXGetErrorString8(rc
));
301 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION */
302 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
303 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION
,
305 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
306 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
307 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: %s\n",
308 DXGetErrorString8(rc
));
310 if (rc
==E_INVALIDARG
)
311 trace(" Not Supported\n");
315 ok(support
& KSPROPERTY_SUPPORT_GET
,
316 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
317 "support = 0x%lx\n",support
);
318 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
319 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
320 "support = 0x%lx\n",support
);
322 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 */
323 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
324 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1
,
326 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
327 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
328 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1) failed: %s\n",
329 DXGetErrorString8(rc
));
331 if (rc
==E_INVALIDARG
)
332 trace(" Not Supported\n");
336 ok(support
& KSPROPERTY_SUPPORT_GET
,
337 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: "
338 "support = 0x%lx\n",support
);
339 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
340 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: "
341 "support = 0x%lx\n",support
);
343 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A */
344 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
345 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A
,
347 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
348 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
349 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A) failed: %s\n",
350 DXGetErrorString8(rc
));
352 if (rc
==E_INVALIDARG
)
353 trace(" Not Supported\n");
357 ok(support
& KSPROPERTY_SUPPORT_GET
,
358 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: "
359 "support = 0x%lx\n",support
);
360 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
361 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: "
362 "support = 0x%lx\n",support
);
364 /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W */
365 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
366 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W
,
368 ok(rc
==DS_OK
||rc
==E_INVALIDARG
,
369 "QuerySupport(DSPROPSETID_DirectSoundDevice, "
370 "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W) failed: %s\n",
371 DXGetErrorString8(rc
));
373 if (rc
==E_INVALIDARG
)
374 trace(" Not Supported\n");
378 ok(support
& KSPROPERTY_SUPPORT_GET
,
379 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: "
380 "support = 0x%lx\n",support
);
381 ok(!(support
& KSPROPERTY_SUPPORT_SET
),
382 "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: "
383 "support = 0x%lx\n",support
);
385 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING */
386 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
387 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING
, &support
);
388 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
389 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: %s\n",
390 DXGetErrorString8(rc
));
394 ok(support
& KSPROPERTY_SUPPORT_GET
,
395 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: "
396 "support = 0x%lx\n",support
);
397 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
398 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: support = "
401 /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A */
402 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
403 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A
, &support
);
404 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
405 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A) failed: %s\n",
406 DXGetErrorString8(rc
));
410 ok(support
& KSPROPERTY_SUPPORT_GET
,
411 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: "
412 "support = 0x%lx\n",support
);
413 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
414 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: support = "
417 /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W */
418 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
419 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W
, &support
);
420 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
421 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W) failed: %s\n",
422 DXGetErrorString8(rc
));
426 ok(support
& KSPROPERTY_SUPPORT_GET
,
427 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: "
428 "support = 0x%lx\n",support
);
429 ok(!(support
& KSPROPERTY_SUPPORT_SET
), "Shouldn't be able to set "
430 "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: support = "
433 /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE */
434 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE ***\n");
435 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
436 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE
,
438 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
439 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: %s\n",
440 DXGetErrorString8(rc
));
444 ok(support
& KSPROPERTY_SUPPORT_GET
,
445 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: "
446 "support = 0x%lx\n",support
);
447 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
448 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: support = 0x%lx\n",support
);
450 if (support
& KSPROPERTY_SUPPORT_GET
) {
451 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA data
;
454 data
.Callback
= callback
;
457 rc
= pps
->lpVtbl
->Get(pps
, &DSPROPSETID_DirectSoundDevice
,
458 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE
,
459 NULL
, 0, &data
, sizeof(data
), &bytes
);
460 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%lx\n",rc
);
463 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 */
464 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 ***\n");
465 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
466 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1
,
468 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
469 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1) failed: %s\n",
470 DXGetErrorString8(rc
));
474 ok(support
& KSPROPERTY_SUPPORT_GET
,
475 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: "
476 "support = 0x%lx\n",support
);
477 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
478 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: support = 0x%lx\n",support
);
480 if (support
& KSPROPERTY_SUPPORT_GET
) {
481 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA data
;
484 data
.Callback
= callback1
;
487 rc
= pps
->lpVtbl
->Get(pps
, &DSPROPSETID_DirectSoundDevice
,
488 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1
,
489 NULL
, 0, &data
, sizeof(data
), &bytes
);
490 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%lx\n",rc
);
493 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A */
494 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A ***\n");
495 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
496 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A
,
498 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
499 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A) failed: %s\n",
500 DXGetErrorString8(rc
));
504 ok(support
& KSPROPERTY_SUPPORT_GET
,
505 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: "
506 "support = 0x%lx\n",support
);
507 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
508 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: support = 0x%lx\n",support
);
510 if (support
& KSPROPERTY_SUPPORT_GET
) {
511 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA data
;
514 data
.Callback
= callbackA
;
517 rc
= pps
->lpVtbl
->Get(pps
, &DSPROPSETID_DirectSoundDevice
,
518 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A
,
519 NULL
, 0, &data
, sizeof(data
), &bytes
);
520 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%lx\n",rc
);
523 /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W */
524 trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W ***\n");
525 rc
= pps
->lpVtbl
->QuerySupport(pps
, &DSPROPSETID_DirectSoundDevice
,
526 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W
,
528 ok(rc
==DS_OK
, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
529 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W) failed: %s\n",
530 DXGetErrorString8(rc
));
534 ok(support
& KSPROPERTY_SUPPORT_GET
,
535 "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: "
536 "support = 0x%lx\n",support
);
537 ok(!(support
& KSPROPERTY_SUPPORT_SET
),"Shouldn't be able to set "
538 "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: support = 0x%lx\n",support
);
540 if (support
& KSPROPERTY_SUPPORT_GET
) {
541 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data
;
544 data
.Callback
= callbackW
;
547 rc
= pps
->lpVtbl
->Get(pps
, &DSPROPSETID_DirectSoundDevice
,
548 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W
,
549 NULL
, 0, &data
, sizeof(data
), &bytes
);
550 ok(rc
==DS_OK
, "Couldn't enumerate: 0x%lx\n",rc
);
554 FreeLibrary(hDsound
);
557 static BOOL WINAPI
dsenum_callback(LPGUID lpGuid
, LPCSTR lpcstrDescription
,
558 LPCSTR lpcstrModule
, LPVOID lpContext
)
561 LPDIRECTSOUND dso
=NULL
;
562 LPDIRECTSOUNDBUFFER primary
=NULL
,secondary
=NULL
;
563 DSBUFFERDESC bufdesc
;
567 trace("*** Testing %s - %s ***\n",lpcstrDescription
,lpcstrModule
);
569 rc
=DirectSoundCreate(lpGuid
,&dso
,NULL
);
570 ok(rc
==DS_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
||rc
==E_FAIL
,
571 "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc
));
573 if (rc
==DSERR_NODRIVER
)
574 trace(" No Driver\n");
575 else if (rc
== DSERR_ALLOCATED
)
576 trace(" Already In Use\n");
577 else if (rc
== E_FAIL
)
578 trace(" No Device\n");
582 /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
583 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
584 rc
=IDirectSound_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_PRIORITY
);
585 ok(rc
==DS_OK
,"IDirectSound_SetCooperativeLevel() failed: %s\n",
586 DXGetErrorString8(rc
));
590 /* Testing 3D buffers */
592 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
593 bufdesc
.dwSize
=sizeof(bufdesc
);
594 bufdesc
.dwFlags
=DSBCAPS_PRIMARYBUFFER
|DSBCAPS_LOCHARDWARE
|DSBCAPS_CTRL3D
;
595 rc
=IDirectSound_CreateSoundBuffer(dso
,&bufdesc
,&primary
,NULL
);
596 ok(rc
==DS_OK
&&primary
!=NULL
,"IDirectSound_CreateSoundBuffer() failed to "
597 "create a hardware 3D primary buffer: %s\n",DXGetErrorString8(rc
));
598 if (rc
==DS_OK
&&primary
!=NULL
) {
599 ZeroMemory(&wfx
, sizeof(wfx
));
600 wfx
.wFormatTag
=WAVE_FORMAT_PCM
;
602 wfx
.wBitsPerSample
=16;
603 wfx
.nSamplesPerSec
=44100;
604 wfx
.nBlockAlign
=wfx
.nChannels
*wfx
.wBitsPerSample
/8;
605 wfx
.nAvgBytesPerSec
=wfx
.nSamplesPerSec
*wfx
.nBlockAlign
;
606 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
607 bufdesc
.dwSize
=sizeof(bufdesc
);
608 bufdesc
.dwFlags
=DSBCAPS_CTRLDEFAULT
|DSBCAPS_GETCURRENTPOSITION2
;
609 bufdesc
.dwBufferBytes
=wfx
.nAvgBytesPerSec
;
610 bufdesc
.lpwfxFormat
=&wfx
;
611 trace(" Testing a secondary buffer at %ldx%dx%d\n",
612 wfx
.nSamplesPerSec
,wfx
.wBitsPerSample
,wfx
.nChannels
);
613 rc
=IDirectSound_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
614 ok(rc
==DS_OK
&&secondary
!=NULL
,"IDirectSound_CreateSoundBuffer() "
615 "failed to create a secondary buffer: %s\n",DXGetErrorString8(rc
));
616 if (rc
==DS_OK
&&secondary
!=NULL
) {
617 IKsPropertySet
* pPropertySet
=NULL
;
618 rc
=IDirectSoundBuffer_QueryInterface(secondary
,
620 (void **)&pPropertySet
);
621 /* it's not an error for this to fail */
624 trace(" Supports property sets\n");
625 /* it's not an error for these to fail */
626 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
627 &DSPROPSETID_VoiceManager
,
629 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
630 KSPROPERTY_SUPPORT_SET
)))
631 trace(" DSPROPSETID_VoiceManager supported\n");
633 trace(" DSPROPSETID_VoiceManager not supported\n");
634 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
635 &DSPROPSETID_EAX20_ListenerProperties
,0,&ulTypeSupport
);
636 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
637 KSPROPERTY_SUPPORT_SET
)))
638 trace(" DSPROPSETID_EAX20_ListenerProperties "
641 trace(" DSPROPSETID_EAX20_ListenerProperties not "
643 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
644 &DSPROPSETID_EAX20_BufferProperties
,0,&ulTypeSupport
);
645 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
646 KSPROPERTY_SUPPORT_SET
)))
647 trace(" DSPROPSETID_EAX20_BufferProperties supported\n");
649 trace(" DSPROPSETID_EAX20_BufferProperties not "
651 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
652 &DSPROPSETID_I3DL2_ListenerProperties
,0,&ulTypeSupport
);
653 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
654 KSPROPERTY_SUPPORT_SET
)))
655 trace(" DSPROPSETID_I3DL2_ListenerProperties "
658 trace(" DSPROPSETID_I3DL2_ListenerProperties not "
660 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
661 &DSPROPSETID_I3DL2_BufferProperties
,0,&ulTypeSupport
);
662 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
663 KSPROPERTY_SUPPORT_SET
)))
664 trace(" DSPROPSETID_I3DL2_BufferProperties supported\n");
666 trace(" DSPROPSETID_I3DL2_BufferProperties not "
668 rc
=IKsPropertySet_QuerySupport(pPropertySet
,
669 &DSPROPSETID_ZOOMFX_BufferProperties
,0,&ulTypeSupport
);
670 if((rc
==DS_OK
)&&(ulTypeSupport
&(KSPROPERTY_SUPPORT_GET
|
671 KSPROPERTY_SUPPORT_SET
)))
672 trace(" DSPROPSETID_ZOOMFX_BufferProperties "
675 trace(" DSPROPSETID_ZOOMFX_BufferProperties not "
677 ref
=IKsPropertySet_Release(pPropertySet
);
678 /* try a few common ones */
679 ok(ref
==0,"IKsPropertySet_Release() secondary has %d "
680 "references, should have 0\n",ref
);
682 trace(" Doesn't support property sets\n");
684 ref
=IDirectSoundBuffer_Release(secondary
);
685 ok(ref
==0,"IDirectSoundBuffer_Release() secondary has %d "
686 "references, should have 0\n",ref
);
689 ref
=IDirectSoundBuffer_Release(primary
);
690 ok(ref
==0,"IDirectSoundBuffer_Release() primary has %d references, "
691 "should have 0\n",ref
);
696 ref
=IDirectSound_Release(dso
);
697 ok(ref
==0,"IDirectSound_Release() has %d references, should have 0\n",
703 static void propset_buffer_tests()
706 rc
=DirectSoundEnumerateA(&dsenum_callback
,NULL
);
707 ok(rc
==DS_OK
,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc
));
716 hDsound
= LoadLibraryA("dsound.dll");
718 trace("dsound.dll not found\n");
722 trace("DLL Version: %s\n", get_file_version("dsound.dll"));
724 pDirectSoundCreate8
= (void*)GetProcAddress(hDsound
, "DirectSoundCreate8");
725 pDirectSoundCaptureCreate
=(void*)GetProcAddress(hDsound
,"DirectSoundCaptureCreate");
726 pDirectSoundCaptureCreate8
=(void*)GetProcAddress(hDsound
,"DirectSoundCaptureCreate8");
727 pDirectSoundFullDuplexCreate
=(void*)GetProcAddress(hDsound
,"DirectSoundFullDuplexCreate");
729 propset_private_tests();
730 propset_buffer_tests();