2 * Tests basic sound playback in DirectSound.
3 * In particular we test each standard Windows sound format to make sure
4 * we handle the sound card/driver quirks correctly.
6 * Part of this test involves playing test tones. But this only makes
7 * sense if someone is going to carefully listen to it, and would only
8 * bother everyone else.
9 * So this is only done if the test is being run in interactive mode.
11 * Copyright (c) 2002-2004 Francois Gouget
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "wine/test.h"
44 #include "mmdeviceapi.h"
45 #include "audioclient.h"
49 #include "dsound_test.h"
51 static const GUID testdmo_clsid
= {0x1234};
53 int align(int length
, int align
)
55 return (length
/ align
) * align
;
58 static void IDirectSound8_test(LPDIRECTSOUND8 dso
, BOOL initialized
,
67 DWORD speaker_config
, new_speaker_config
, ref_speaker_config
;
70 /* Try to Query for objects */
71 rc
=IDirectSound8_QueryInterface(dso
,&IID_IUnknown
,(LPVOID
*)&unknown
);
72 ok(rc
==DS_OK
,"IDirectSound8_QueryInterface(IID_IUnknown) failed: %08lx\n", rc
);
74 IUnknown_Release(unknown
);
76 rc
=IDirectSound8_QueryInterface(dso
,&IID_IDirectSound
,(LPVOID
*)&ds
);
77 ok(rc
==DS_OK
,"IDirectSound8_QueryInterface(IID_IDirectSound) failed: %08lx\n", rc
);
79 IDirectSound_Release(ds
);
81 rc
=IDirectSound8_QueryInterface(dso
,&IID_IDirectSound8
,(LPVOID
*)&ds8
);
82 ok(rc
==DS_OK
,"IDirectSound8_QueryInterface(IID_IDirectSound8) "
83 "should have returned DSERR_INVALIDPARAM, returned: %08lx\n", rc
);
85 IDirectSound8_Release(ds8
);
87 if (initialized
== FALSE
) {
88 /* try uninitialized object */
89 rc
=IDirectSound8_GetCaps(dso
,0);
90 ok(rc
==DSERR_UNINITIALIZED
,"IDirectSound8_GetCaps(NULL) "
91 "should have returned DSERR_UNINITIALIZED, returned: %08lx\n", rc
);
93 rc
=IDirectSound8_GetCaps(dso
,&dscaps
);
94 ok(rc
==DSERR_UNINITIALIZED
,"IDirectSound8_GetCaps() "
95 "should have returned DSERR_UNINITIALIZED, returned: %08lx\n", rc
);
97 rc
=IDirectSound8_Compact(dso
);
98 ok(rc
==DSERR_UNINITIALIZED
,"IDirectSound8_Compact() "
99 "should have returned DSERR_UNINITIALIZED, returned: %08lx\n", rc
);
101 rc
=IDirectSound8_GetSpeakerConfig(dso
,&speaker_config
);
102 ok(rc
==DSERR_UNINITIALIZED
,"IDirectSound8_GetSpeakerConfig() "
103 "should have returned DSERR_UNINITIALIZED, returned: %08lx\n", rc
);
105 rc
=IDirectSound8_VerifyCertification(dso
, &certified
);
106 ok(rc
==DSERR_UNINITIALIZED
,"IDirectSound8_VerifyCertification() "
107 "should have returned DSERR_UNINITIALIZED, returned: %08lx\n", rc
);
109 rc
=IDirectSound8_Initialize(dso
,lpGuid
);
110 ok(rc
==DS_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
||rc
==E_FAIL
,
111 "IDirectSound8_Initialize() failed: %08lx\n",rc
);
112 if (rc
==DSERR_NODRIVER
) {
113 trace(" No Driver\n");
115 } else if (rc
==E_FAIL
) {
116 trace(" No Device\n");
118 } else if (rc
==DSERR_ALLOCATED
) {
119 trace(" Already In Use\n");
124 rc
=IDirectSound8_Initialize(dso
,lpGuid
);
125 ok(rc
==DSERR_ALREADYINITIALIZED
, "IDirectSound8_Initialize() "
126 "should have returned DSERR_ALREADYINITIALIZED: %08lx\n", rc
);
128 /* DSOUND: Error: Invalid caps buffer */
129 rc
=IDirectSound8_GetCaps(dso
,0);
130 ok(rc
==DSERR_INVALIDPARAM
,"IDirectSound8_GetCaps() "
131 "should have returned DSERR_INVALIDPARAM, returned: %08lx\n", rc
);
133 ZeroMemory(&dscaps
, sizeof(dscaps
));
135 /* DSOUND: Error: Invalid caps buffer */
136 rc
=IDirectSound8_GetCaps(dso
,&dscaps
);
137 ok(rc
==DSERR_INVALIDPARAM
,"IDirectSound8_GetCaps() "
138 "should have returned DSERR_INVALIDPARAM, returned: %08lx\n", rc
);
140 dscaps
.dwSize
=sizeof(dscaps
);
142 /* DSOUND: Running on a certified driver */
143 rc
=IDirectSound8_GetCaps(dso
,&dscaps
);
144 ok(rc
==DS_OK
,"IDirectSound8_GetCaps() failed: %08lx\n",rc
);
146 rc
=IDirectSound8_Compact(dso
);
147 ok(rc
==DSERR_PRIOLEVELNEEDED
,"IDirectSound8_Compact() failed: %08lx\n", rc
);
149 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_PRIORITY
);
150 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
152 rc
=IDirectSound8_Compact(dso
);
153 ok(rc
==DS_OK
,"IDirectSound8_Compact() failed: %08lx\n",rc
);
155 rc
=IDirectSound8_GetSpeakerConfig(dso
,0);
156 ok(rc
==DSERR_INVALIDPARAM
,"IDirectSound8_GetSpeakerConfig(NULL) "
157 "should have returned DSERR_INVALIDPARAM, returned: %08lx\n", rc
);
159 rc
=IDirectSound8_GetSpeakerConfig(dso
,&speaker_config
);
160 ok(rc
==DS_OK
,"IDirectSound8_GetSpeakerConfig() failed: %08lx\n", rc
);
161 ref_speaker_config
= speaker_config
;
163 speaker_config
= DSSPEAKER_COMBINED(DSSPEAKER_STEREO
,
164 DSSPEAKER_GEOMETRY_WIDE
);
165 if (speaker_config
== ref_speaker_config
)
166 speaker_config
= DSSPEAKER_COMBINED(DSSPEAKER_STEREO
,
167 DSSPEAKER_GEOMETRY_NARROW
);
169 rc
=IDirectSound8_SetSpeakerConfig(dso
,speaker_config
);
170 ok(rc
==DS_OK
,"IDirectSound8_SetSpeakerConfig() failed: %08lx\n", rc
);
173 rc
=IDirectSound8_GetSpeakerConfig(dso
,&new_speaker_config
);
174 ok(rc
==DS_OK
,"IDirectSound8_GetSpeakerConfig() failed: %08lx\n", rc
);
175 if (rc
==DS_OK
&& speaker_config
!=new_speaker_config
&& ref_speaker_config
!=new_speaker_config
)
176 trace("IDirectSound8_GetSpeakerConfig() failed to set speaker "
177 "config: expected 0x%08lx or 0x%08lx, got 0x%08lx\n",
178 speaker_config
,ref_speaker_config
,new_speaker_config
);
179 IDirectSound8_SetSpeakerConfig(dso
,ref_speaker_config
);
182 rc
=IDirectSound8_VerifyCertification(dso
, &certified
);
183 ok(rc
==DS_OK
||rc
==E_NOTIMPL
,"IDirectSound8_VerifyCertification() failed: %08lx\n", rc
);
186 ref
=IDirectSound8_Release(dso
);
187 ok(ref
==0,"IDirectSound8_Release() has %d references, should have 0\n",ref
);
190 static void IDirectSound8_tests(void)
193 LPDIRECTSOUND8 dso
=NULL
;
194 LPCLASSFACTORY cf
=NULL
;
196 trace("Testing IDirectSound8\n");
198 rc
=CoGetClassObject(&CLSID_DirectSound8
, CLSCTX_INPROC_SERVER
, NULL
,
199 &IID_IClassFactory
, (void**)&cf
);
200 ok(rc
==S_OK
,"CoGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
201 "failed: %08lx\n", rc
);
203 rc
=CoGetClassObject(&CLSID_DirectSound8
, CLSCTX_INPROC_SERVER
, NULL
,
204 &IID_IUnknown
, (void**)&cf
);
205 ok(rc
==S_OK
,"CoGetClassObject(CLSID_DirectSound8, IID_IUnknown) "
206 "failed: %08lx\n", rc
);
208 /* try the COM class factory method of creation with no device specified */
209 rc
=CoCreateInstance(&CLSID_DirectSound8
, NULL
, CLSCTX_INPROC_SERVER
,
210 &IID_IDirectSound8
, (void**)&dso
);
211 ok(rc
==S_OK
||rc
==REGDB_E_CLASSNOTREG
,"CoCreateInstance() failed: %08lx\n", rc
);
212 if (rc
==REGDB_E_CLASSNOTREG
) {
213 trace(" Class Not Registered\n");
217 IDirectSound8_test(dso
, FALSE
, NULL
);
219 /* try the COM class factory method of creation with default playback
220 * device specified */
221 rc
=CoCreateInstance(&CLSID_DirectSound8
, NULL
, CLSCTX_INPROC_SERVER
,
222 &IID_IDirectSound8
, (void**)&dso
);
223 ok(rc
==S_OK
,"CoCreateInstance(CLSID_DirectSound8) failed: %08lx\n", rc
);
225 IDirectSound8_test(dso
, FALSE
, &DSDEVID_DefaultPlayback
);
227 /* try the COM class factory method of creation with default voice
228 * playback device specified */
229 rc
=CoCreateInstance(&CLSID_DirectSound8
, NULL
, CLSCTX_INPROC_SERVER
,
230 &IID_IDirectSound8
, (void**)&dso
);
231 ok(rc
==S_OK
,"CoCreateInstance(CLSID_DirectSound8) failed: %08lx\n", rc
);
233 IDirectSound8_test(dso
, FALSE
, &DSDEVID_DefaultVoicePlayback
);
235 /* try the COM class factory method of creation with a bad
237 rc
=CoCreateInstance(&CLSID_DirectSound8
, NULL
, CLSCTX_INPROC_SERVER
,
238 &CLSID_DirectSoundPrivate
, (void**)&dso
);
239 ok(rc
==E_NOINTERFACE
,
240 "CoCreateInstance(CLSID_DirectSound8,CLSID_DirectSoundPrivate) "
241 "should have failed: %08lx\n",rc
);
243 /* try the COM class factory method of creation with a bad
244 * GUID and IID specified */
245 rc
=CoCreateInstance(&CLSID_DirectSoundPrivate
, NULL
, CLSCTX_INPROC_SERVER
,
246 &IID_IDirectSound8
, (void**)&dso
);
247 ok(rc
==REGDB_E_CLASSNOTREG
,
248 "CoCreateInstance(CLSID_DirectSoundPrivate,IID_IDirectSound8) "
249 "should have failed: %08lx\n",rc
);
251 /* try with no device specified */
252 rc
= DirectSoundCreate8(NULL
, &dso
, NULL
);
253 ok(rc
==S_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
||rc
==E_FAIL
,
254 "DirectSoundCreate8() failed: %08lx\n",rc
);
255 if (rc
==DS_OK
&& dso
)
256 IDirectSound8_test(dso
, TRUE
, NULL
);
258 /* try with default playback device specified */
259 rc
= DirectSoundCreate8(&DSDEVID_DefaultPlayback
, &dso
, NULL
);
260 ok(rc
==S_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
||rc
==E_FAIL
,
261 "DirectSoundCreate8() failed: %08lx\n",rc
);
262 if (rc
==DS_OK
&& dso
)
263 IDirectSound8_test(dso
, TRUE
, NULL
);
265 /* try with default voice playback device specified */
266 rc
= DirectSoundCreate8(&DSDEVID_DefaultVoicePlayback
, &dso
, NULL
);
267 ok(rc
==S_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
||rc
==E_FAIL
,
268 "DirectSoundCreate8() failed: %08lx\n",rc
);
269 if (rc
==DS_OK
&& dso
)
270 IDirectSound8_test(dso
, TRUE
, NULL
);
272 /* try with a bad device specified */
273 rc
= DirectSoundCreate8(&DSDEVID_DefaultVoiceCapture
, &dso
, NULL
);
274 ok(rc
==DSERR_NODRIVER
,"DirectSoundCreate8(DSDEVID_DefaultVoiceCapture) "
275 "should have failed: %08lx\n",rc
);
278 static HRESULT
test_dsound8(LPGUID lpGuid
)
281 LPDIRECTSOUND8 dso
=NULL
;
284 /* DSOUND: Error: Invalid interface buffer */
285 rc
= DirectSoundCreate8(lpGuid
, 0, NULL
);
286 ok(rc
==DSERR_INVALIDPARAM
,"DirectSoundCreate8() should have returned "
287 "DSERR_INVALIDPARAM, returned: %08lx\n",rc
);
289 /* Create the DirectSound8 object */
290 rc
= DirectSoundCreate8(lpGuid
, &dso
, NULL
);
291 ok(rc
==DS_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
||rc
==E_FAIL
,
292 "DirectSoundCreate8() failed: %08lx\n",rc
);
296 /* Try the enumerated device */
297 IDirectSound8_test(dso
, TRUE
, lpGuid
);
299 /* Try the COM class factory method of creation with enumerated device */
300 rc
=CoCreateInstance(&CLSID_DirectSound8
, NULL
, CLSCTX_INPROC_SERVER
,
301 &IID_IDirectSound8
, (void**)&dso
);
302 ok(rc
==S_OK
,"CoCreateInstance(CLSID_DirectSound) failed: %08lx\n", rc
);
304 IDirectSound8_test(dso
, FALSE
, lpGuid
);
306 /* Create a DirectSound8 object */
307 rc
= DirectSoundCreate8(lpGuid
, &dso
, NULL
);
308 ok(rc
==DS_OK
,"DirectSoundCreate8() failed: %08lx\n",rc
);
310 LPDIRECTSOUND8 dso1
=NULL
;
312 /* Create a second DirectSound8 object */
313 rc
= DirectSoundCreate8(lpGuid
, &dso1
, NULL
);
314 ok(rc
==DS_OK
,"DirectSoundCreate8() failed: %08lx\n",rc
);
316 /* Release the second DirectSound8 object */
317 ref
=IDirectSound8_Release(dso1
);
318 ok(ref
==0,"IDirectSound8_Release() has %d references, "
319 "should have 0\n",ref
);
320 ok(dso
!=dso1
,"DirectSound8 objects should be unique: "
321 "dso=%p,dso1=%p\n",dso
,dso1
);
324 /* Release the first DirectSound8 object */
325 ref
=IDirectSound8_Release(dso
);
326 ok(ref
==0,"IDirectSound8_Release() has %d references, should have 0\n",
329 return DSERR_GENERIC
;
333 /* Create a DirectSound8 object */
334 rc
= DirectSoundCreate8(lpGuid
, &dso
, NULL
);
335 ok(rc
==DS_OK
,"DirectSoundCreate8() failed: %08lx\n",rc
);
337 LPDIRECTSOUNDBUFFER secondary
;
338 DSBUFFERDESC bufdesc
;
341 init_format(&wfx
,WAVE_FORMAT_PCM
,11025,8,1);
342 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
343 bufdesc
.dwSize
=sizeof(bufdesc
);
344 bufdesc
.dwFlags
=DSBCAPS_GETCURRENTPOSITION2
| DSBCAPS_CTRL3D
;
345 bufdesc
.dwBufferBytes
=align(wfx
.nAvgBytesPerSec
*BUFFER_LEN
/1000,
347 bufdesc
.lpwfxFormat
=&wfx
;
348 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
349 ok(rc
==DS_OK
&& secondary
!=NULL
,
350 "IDirectSound8_CreateSoundBuffer() failed to create a secondary "
351 "buffer: %08lx\n",rc
);
352 if (rc
==DS_OK
&& secondary
!=NULL
) {
353 LPDIRECTSOUND3DBUFFER buffer3d
;
354 LPDIRECTSOUNDBUFFER8 buffer8
;
355 rc
=IDirectSoundBuffer_QueryInterface(secondary
,
356 &IID_IDirectSound3DBuffer
,
358 ok(rc
==DS_OK
&& buffer3d
!=NULL
,
359 "IDirectSound8_QueryInterface() failed: %08lx\n", rc
);
360 if (rc
==DS_OK
&& buffer3d
!=NULL
) {
361 ref
=IDirectSound3DBuffer_AddRef(buffer3d
);
362 ok(ref
==2,"IDirectSound3DBuffer_AddRef() has %d references, "
363 "should have 2\n",ref
);
365 rc
=IDirectSoundBuffer_QueryInterface(secondary
,
366 &IID_IDirectSoundBuffer8
,
368 if (rc
==DS_OK
&& buffer8
!=NULL
) {
369 ok(buffer8
==(IDirectSoundBuffer8
*)secondary
,
370 "IDirectSoundBuffer8 iface different from IDirectSoundBuffer.\n");
371 ref
=IDirectSoundBuffer8_AddRef(buffer8
);
372 ok(ref
==3,"IDirectSoundBuffer8_AddRef() has %d references, "
373 "should have 3\n",ref
);
375 ref
=IDirectSoundBuffer_AddRef(secondary
);
376 ok(ref
==4,"IDirectSoundBuffer_AddRef() has %d references, "
377 "should have 4\n",ref
);
379 /* release with buffer */
380 ref
=IDirectSound8_Release(dso
);
381 ok(ref
==0,"IDirectSound8_Release() has %d references, should have 0\n",
384 return DSERR_GENERIC
;
391 static HRESULT
test_primary8(LPGUID lpGuid
)
394 LPDIRECTSOUND8 dso
=NULL
;
395 LPDIRECTSOUNDBUFFER primary
=NULL
,second
=NULL
,third
=NULL
;
396 LPDIRECTSOUNDBUFFER8 pb8
= NULL
;
397 DSBUFFERDESC bufdesc
;
402 /* Create the DirectSound object */
403 rc
= DirectSoundCreate8(lpGuid
, &dso
, NULL
);
404 ok(rc
==DS_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
,
405 "DirectSoundCreate8() failed: %08lx\n",rc
);
409 /* Get the device capabilities */
410 ZeroMemory(&dscaps
, sizeof(dscaps
));
411 dscaps
.dwSize
=sizeof(dscaps
);
412 rc
=IDirectSound8_GetCaps(dso
,&dscaps
);
413 ok(rc
==DS_OK
,"IDirectSound8_GetCaps() failed: %08lx\n",rc
);
417 /* DSOUND: Error: Invalid buffer description pointer */
418 rc
=IDirectSound8_CreateSoundBuffer(dso
,0,0,NULL
);
419 ok(rc
==DSERR_INVALIDPARAM
,
420 "IDirectSound8_CreateSoundBuffer should have returned "
421 "DSERR_INVALIDPARAM, returned: %08lx\n",rc
);
423 /* DSOUND: Error: Invalid buffer description pointer */
424 rc
=IDirectSound8_CreateSoundBuffer(dso
,0,&primary
,NULL
);
425 ok(rc
==DSERR_INVALIDPARAM
&& primary
==0,
426 "IDirectSound8_CreateSoundBuffer() should have returned "
427 "DSERR_INVALIDPARAM, returned: rc=%08lx,dsbo=%p\n",
430 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
431 bufdesc
.dwSize
= sizeof(DSBUFFERDESC
);
433 /* DSOUND: Error: Invalid dsound buffer interface pointer */
434 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,0,NULL
);
435 ok(rc
==DSERR_INVALIDPARAM
&& primary
==0,
436 "IDirectSound8_CreateSoundBuffer() should have failed: rc=%08lx,"
437 "dsbo=%p\n",rc
,primary
);
439 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
441 /* DSOUND: Error: Invalid size */
442 /* DSOUND: Error: Invalid buffer description */
443 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&primary
,NULL
);
444 ok(rc
==DSERR_INVALIDPARAM
&& primary
==0,
445 "IDirectSound8_CreateSoundBuffer() should have failed: rc=%08lx,"
446 "primary=%p\n",rc
,primary
);
448 /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
449 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
450 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_PRIORITY
);
451 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
455 /* Testing the primary buffer */
457 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
458 bufdesc
.dwSize
=sizeof(bufdesc
);
459 bufdesc
.dwFlags
=DSBCAPS_PRIMARYBUFFER
|DSBCAPS_CTRLVOLUME
;
460 bufdesc
.lpwfxFormat
= &wfx
;
461 init_format(&wfx
,WAVE_FORMAT_PCM
,11025,8,2);
462 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&primary
,NULL
);
463 ok(rc
==DSERR_INVALIDPARAM
,"IDirectSound8_CreateSoundBuffer() should have "
464 "returned DSERR_INVALIDPARAM, returned: %08lx\n", rc
);
465 if (rc
==DS_OK
&& primary
!=NULL
)
466 IDirectSoundBuffer_Release(primary
);
469 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
470 bufdesc
.dwSize
=sizeof(bufdesc
);
471 bufdesc
.dwFlags
=DSBCAPS_PRIMARYBUFFER
|DSBCAPS_CTRLVOLUME
;
472 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&primary
,NULL
);
473 ok((rc
==DS_OK
&& primary
!=NULL
) || (rc
==DSERR_CONTROLUNAVAIL
),
474 "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: "
476 if (rc
==DSERR_CONTROLUNAVAIL
)
477 trace(" No Primary\n");
478 else if (rc
==DS_OK
&& primary
!=NULL
) {
481 /* Try to create a second primary buffer */
482 /* DSOUND: Error: The primary buffer already exists.
483 * Any changes made to the buffer description will be ignored. */
484 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&second
,NULL
);
485 ok(rc
==DS_OK
&& second
==primary
,
486 "IDirectSound8_CreateSoundBuffer() should have returned original "
487 "primary buffer: %08lx\n",rc
);
488 ref
=IDirectSoundBuffer_Release(second
);
489 ok(ref
==1,"IDirectSoundBuffer_Release() primary has %d references, "
490 "should have 1\n",ref
);
492 /* Try to duplicate a primary buffer */
493 /* DSOUND: Error: Can't duplicate primary buffers */
494 rc
=IDirectSound8_DuplicateSoundBuffer(dso
,primary
,&third
);
496 ok(rc
!=DS_OK
,"IDirectSound8_DuplicateSoundBuffer() primary buffer "
497 "should have failed %08lx\n",rc
);
499 /* Primary buffers don't have an IDirectSoundBuffer8 */
500 rc
= IDirectSoundBuffer_QueryInterface(primary
, &IID_IDirectSoundBuffer8
, (LPVOID
*)&pb8
);
501 ok(FAILED(rc
), "Primary buffer does have an IDirectSoundBuffer8: %08lx\n", rc
);
503 rc
=IDirectSoundBuffer_GetVolume(primary
,&vol
);
504 ok(rc
==DS_OK
,"IDirectSoundBuffer_GetVolume() failed: %08lx\n", rc
);
506 if (winetest_interactive
) {
507 trace("Playing a 5 seconds reference tone at the current volume.\n");
509 trace("(the current volume is %ld according to DirectSound)\n",
511 trace("All subsequent tones should be identical to this one.\n");
512 trace("Listen for stutter, changes in pitch, volume, etc.\n");
514 test_buffer8(dso
,&primary
,TRUE
,FALSE
,0,FALSE
,0,
515 winetest_interactive
&& !(dscaps
.dwFlags
& DSCAPS_EMULDRIVER
),
516 5.0,FALSE
,NULL
,FALSE
,FALSE
);
518 ref
=IDirectSoundBuffer_Release(primary
);
519 ok(ref
==0,"IDirectSoundBuffer_Release() primary has %d references, "
520 "should have 0\n",ref
);
523 /* Set the CooperativeLevel back to normal */
524 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
525 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_NORMAL
);
526 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
529 ref
=IDirectSound8_Release(dso
);
530 ok(ref
==0,"IDirectSound8_Release() has %d references, should have 0\n",ref
);
532 return DSERR_GENERIC
;
538 * Test the primary buffer at different formats while keeping the
539 * secondary buffer at a constant format.
541 static HRESULT
test_primary_secondary8(LPGUID lpGuid
)
544 LPDIRECTSOUND8 dso
=NULL
;
545 LPDIRECTSOUNDBUFFER primary
=NULL
,secondary
=NULL
;
546 DSBUFFERDESC bufdesc
;
548 WAVEFORMATEX wfx
, wfx2
;
552 /* Create the DirectSound object */
553 rc
= DirectSoundCreate8(lpGuid
, &dso
, NULL
);
554 ok(rc
==DS_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
,
555 "DirectSoundCreate8() failed: %08lx\n",rc
);
559 /* Get the device capabilities */
560 ZeroMemory(&dscaps
, sizeof(dscaps
));
561 dscaps
.dwSize
=sizeof(dscaps
);
562 rc
=IDirectSound8_GetCaps(dso
,&dscaps
);
563 ok(rc
==DS_OK
,"IDirectSound8_GetCaps() failed: %08lx\n",rc
);
567 /* We must call SetCooperativeLevel before creating primary buffer */
568 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
569 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_PRIORITY
);
570 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
574 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
575 bufdesc
.dwSize
=sizeof(bufdesc
);
576 bufdesc
.dwFlags
=DSBCAPS_PRIMARYBUFFER
;
577 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&primary
,NULL
);
578 ok(rc
==DS_OK
&& primary
!=NULL
,
579 "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer "
582 if (rc
==DS_OK
&& primary
!=NULL
) {
583 for (f
= 0; f
< ARRAY_SIZE(formats
); f
++) {
584 for (tag
= 0; tag
< ARRAY_SIZE(format_tags
); tag
++) {
585 /* if float, we only want to test 32-bit */
586 if ((format_tags
[tag
] == WAVE_FORMAT_IEEE_FLOAT
) && (formats
[f
][1] != 32))
589 /* We must call SetCooperativeLevel to be allowed to call
591 /* DSOUND: Setting DirectSound cooperative level to
593 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_PRIORITY
);
594 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
598 init_format(&wfx
,format_tags
[tag
],formats
[f
][0],formats
[f
][1],
601 rc
=IDirectSoundBuffer_SetFormat(primary
,&wfx
);
603 || rc
==DSERR_INVALIDPARAM
, /* 2003 */
604 "IDirectSoundBuffer_SetFormat(%s) failed: %08lx\n",
605 format_string(&wfx
), rc
);
607 /* There is no guarantee that SetFormat will actually change the
608 * format to what we asked for. It depends on what the soundcard
609 * supports. So we must re-query the format.
611 rc
=IDirectSoundBuffer_GetFormat(primary
,&wfx
,sizeof(wfx
),NULL
);
612 ok(rc
==DS_OK
,"IDirectSoundBuffer_GetFormat() failed: %08lx\n", rc
);
614 (wfx
.wFormatTag
!=wfx2
.wFormatTag
||
615 wfx
.nSamplesPerSec
!=wfx2
.nSamplesPerSec
||
616 wfx
.wBitsPerSample
!=wfx2
.wBitsPerSample
||
617 wfx
.nChannels
!=wfx2
.nChannels
)) {
618 trace("Requested primary format tag=0x%04x %ldx%dx%d "
619 "avg.B/s=%ld align=%d\n",
620 wfx2
.wFormatTag
,wfx2
.nSamplesPerSec
,wfx2
.wBitsPerSample
,
621 wfx2
.nChannels
,wfx2
.nAvgBytesPerSec
,wfx2
.nBlockAlign
);
622 trace("Got tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
623 wfx
.wFormatTag
,wfx
.nSamplesPerSec
,wfx
.wBitsPerSample
,
624 wfx
.nChannels
,wfx
.nAvgBytesPerSec
,wfx
.nBlockAlign
);
627 /* Set the CooperativeLevel back to normal */
628 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
629 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_NORMAL
);
630 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
632 init_format(&wfx2
,WAVE_FORMAT_PCM
,11025,16,2);
635 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
636 bufdesc
.dwSize
=sizeof(bufdesc
);
637 bufdesc
.dwFlags
=DSBCAPS_GETCURRENTPOSITION2
;
638 bufdesc
.dwBufferBytes
=align(wfx
.nAvgBytesPerSec
*BUFFER_LEN
/1000,
640 bufdesc
.lpwfxFormat
=&wfx2
;
641 if (winetest_interactive
) {
642 trace(" Testing a primary buffer at %ldx%dx%d (fmt=%d) with a "
643 "secondary buffer at %ldx%dx%d\n",
644 wfx
.nSamplesPerSec
,wfx
.wBitsPerSample
,wfx
.nChannels
,format_tags
[tag
],
645 wfx2
.nSamplesPerSec
,wfx2
.wBitsPerSample
,wfx2
.nChannels
);
647 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
648 ok(rc
==DS_OK
&& secondary
!=NULL
,
649 "IDirectSound_CreateSoundBuffer() failed to create a secondary "
650 "buffer %08lx\n",rc
);
652 if (rc
==DS_OK
&& secondary
!=NULL
) {
653 test_buffer8(dso
,&secondary
,FALSE
,FALSE
,0,FALSE
,0,
654 winetest_interactive
,1.0,FALSE
,NULL
,FALSE
,FALSE
);
656 ref
=IDirectSoundBuffer_Release(secondary
);
657 ok(ref
==0,"IDirectSoundBuffer_Release() has %d references, "
658 "should have 0\n",ref
);
663 ref
=IDirectSoundBuffer_Release(primary
);
664 ok(ref
==0,"IDirectSoundBuffer_Release() primary has %d references, "
665 "should have 0\n",ref
);
668 /* Set the CooperativeLevel back to normal */
669 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
670 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_NORMAL
);
671 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
674 ref
=IDirectSound8_Release(dso
);
675 ok(ref
==0,"IDirectSound8_Release() has %d references, should have 0\n",ref
);
677 return DSERR_GENERIC
;
682 static HRESULT
test_secondary8(LPGUID lpGuid
)
685 LPDIRECTSOUND8 dso
=NULL
;
686 LPDIRECTSOUNDBUFFER primary
=NULL
,secondary
=NULL
;
687 DSBUFFERDESC bufdesc
;
689 WAVEFORMATEX wfx
, wfx1
;
693 /* Create the DirectSound object */
694 rc
= DirectSoundCreate8(lpGuid
, &dso
, NULL
);
695 ok(rc
==DS_OK
||rc
==DSERR_NODRIVER
||rc
==DSERR_ALLOCATED
,
696 "DirectSoundCreate8() failed: %08lx\n",rc
);
700 /* Get the device capabilities */
701 ZeroMemory(&dscaps
, sizeof(dscaps
));
702 dscaps
.dwSize
=sizeof(dscaps
);
703 rc
=IDirectSound8_GetCaps(dso
,&dscaps
);
704 ok(rc
==DS_OK
,"IDirectSound8_GetCaps() failed: %08lx\n",rc
);
708 /* We must call SetCooperativeLevel before creating primary buffer */
709 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
710 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_PRIORITY
);
711 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
715 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
716 bufdesc
.dwSize
=sizeof(bufdesc
);
717 bufdesc
.dwFlags
=DSBCAPS_PRIMARYBUFFER
;
718 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&primary
,NULL
);
719 ok(rc
==DS_OK
&& primary
!=NULL
,
720 "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer "
723 if (rc
==DS_OK
&& primary
!=NULL
) {
724 rc
=IDirectSoundBuffer_GetFormat(primary
,&wfx1
,sizeof(wfx1
),NULL
);
725 ok(rc
==DS_OK
,"IDirectSoundBuffer8_Getformat() failed: %08lx\n", rc
);
729 for (f
= 0; f
< ARRAY_SIZE(formats
); f
++) {
730 for (tag
= 0; tag
< ARRAY_SIZE(format_tags
); tag
++) {
731 WAVEFORMATEXTENSIBLE wfxe
;
733 /* if float, we only want to test 32-bit */
734 if ((format_tags
[tag
] == WAVE_FORMAT_IEEE_FLOAT
) && (formats
[f
][1] != 32))
737 init_format(&wfx
,format_tags
[tag
],formats
[f
][0],formats
[f
][1],
740 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
741 bufdesc
.dwSize
=sizeof(bufdesc
);
742 bufdesc
.dwFlags
=DSBCAPS_GETCURRENTPOSITION2
;
743 bufdesc
.dwBufferBytes
=align(wfx
.nAvgBytesPerSec
*BUFFER_LEN
/1000,
745 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
746 ok(rc
==DSERR_INVALIDPARAM
,"IDirectSound8_CreateSoundBuffer() "
747 "should have returned DSERR_INVALIDPARAM, returned: %08lx\n", rc
);
748 if (rc
==DS_OK
&& secondary
!=NULL
)
749 IDirectSoundBuffer_Release(secondary
);
752 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
753 bufdesc
.dwSize
=sizeof(bufdesc
);
754 bufdesc
.dwFlags
=DSBCAPS_GETCURRENTPOSITION2
;
755 bufdesc
.dwBufferBytes
=align(wfx
.nAvgBytesPerSec
*BUFFER_LEN
/1000,
757 bufdesc
.lpwfxFormat
=&wfx
;
758 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
759 if (wfx
.wBitsPerSample
!= 8 && wfx
.wBitsPerSample
!= 16)
760 ok(((rc
== DSERR_CONTROLUNAVAIL
|| rc
== DSERR_INVALIDCALL
|| rc
== DSERR_INVALIDPARAM
/* 2003 */) && !secondary
)
761 || rc
== DS_OK
, /* driver dependent? */
762 "IDirectSound_CreateSoundBuffer() "
763 "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) "
764 "and NULL, returned: %08lx %p\n", rc
, secondary
);
766 ok(rc
==DS_OK
&& secondary
!=NULL
,
767 "IDirectSound_CreateSoundBuffer() failed to create a secondary "
768 "buffer %08lx\n",rc
);
770 IDirectSoundBuffer_Release(secondary
);
773 bufdesc
.lpwfxFormat
=(WAVEFORMATEX
*)&wfxe
;
775 wfxe
.Format
.wFormatTag
= WAVE_FORMAT_EXTENSIBLE
;
776 wfxe
.SubFormat
= (format_tags
[tag
] == WAVE_FORMAT_PCM
? KSDATAFORMAT_SUBTYPE_PCM
: KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
);
777 wfxe
.Format
.cbSize
= 1;
778 wfxe
.Samples
.wValidBitsPerSample
= wfx
.wBitsPerSample
;
779 wfxe
.dwChannelMask
= (wfx
.nChannels
== 1 ? KSAUDIO_SPEAKER_MONO
: KSAUDIO_SPEAKER_STEREO
);
781 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
782 ok(rc
==DSERR_INVALIDPARAM
&& !secondary
,
783 "IDirectSound_CreateSoundBuffer() returned: %08lx %p\n",
787 IDirectSoundBuffer_Release(secondary
);
791 wfxe
.Format
.cbSize
= sizeof(wfxe
) - sizeof(wfx
) + 1;
793 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
794 ok(((rc
==DSERR_CONTROLUNAVAIL
|| rc
==DSERR_INVALIDCALL
/* 2003 */ || rc
==DSERR_INVALIDPARAM
) && !secondary
)
795 || rc
==DS_OK
/* driver dependent? */,
796 "IDirectSound_CreateSoundBuffer() returned: %08lx %p\n",
800 IDirectSoundBuffer_Release(secondary
);
804 wfxe
.Format
.cbSize
= sizeof(wfxe
) - sizeof(wfx
);
805 wfxe
.SubFormat
= GUID_NULL
;
806 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
807 ok((rc
==DSERR_INVALIDPARAM
|| rc
==DSERR_INVALIDCALL
) && !secondary
,
808 "IDirectSound_CreateSoundBuffer() returned: %08lx %p\n",
812 IDirectSoundBuffer_Release(secondary
);
816 wfxe
.Format
.cbSize
= sizeof(wfxe
);
817 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
818 ok((rc
==DSERR_CONTROLUNAVAIL
|| rc
==DSERR_INVALIDCALL
|| rc
==DSERR_INVALIDPARAM
) && !secondary
,
819 "IDirectSound_CreateSoundBuffer() returned: %08lx %p\n",
823 IDirectSoundBuffer_Release(secondary
);
827 wfxe
.SubFormat
= (format_tags
[tag
] == WAVE_FORMAT_PCM
? KSDATAFORMAT_SUBTYPE_PCM
: KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
);
828 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
829 ok(rc
==DS_OK
&& secondary
,
830 "IDirectSound_CreateSoundBuffer() returned: %08lx %p\n",
834 IDirectSoundBuffer_Release(secondary
);
838 wfxe
.Format
.cbSize
= sizeof(wfxe
) + 1;
839 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
840 ok(((rc
==DSERR_CONTROLUNAVAIL
|| rc
==DSERR_INVALIDCALL
/* 2003 */ || rc
==DSERR_INVALIDPARAM
) && !secondary
)
841 || rc
==DS_OK
/* driver dependent? */,
842 "IDirectSound_CreateSoundBuffer() returned: %08lx %p\n",
846 IDirectSoundBuffer_Release(secondary
);
850 wfxe
.Format
.cbSize
= sizeof(wfxe
) - sizeof(wfx
);
851 ++wfxe
.Samples
.wValidBitsPerSample
;
852 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
853 ok(rc
==DSERR_INVALIDPARAM
&& !secondary
,
854 "IDirectSound_CreateSoundBuffer() returned: %08lx %p\n",
858 IDirectSoundBuffer_Release(secondary
);
861 --wfxe
.Samples
.wValidBitsPerSample
;
863 wfxe
.Samples
.wValidBitsPerSample
= 0;
864 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
865 ok(rc
==DS_OK
&& secondary
,
866 "IDirectSound_CreateSoundBuffer() returned: %08lx %p\n",
870 IDirectSoundBuffer_Release(secondary
);
873 wfxe
.Samples
.wValidBitsPerSample
= wfxe
.Format
.wBitsPerSample
;
875 rc
=IDirectSound8_CreateSoundBuffer(dso
,&bufdesc
,&secondary
,NULL
);
876 ok(rc
==DS_OK
&& secondary
!=NULL
,
877 "IDirectSound_CreateSoundBuffer() failed to create a secondary "
878 "buffer %08lx\n",rc
);
880 if (rc
==DS_OK
&& secondary
!=NULL
) {
881 if (winetest_interactive
) {
882 trace(" Testing a secondary buffer at %ldx%dx%d (fmt=%d) "
883 "with a primary buffer at %ldx%dx%d\n",
884 wfx
.nSamplesPerSec
,wfx
.wBitsPerSample
,wfx
.nChannels
,format_tags
[tag
],
885 wfx1
.nSamplesPerSec
,wfx1
.wBitsPerSample
,wfx1
.nChannels
);
887 test_buffer8(dso
,&secondary
,FALSE
,FALSE
,0,FALSE
,0,
888 winetest_interactive
,1.0,FALSE
,NULL
,FALSE
,FALSE
);
890 ref
=IDirectSoundBuffer_Release(secondary
);
891 ok(ref
==0,"IDirectSoundBuffer_Release() has %d references, "
892 "should have 0\n",ref
);
897 ref
=IDirectSoundBuffer_Release(primary
);
898 ok(ref
==0,"IDirectSoundBuffer_Release() primary has %d references, "
899 "should have 0\n",ref
);
902 /* Set the CooperativeLevel back to normal */
903 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
904 rc
=IDirectSound8_SetCooperativeLevel(dso
,get_hwnd(),DSSCL_NORMAL
);
905 ok(rc
==DS_OK
,"IDirectSound8_SetCooperativeLevel() failed: %08lx\n", rc
);
908 ref
=IDirectSound8_Release(dso
);
909 ok(ref
==0,"IDirectSound8_Release() has %d references, should have 0\n",ref
);
911 return DSERR_GENERIC
;
916 static BOOL WINAPI
dsenum_callback(LPGUID lpGuid
, LPCSTR lpcstrDescription
,
917 LPCSTR lpcstrModule
, LPVOID lpContext
)
920 trace("*** Testing %s - %s ***\n",lpcstrDescription
,lpcstrModule
);
921 rc
= test_dsound8(lpGuid
);
922 if (rc
== DSERR_NODRIVER
)
923 trace(" No Driver\n");
924 else if (rc
== DSERR_ALLOCATED
)
925 trace(" Already In Use\n");
926 else if (rc
== E_FAIL
)
927 trace(" No Device\n");
929 test_primary8(lpGuid
);
930 test_primary_secondary8(lpGuid
);
931 test_secondary8(lpGuid
);
937 static void dsound8_tests(void)
940 rc
= DirectSoundEnumerateA(dsenum_callback
, NULL
);
941 ok(rc
==DS_OK
,"DirectSoundEnumerateA() failed: %08lx\n",rc
);
944 static void test_hw_buffers(void)
947 IDirectSoundBuffer
*primary
, *primary2
, **secondaries
, *secondary
;
948 IDirectSoundBuffer8
*buf8
;
951 DSBUFFERDESC bufdesc
;
956 hr
= DirectSoundCreate8(NULL
, &ds
, NULL
);
957 ok(hr
== S_OK
|| hr
== DSERR_NODRIVER
|| hr
== DSERR_ALLOCATED
|| hr
== E_FAIL
,
958 "DirectSoundCreate8 failed: %08lx\n", hr
);
962 caps
.dwSize
= sizeof(caps
);
964 hr
= IDirectSound8_GetCaps(ds
, &caps
);
965 ok(hr
== S_OK
, "GetCaps failed: %08lx\n", hr
);
967 ok(caps
.dwPrimaryBuffers
== 1, "Got wrong number of primary buffers: %lu\n",
968 caps
.dwPrimaryBuffers
);
970 /* DSBCAPS_LOC* is ignored for primary buffers */
971 bufdesc
.dwSize
= sizeof(bufdesc
);
972 bufdesc
.dwFlags
= DSBCAPS_GETCURRENTPOSITION2
| DSBCAPS_LOCHARDWARE
|
973 DSBCAPS_PRIMARYBUFFER
;
974 bufdesc
.dwBufferBytes
= 0;
975 bufdesc
.dwReserved
= 0;
976 bufdesc
.lpwfxFormat
= NULL
;
977 bufdesc
.guid3DAlgorithm
= GUID_NULL
;
979 hr
= IDirectSound8_CreateSoundBuffer(ds
, &bufdesc
, &primary
, NULL
);
980 ok(hr
== S_OK
, "CreateSoundBuffer failed: %08lx\n", hr
);
982 IDirectSound8_Release(ds
);
986 bufdesc
.dwFlags
= DSBCAPS_GETCURRENTPOSITION2
| DSBCAPS_LOCSOFTWARE
|
987 DSBCAPS_PRIMARYBUFFER
;
989 hr
= IDirectSound8_CreateSoundBuffer(ds
, &bufdesc
, &primary2
, NULL
);
990 ok(hr
== S_OK
, "CreateSoundBuffer failed: %08lx\n", hr
);
991 ok(primary
== primary2
, "Got different primary buffers: %p, %p\n", primary
, primary2
);
993 IDirectSoundBuffer_Release(primary2
);
995 buf8
= (IDirectSoundBuffer8
*)0xDEADBEEF;
996 hr
= IDirectSoundBuffer_QueryInterface(primary
, &IID_IDirectSoundBuffer8
,
998 ok(hr
== E_NOINTERFACE
, "QueryInterface gave wrong failure: %08lx\n", hr
);
999 ok(buf8
== NULL
, "Pointer didn't get set to NULL\n");
1001 fmt
.wFormatTag
= WAVE_FORMAT_PCM
;
1003 fmt
.nSamplesPerSec
= 48000;
1004 fmt
.wBitsPerSample
= 16;
1005 fmt
.nBlockAlign
= fmt
.nChannels
* fmt
.wBitsPerSample
/ 8;
1006 fmt
.nAvgBytesPerSec
= fmt
.nBlockAlign
* fmt
.nSamplesPerSec
;
1009 bufdesc
.lpwfxFormat
= &fmt
;
1010 bufdesc
.dwBufferBytes
= fmt
.nSamplesPerSec
* fmt
.nBlockAlign
/ 10;
1011 bufdesc
.dwFlags
= DSBCAPS_GETCURRENTPOSITION2
| DSBCAPS_LOCHARDWARE
|
1014 secondaries
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
1015 sizeof(IDirectSoundBuffer
*) * caps
.dwMaxHwMixingAllBuffers
);
1017 /* try to fill all of the hw buffers */
1018 trace("dwMaxHwMixingAllBuffers: %lu\n", caps
.dwMaxHwMixingAllBuffers
);
1019 trace("dwMaxHwMixingStaticBuffers: %lu\n", caps
.dwMaxHwMixingStaticBuffers
);
1020 trace("dwMaxHwMixingStreamingBuffers: %lu\n", caps
.dwMaxHwMixingStreamingBuffers
);
1021 for(i
= 0; i
< caps
.dwMaxHwMixingAllBuffers
; ++i
){
1022 hr
= IDirectSound8_CreateSoundBuffer(ds
, &bufdesc
, &secondaries
[i
], NULL
);
1023 ok(hr
== S_OK
|| hr
== E_NOTIMPL
|| broken(hr
== DSERR_CONTROLUNAVAIL
) || broken(hr
== E_FAIL
),
1024 "CreateSoundBuffer(%u) failed: %08lx\n", i
, hr
);
1028 bufcaps
.dwSize
= sizeof(bufcaps
);
1029 hr
= IDirectSoundBuffer_GetCaps(secondaries
[i
], &bufcaps
);
1030 ok(hr
== S_OK
, "GetCaps failed: %08lx\n", hr
);
1031 ok((bufcaps
.dwFlags
& DSBCAPS_LOCHARDWARE
) != 0,
1032 "Buffer wasn't allocated in hardware, dwFlags: %lx\n", bufcaps
.dwFlags
);
1035 /* see if we can create one more */
1036 hr
= IDirectSound8_CreateSoundBuffer(ds
, &bufdesc
, &secondary
, NULL
);
1037 ok((i
== caps
.dwMaxHwMixingAllBuffers
&& hr
== DSERR_ALLOCATED
) || /* out of hw buffers */
1038 (caps
.dwMaxHwMixingAllBuffers
== 0 && hr
== DSERR_INVALIDCALL
) || /* no hw buffers at all */
1039 hr
== E_NOTIMPL
|| /* don't support hw buffers */
1040 broken(hr
== DSERR_CONTROLUNAVAIL
) || /* vmware winxp, others? */
1041 broken(hr
== E_FAIL
) || /* broken AC97 driver */
1042 broken(hr
== S_OK
) /* broken driver allows more hw bufs than dscaps claims */,
1043 "CreateSoundBuffer(%u) gave wrong error: %08lx\n", i
, hr
);
1045 IDirectSoundBuffer_Release(secondary
);
1047 for(i
= 0; i
< caps
.dwMaxHwMixingAllBuffers
; ++i
)
1049 IDirectSoundBuffer_Release(secondaries
[i
]);
1051 HeapFree(GetProcessHeap(), 0, secondaries
);
1053 IDirectSoundBuffer_Release(primary
);
1054 IDirectSound8_Release(ds
);
1060 } default_info
= { 0 };
1062 static BOOL WINAPI
default_device_cb(GUID
*guid
, const char *desc
,
1063 const char *module
, void *user
)
1065 trace("guid: %p, desc: %s\n", guid
, desc
);
1067 ok(default_info
.dev_count
== 0, "Got NULL GUID not in first position\n");
1069 if(default_info
.dev_count
== 0){
1070 ok(IsEqualGUID(guid
, &default_info
.guid
), "Expected default device GUID\n");
1072 ok(!IsEqualGUID(guid
, &default_info
.guid
), "Got default GUID at unexpected location: %u\n",
1073 default_info
.dev_count
);
1076 /* only count real devices */
1077 ++default_info
.dev_count
;
1083 static void test_first_device(void)
1085 IMMDeviceEnumerator
*devenum
;
1091 hr
= CoCreateInstance(&CLSID_MMDeviceEnumerator
, NULL
,
1092 CLSCTX_INPROC_SERVER
, &IID_IMMDeviceEnumerator
, (void**)&devenum
);
1094 win_skip("MMDevAPI is not available, skipping default device test\n");
1098 hr
= IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum
, eRender
,
1099 eMultimedia
, &defdev
);
1100 if (hr
== E_NOTFOUND
) {
1101 win_skip("No default device found\n");
1104 ok(hr
== S_OK
, "GetDefaultAudioEndpoint failed: %08lx\n", hr
);
1106 hr
= IMMDevice_OpenPropertyStore(defdev
, STGM_READ
, &ps
);
1107 ok(hr
== S_OK
, "OpenPropertyStore failed: %08lx\n", hr
);
1109 PropVariantInit(&pv
);
1111 hr
= IPropertyStore_GetValue(ps
, &PKEY_AudioEndpoint_GUID
, &pv
);
1112 ok(hr
== S_OK
, "GetValue failed: %08lx\n", hr
);
1114 CLSIDFromString(pv
.pwszVal
, &default_info
.guid
);
1116 PropVariantClear(&pv
);
1117 IPropertyStore_Release(ps
);
1118 IMMDevice_Release(defdev
);
1119 IMMDeviceEnumerator_Release(devenum
);
1121 hr
= DirectSoundEnumerateA(default_device_cb
, NULL
);
1122 ok(hr
== S_OK
, "DirectSoundEnumerateA failed: %08lx\n", hr
);
1125 static void test_COM(void)
1128 IDirectSound8
*ds8
= (IDirectSound8
*)0xdeadbeef;
1129 IUnknown
*unk
, *unk8
;
1133 /* COM aggregation */
1134 hr
= CoCreateInstance(&CLSID_DirectSound8
, (IUnknown
*)0xdeadbeef, CLSCTX_INPROC_SERVER
,
1135 &IID_IUnknown
, (void**)&ds8
);
1136 ok(hr
== CLASS_E_NOAGGREGATION
,
1137 "DirectSound create failed: %08lx, expected CLASS_E_NOAGGREGATION\n", hr
);
1138 ok(!ds8
, "ds8 = %p\n", ds8
);
1141 hr
= CoCreateInstance(&CLSID_DirectSound8
, NULL
, CLSCTX_INPROC_SERVER
,
1142 &IID_IDirectSound3DBuffer
, (void**)&ds8
);
1143 ok(hr
== E_NOINTERFACE
,
1144 "DirectSound create failed: %08lx, expected E_NOINTERFACE\n", hr
);
1146 /* Same refcount for IDirectSound and IDirectSound8 */
1147 hr
= CoCreateInstance(&CLSID_DirectSound8
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IDirectSound8
,
1149 ok(hr
== S_OK
, "DirectSound create failed: %08lx, expected S_OK\n", hr
);
1150 refcount
= IDirectSound8_AddRef(ds8
);
1151 ok(refcount
== 2, "refcount == %lu, expected 2\n", refcount
);
1152 hr
= IDirectSound8_QueryInterface(ds8
, &IID_IDirectSound
, (void**)&ds
);
1153 ok(hr
== S_OK
, "QueryInterface for IID_IDirectSound failed: %08lx\n", hr
);
1154 refcount
= IDirectSound8_AddRef(ds8
);
1155 ok(refcount
== 4, "refcount == %lu, expected 4\n", refcount
);
1156 refcount
= IDirectSound_AddRef(ds
);
1157 ok(refcount
== 5, "refcount == %lu, expected 5\n", refcount
);
1159 /* Separate refcount for IUnknown */
1160 hr
= IDirectSound_QueryInterface(ds
, &IID_IUnknown
, (void**)&unk
);
1161 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08lx\n", hr
);
1162 refcount
= IUnknown_AddRef(unk
);
1163 ok(refcount
== 2, "refcount == %lu, expected 2\n", refcount
);
1164 hr
= IDirectSound8_QueryInterface(ds8
, &IID_IUnknown
, (void**)&unk8
);
1165 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08lx\n", hr
);
1166 refcount
= IUnknown_AddRef(unk8
);
1167 ok(refcount
== 4, "refcount == %lu, expected 4\n", refcount
);
1168 refcount
= IDirectSound_AddRef(ds
);
1169 ok(refcount
== 6, "refcount == %lu, expected 6\n", refcount
);
1171 while (IDirectSound_Release(ds
));
1172 while (IUnknown_Release(unk
));
1175 static void test_primary_flags(void)
1179 IDirectSoundBuffer
*primary
= NULL
;
1180 IDirectSoundFXI3DL2Reverb
*reverb
;
1181 DSBUFFERDESC bufdesc
;
1184 /* Create a DirectSound8 object */
1185 rc
= DirectSoundCreate8(NULL
, &dso
, NULL
);
1186 ok(rc
== DS_OK
|| rc
==DSERR_NODRIVER
, "Failed: %08lx\n",rc
);
1191 rc
= IDirectSound8_SetCooperativeLevel(dso
, get_hwnd(), DSSCL_PRIORITY
);
1192 ok(rc
== DS_OK
,"Failed: %08lx\n", rc
);
1194 IDirectSound8_Release(dso
);
1198 dscaps
.dwSize
= sizeof(dscaps
);
1199 rc
= IDirectSound8_GetCaps(dso
, &dscaps
);
1200 ok(rc
== DS_OK
,"Failed: %08lx\n", rc
);
1201 trace("0x%lx\n", dscaps
.dwFlags
);
1203 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
1204 bufdesc
.dwSize
= sizeof(bufdesc
);
1205 bufdesc
.dwFlags
= DSBCAPS_PRIMARYBUFFER
| DSBCAPS_CTRLFX
;
1206 rc
= IDirectSound8_CreateSoundBuffer(dso
, &bufdesc
, &primary
, NULL
);
1207 ok(rc
== E_INVALIDARG
, "got %08lx\n", rc
);
1209 ZeroMemory(&bufdesc
, sizeof(bufdesc
));
1210 bufdesc
.dwSize
= sizeof(bufdesc
);
1211 bufdesc
.dwFlags
= DSBCAPS_PRIMARYBUFFER
| DSBCAPS_CTRL3D
;
1212 rc
= IDirectSound8_CreateSoundBuffer(dso
, &bufdesc
, &primary
, NULL
);
1213 ok((rc
== DS_OK
&& primary
!= NULL
), "Failed to create a primary buffer: %08lx\n", rc
);
1215 rc
= IDirectSoundBuffer_QueryInterface(primary
, &IID_IDirectSoundFXI3DL2Reverb
, (LPVOID
*)&reverb
);
1216 ok(rc
==E_NOINTERFACE
,"Failed: %08lx\n", rc
);
1218 IDirectSoundBuffer_Release(primary
);
1221 IDirectSound8_Release(dso
);
1224 static IMediaObject testdmo
;
1225 static IMediaObjectInPlace testdmo_inplace
;
1226 static LONG testdmo_refcount
;
1227 static WAVEFORMATEX testdmo_input_type
;
1228 static BOOL testdmo_input_type_set
, testdmo_output_type_set
;
1230 static unsigned int got_Discontinuity
;
1231 static HANDLE got_Process
;
1233 static HRESULT WINAPI
dmo_QueryInterface(IMediaObject
*iface
, REFIID iid
, void **out
)
1235 if (winetest_debug
> 1) trace("QueryInterface(%s)\n", wine_dbgstr_guid(iid
));
1237 if (IsEqualGUID(iid
, &IID_IMediaObject
))
1239 else if (IsEqualGUID(iid
, &IID_IMediaObjectInPlace
))
1240 *out
= &testdmo_inplace
;
1242 return E_NOINTERFACE
;
1244 IUnknown_AddRef((IUnknown
*)*out
);
1248 static ULONG WINAPI
dmo_AddRef(IMediaObject
*iface
)
1250 return InterlockedIncrement(&testdmo_refcount
);
1253 static ULONG WINAPI
dmo_Release(IMediaObject
*iface
)
1255 return InterlockedDecrement(&testdmo_refcount
);
1258 static HRESULT WINAPI
dmo_GetStreamCount(IMediaObject
*iface
, DWORD
*input
, DWORD
*output
)
1260 ok(0, "Unexpected call.\n");
1264 static HRESULT WINAPI
dmo_GetInputStreamInfo(IMediaObject
*iface
, DWORD index
, DWORD
*flags
)
1266 ok(0, "Unexpected call.\n");
1270 static HRESULT WINAPI
dmo_GetOutputStreamInfo(IMediaObject
*iface
, DWORD index
, DWORD
*flags
)
1272 ok(0, "Unexpected call.\n");
1276 static HRESULT WINAPI
dmo_GetInputType(IMediaObject
*iface
, DWORD index
, DWORD type_index
, DMO_MEDIA_TYPE
*type
)
1278 ok(0, "Unexpected call.\n");
1282 static HRESULT WINAPI
dmo_GetOutputType(IMediaObject
*iface
, DWORD index
, DWORD type_index
, DMO_MEDIA_TYPE
*type
)
1284 ok(0, "Unexpected call.\n");
1288 static HRESULT WINAPI
dmo_SetInputType(IMediaObject
*iface
, DWORD index
, const DMO_MEDIA_TYPE
*type
, DWORD flags
)
1290 const WAVEFORMATEX
*wfx
;
1292 if (winetest_debug
> 1) trace("SetInputType()\n");
1294 ok(!index
, "Got unexpected index %lu.\n", index
);
1295 ok(!flags
, "Got unexpected flags %#lx.\n", flags
);
1297 ok(IsEqualGUID(&type
->majortype
, &MEDIATYPE_Audio
), "Got major type %s.\n", debugstr_guid(&type
->majortype
));
1298 todo_wine
ok(IsEqualGUID(&type
->subtype
, &MEDIASUBTYPE_PCM
), "Got subtype %s.\n", debugstr_guid(&type
->subtype
));
1299 ok(type
->bFixedSizeSamples
== TRUE
, "Got fixed size %d.\n", type
->bFixedSizeSamples
);
1300 ok(!type
->bTemporalCompression
, "Got temporal compression %d.\n", type
->bTemporalCompression
);
1301 ok(IsEqualGUID(&type
->formattype
, &FORMAT_WaveFormatEx
), "Got format type %s.\n", debugstr_guid(&type
->formattype
));
1302 ok(!type
->pUnk
, "Got pUnk %p.\n", type
->pUnk
);
1303 ok(type
->cbFormat
== sizeof(WAVEFORMATEX
), "Got format size %lu.\n", type
->cbFormat
);
1305 wfx
= (WAVEFORMATEX
*)type
->pbFormat
;
1306 todo_wine
ok(type
->lSampleSize
== wfx
->nBlockAlign
, "Got sample size %lu.\n", type
->lSampleSize
);
1308 if (wfx
->wBitsPerSample
!= 8)
1309 return DMO_E_TYPE_NOT_ACCEPTED
;
1311 testdmo_input_type
= *wfx
;
1312 testdmo_input_type_set
= TRUE
;
1316 static HRESULT WINAPI
dmo_SetOutputType(IMediaObject
*iface
, DWORD index
, const DMO_MEDIA_TYPE
*type
, DWORD flags
)
1318 if (winetest_debug
> 1) trace("SetOutputType()\n");
1320 ok(!index
, "Got unexpected index %lu.\n", index
);
1321 ok(!flags
, "Got unexpected flags %#lx.\n", flags
);
1323 ok(testdmo_input_type_set
, "Expected the input type to be set.\n");
1325 ok(IsEqualGUID(&type
->majortype
, &MEDIATYPE_Audio
), "Got major type %s.\n", debugstr_guid(&type
->majortype
));
1326 ok(IsEqualGUID(&type
->subtype
, &MEDIASUBTYPE_PCM
), "Got subtype %s.\n", debugstr_guid(&type
->subtype
));
1327 ok(type
->bFixedSizeSamples
== TRUE
, "Got fixed size %d.\n", type
->bFixedSizeSamples
);
1328 ok(!type
->bTemporalCompression
, "Got temporal compression %d.\n", type
->bTemporalCompression
);
1329 ok(type
->lSampleSize
== 1, "Got sample size %lu.\n", type
->lSampleSize
);
1330 ok(IsEqualGUID(&type
->formattype
, &FORMAT_WaveFormatEx
), "Got format type %s.\n", debugstr_guid(&type
->formattype
));
1331 ok(!type
->pUnk
, "Got pUnk %p.\n", type
->pUnk
);
1332 ok(type
->cbFormat
== sizeof(WAVEFORMATEX
), "Got format size %lu.\n", type
->cbFormat
);
1334 ok(!memcmp(type
->pbFormat
, &testdmo_input_type
, sizeof(WAVEFORMATEX
)), "Format blocks didn't match.\n");
1336 testdmo_output_type_set
= TRUE
;
1340 static HRESULT WINAPI
dmo_GetInputCurrentType(IMediaObject
*iface
, DWORD index
, DMO_MEDIA_TYPE
*type
)
1342 ok(0, "Unexpected call.\n");
1346 static HRESULT WINAPI
dmo_GetOutputCurrentType(IMediaObject
*iface
, DWORD index
, DMO_MEDIA_TYPE
*type
)
1348 ok(0, "Unexpected call.\n");
1352 static HRESULT WINAPI
dmo_GetInputSizeInfo(IMediaObject
*iface
, DWORD index
,
1353 DWORD
*size
, DWORD
*lookahead
, DWORD
*alignment
)
1355 ok(0, "Unexpected call.\n");
1359 static HRESULT WINAPI
dmo_GetOutputSizeInfo(IMediaObject
*iface
, DWORD index
, DWORD
*size
, DWORD
*alignment
)
1361 ok(0, "Unexpected call.\n");
1365 static HRESULT WINAPI
dmo_GetInputMaxLatency(IMediaObject
*iface
, DWORD index
, REFERENCE_TIME
*latency
)
1367 ok(0, "Unexpected call.\n");
1371 static HRESULT WINAPI
dmo_SetInputMaxLatency(IMediaObject
*iface
, DWORD index
, REFERENCE_TIME latency
)
1373 ok(0, "Unexpected call.\n");
1377 static HRESULT WINAPI
dmo_Flush(IMediaObject
*iface
)
1379 ok(0, "Unexpected call.\n");
1383 static HRESULT WINAPI
dmo_Discontinuity(IMediaObject
*iface
, DWORD index
)
1385 if (winetest_debug
> 1) trace("Discontinuity()\n");
1386 ++got_Discontinuity
;
1390 static HRESULT WINAPI
dmo_AllocateStreamingResources(IMediaObject
*iface
)
1392 ok(0, "Unexpected call.\n");
1396 static HRESULT WINAPI
dmo_FreeStreamingResources(IMediaObject
*iface
)
1398 ok(0, "Unexpected call.\n");
1402 static HRESULT WINAPI
dmo_GetInputStatus(IMediaObject
*iface
, DWORD index
, DWORD
*flags
)
1404 ok(0, "Unexpected call.\n");
1408 static HRESULT WINAPI
dmo_ProcessInput(IMediaObject
*iface
, DWORD index
,
1409 IMediaBuffer
*buffer
, DWORD flags
, REFERENCE_TIME timestamp
, REFERENCE_TIME timelength
)
1411 ok(0, "Unexpected call.\n");
1415 static HRESULT WINAPI
dmo_ProcessOutput(IMediaObject
*iface
, DWORD flags
,
1416 DWORD count
, DMO_OUTPUT_DATA_BUFFER
*buffers
, DWORD
*status
)
1418 ok(0, "Unexpected call.\n");
1422 static HRESULT WINAPI
dmo_Lock(IMediaObject
*iface
, LONG lock
)
1424 ok(0, "Unexpected call.\n");
1428 static const IMediaObjectVtbl dmo_vtbl
=
1434 dmo_GetInputStreamInfo
,
1435 dmo_GetOutputStreamInfo
,
1440 dmo_GetInputCurrentType
,
1441 dmo_GetOutputCurrentType
,
1442 dmo_GetInputSizeInfo
,
1443 dmo_GetOutputSizeInfo
,
1444 dmo_GetInputMaxLatency
,
1445 dmo_SetInputMaxLatency
,
1448 dmo_AllocateStreamingResources
,
1449 dmo_FreeStreamingResources
,
1456 static HRESULT WINAPI
dmo_inplace_QueryInterface(IMediaObjectInPlace
*iface
, REFIID iid
, void **out
)
1458 return IMediaObject_QueryInterface(&testdmo
, iid
, out
);
1461 static ULONG WINAPI
dmo_inplace_AddRef(IMediaObjectInPlace
*iface
)
1463 return IMediaObject_AddRef(&testdmo
);
1466 static ULONG WINAPI
dmo_inplace_Release(IMediaObjectInPlace
*iface
)
1468 return IMediaObject_Release(&testdmo
);
1471 static HRESULT WINAPI
dmo_inplace_Process(IMediaObjectInPlace
*iface
, ULONG size
,
1472 BYTE
*data
, REFERENCE_TIME start
, DWORD flags
)
1474 if (winetest_debug
> 1) trace("Process(size %lu)\n", size
);
1476 ok(!start
, "Got start time %s.\n", wine_dbgstr_longlong(start
));
1477 ok(!flags
, "Got flags %#lx.\n", flags
);
1479 SetEvent(got_Process
);
1484 static HRESULT WINAPI
dmo_inplace_Clone(IMediaObjectInPlace
*iface
, IMediaObjectInPlace
**ret_dmo
)
1486 ok(0, "Unexpected call.\n");
1490 static HRESULT WINAPI
dmo_inplace_GetLatency(IMediaObjectInPlace
*iface
, REFERENCE_TIME
*latency
)
1492 ok(0, "Unexpected call.\n");
1496 static const IMediaObjectInPlaceVtbl dmo_inplace_vtbl
=
1498 dmo_inplace_QueryInterface
,
1500 dmo_inplace_Release
,
1501 dmo_inplace_Process
,
1503 dmo_inplace_GetLatency
,
1506 static IMediaObject testdmo
= {&dmo_vtbl
};
1507 static IMediaObjectInPlace testdmo_inplace
= {&dmo_inplace_vtbl
};
1509 static HRESULT WINAPI
dmo_cf_QueryInterface(IClassFactory
*iface
, REFIID iid
, void **out
)
1511 if (IsEqualGUID(iid
, &IID_IUnknown
) || IsEqualGUID(iid
, &IID_IClassFactory
))
1516 return E_NOINTERFACE
;
1519 static ULONG WINAPI
dmo_cf_AddRef(IClassFactory
*iface
)
1524 static ULONG WINAPI
dmo_cf_Release(IClassFactory
*iface
)
1529 static HRESULT WINAPI
dmo_cf_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID iid
, void **out
)
1531 ok(!outer
, "Unexpected outer parameter.\n");
1532 ok(IsEqualGUID(iid
, &IID_IMediaObject
), "Got unexpected iid %s.\n", wine_dbgstr_guid(iid
));
1535 IMediaObject_AddRef(&testdmo
);
1539 static HRESULT WINAPI
dmo_cf_LockServer(IClassFactory
*iface
, BOOL lock
)
1541 ok(0, "Unexpected call.\n");
1545 static const IClassFactoryVtbl dmo_cf_vtbl
=
1547 dmo_cf_QueryInterface
,
1550 dmo_cf_CreateInstance
,
1554 static IClassFactory testdmo_cf
= {&dmo_cf_vtbl
};
1556 static void test_effects(void)
1558 DSBPOSITIONNOTIFY notify_params
= {DSBPN_OFFSETSTOP
, CreateEventA(NULL
, TRUE
, FALSE
, NULL
)};
1559 DSBUFFERDESC buffer_desc
= {.dwSize
= sizeof(buffer_desc
)};
1560 IMediaObject
*echo
= NULL
, *reverb
= NULL
;
1561 IDirectSoundBuffer8
*buffer8
;
1562 DSEFFECTDESC effects
[2] = {};
1563 IDirectSoundBuffer
*buffer
;
1564 IDirectSoundNotify
*notify
;
1565 IDirectSound8
*dsound
;
1575 hr
= DirectSoundCreate8(NULL
, &dsound
, NULL
);
1576 ok(hr
== DS_OK
|| hr
== DSERR_NODRIVER
, "Got hr %#lx.\n", hr
);
1580 hr
= IDirectSound8_SetCooperativeLevel(dsound
, get_hwnd(), DSSCL_PRIORITY
);
1581 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1583 effects
[0].dwSize
= effects
[1].dwSize
= sizeof(effects
[0]);
1584 effects
[0].guidDSFXClass
= GUID_DSFX_STANDARD_PARAMEQ
;
1586 init_format(&wfx
, WAVE_FORMAT_PCM
, 11025, 8, 1);
1587 buffer_desc
.dwBufferBytes
= align(wfx
.nAvgBytesPerSec
* BUFFER_LEN
/ 1000, wfx
.nBlockAlign
);
1588 buffer_desc
.lpwfxFormat
= &wfx
;
1589 hr
= IDirectSound8_CreateSoundBuffer(dsound
, &buffer_desc
, &buffer
, NULL
);
1590 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1591 hr
= IDirectSoundBuffer_QueryInterface(buffer
, &IID_IDirectSoundBuffer8
, (void **)&buffer8
);
1592 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1593 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, effects
, results
);
1594 ok(hr
== DSERR_CONTROLUNAVAIL
, "Got hr %#lx.\n", hr
);
1596 IDirectSoundBuffer8_Release(buffer8
);
1597 IDirectSoundBuffer_Release(buffer
);
1599 buffer_desc
.dwFlags
= DSBCAPS_CTRLFX
| DSBCAPS_CTRLPOSITIONNOTIFY
;
1600 hr
= IDirectSound8_CreateSoundBuffer(dsound
, &buffer_desc
, &buffer
, NULL
);
1601 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1602 hr
= IDirectSoundBuffer_QueryInterface(buffer
, &IID_IDirectSoundBuffer8
, (void **)&buffer8
);
1603 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1604 hr
= IDirectSoundBuffer8_QueryInterface(buffer
, &IID_IDirectSoundNotify
, (void **)¬ify
);
1605 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1607 hr
= IDirectSoundNotify_SetNotificationPositions(notify
, 1, ¬ify_params
);
1608 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1610 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, NULL
, NULL
);
1611 ok(hr
== DSERR_INVALIDPARAM
, "Got hr %#lx.\n", hr
);
1612 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 0, effects
, NULL
);
1613 ok(hr
== DSERR_INVALIDPARAM
, "Got hr %#lx.\n", hr
);
1614 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 0, NULL
, results
);
1615 ok(hr
== DSERR_INVALIDPARAM
, "Got hr %#lx.\n", hr
);
1617 results
[0] = 0xdeadbeef;
1618 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, effects
, results
);
1619 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1620 ok(results
[0] == DSFXR_LOCSOFTWARE
, "Got result %#lx.\n", results
[0]);
1622 hr
= IDirectSoundBuffer8_Lock(buffer8
, 0, 0, &ptr1
, &size1
, &ptr2
, &size2
, DSBLOCK_ENTIREBUFFER
);
1623 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1624 results
[0] = 0xdeadbeef;
1625 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, effects
, results
);
1626 ok(hr
== DSERR_INVALIDCALL
, "Got hr %#lx.\n", hr
);
1627 todo_wine
ok(results
[0] == 0xdeadbeef, "Got result %#lx.\n", results
[0]);
1628 hr
= IDirectSoundBuffer8_Unlock(buffer8
, ptr1
, size1
, ptr2
, size2
);
1629 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1631 hr
= IDirectSoundBuffer8_Play(buffer8
, 0, 0, DSBPLAY_LOOPING
);
1632 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1633 results
[0] = 0xdeadbeef;
1634 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, effects
, results
);
1635 ok(hr
== DSERR_INVALIDCALL
, "Got hr %#lx.\n", hr
);
1636 todo_wine
ok(results
[0] == 0xdeadbeef, "Got result %#lx.\n", results
[0]);
1637 hr
= IDirectSoundBuffer8_Stop(buffer8
);
1638 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1639 ok(!WaitForSingleObject(notify_params
.hEventNotify
, 1000), "Wait timed out.\n");
1641 effects
[0].guidDSFXClass
= GUID_NULL
;
1642 results
[0] = 0xdeadbeef;
1643 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, effects
, results
);
1644 ok(hr
== REGDB_E_CLASSNOTREG
, "Got hr %#lx.\n", hr
);
1645 ok(results
[0] == DSFXR_UNKNOWN
, "Got result %#lx.\n", results
[0]);
1647 effects
[0].guidDSFXClass
= GUID_DSFX_STANDARD_PARAMEQ
;
1648 results
[0] = 0xdeadbeef;
1649 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, effects
, results
);
1650 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1651 ok(results
[0] == DSFXR_LOCSOFTWARE
, "Got result %#lx.\n", results
[0]);
1653 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0, &IID_IMediaObject
, NULL
);
1654 ok(hr
== DSERR_INVALIDPARAM
, "Got hr %#lx.\n", hr
);
1656 dmo
= (IMediaObject
*)0xdeadbeef;
1657 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0, &GUID_NULL
, (void **)&dmo
);
1658 ok(hr
== E_NOINTERFACE
, "Got hr %#lx.\n", hr
);
1659 ok(!dmo
, "Got object %p.\n", dmo
);
1661 dmo
= (IMediaObject
*)0xdeadbeef;
1662 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_NULL
, 0, &IID_IMediaObject
, (void **)&dmo
);
1663 ok(hr
== DSERR_OBJECTNOTFOUND
, "Got hr %#lx.\n", hr
);
1664 ok(dmo
== (IMediaObject
*)0xdeadbeef, "Got object %p.\n", dmo
);
1667 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0, &IID_IMediaObject
, (void **)&dmo
);
1668 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1669 ok(!!dmo
, "Expected a non-NULL object.\n");
1670 IMediaObject_Release(dmo
);
1673 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_DSFX_STANDARD_PARAMEQ
, 0, &IID_IMediaObject
, (void **)&dmo
);
1674 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1675 ok(!!dmo
, "Expected a non-NULL object.\n");
1676 IMediaObject_Release(dmo
);
1678 dmo
= (IMediaObject
*)0xdeadbeef;
1679 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 1, &IID_IMediaObject
, (void **)&dmo
);
1680 ok(hr
== DSERR_OBJECTNOTFOUND
, "Got hr %#lx.\n", hr
);
1681 ok(dmo
== (IMediaObject
*)0xdeadbeef, "Got object %p.\n", dmo
);
1683 effects
[0].guidDSFXClass
= GUID_DSFX_STANDARD_PARAMEQ
;
1684 effects
[1].guidDSFXClass
= GUID_NULL
;
1685 results
[0] = results
[1] = 0xdeadbeef;
1686 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 2, effects
, results
);
1687 ok(hr
== REGDB_E_CLASSNOTREG
, "Got hr %#lx.\n", hr
);
1688 ok(results
[0] == DSFXR_PRESENT
, "Got result %#lx.\n", results
[0]);
1689 ok(results
[1] == DSFXR_UNKNOWN
, "Got result %#lx.\n", results
[1]);
1691 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0, &IID_IMediaObject
, (void **)&dmo
);
1692 todo_wine
ok(hr
== DSERR_OBJECTNOTFOUND
, "Got hr %#lx.\n", hr
);
1694 effects
[0].guidDSFXClass
= GUID_DSFX_STANDARD_PARAMEQ
;
1695 effects
[1].guidDSFXClass
= GUID_DSFX_STANDARD_I3DL2REVERB
;
1696 results
[0] = results
[1] = 0xdeadbeef;
1697 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 2, effects
, results
);
1698 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1699 ok(results
[0] == DSFXR_LOCSOFTWARE
, "Got result %#lx.\n", results
[0]);
1700 ok(results
[1] == DSFXR_LOCSOFTWARE
, "Got result %#lx.\n", results
[1]);
1702 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_DSFX_STANDARD_PARAMEQ
, 0, &IID_IMediaObject
, (void **)&dmo
);
1703 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1705 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
,
1706 &GUID_DSFX_STANDARD_I3DL2REVERB
, 0, &IID_IMediaObject
, (void **)&dmo
);
1707 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1710 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0, &IID_IMediaObject
, (void **)&dmo
);
1711 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1712 ok(dmo
== echo
, "Expected %p, got %p.\n", echo
, dmo
);
1713 IMediaObject_Release(dmo
);
1715 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 1, &IID_IMediaObject
, (void **)&dmo
);
1716 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1717 ok(dmo
== reverb
, "Expected %p, got %p.\n", reverb
, dmo
);
1718 IMediaObject_Release(dmo
);
1720 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
,
1721 &GUID_DSFX_STANDARD_I3DL2REVERB
, 1, &IID_IMediaObject
, (void **)&dmo
);
1722 ok(hr
== DSERR_OBJECTNOTFOUND
, "Got hr %#lx.\n", hr
);
1724 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0, &IID_IDirectSoundFXParamEq
, (void **)&unk
);
1725 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1726 IUnknown_Release(unk
);
1728 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0,
1729 &IID_IDirectSoundFXParamEq
, (void **)&unk
);
1730 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1731 IUnknown_Release(unk
);
1733 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0,
1734 &IID_IDirectSoundFXI3DL2Reverb
, (void **)&unk
);
1735 ok(hr
== E_NOINTERFACE
, "Got hr %#lx.\n", hr
);
1737 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 1,
1738 &IID_IDirectSoundFXI3DL2Reverb
, (void **)&unk
);
1739 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1740 IUnknown_Release(unk
);
1742 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
,
1743 &GUID_DSFX_STANDARD_I3DL2REVERB
, 0, &IID_IDirectSoundFXI3DL2Reverb
, (void **)&unk
);
1744 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1745 IUnknown_Release(unk
);
1747 IMediaObject_Release(echo
);
1748 IMediaObject_Release(reverb
);
1750 got_Process
= CreateEventA(NULL
, TRUE
, FALSE
, NULL
);
1752 effects
[0].guidDSFXClass
= testdmo_clsid
;
1753 results
[0] = 0xdeadbeef;
1754 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, effects
, results
);
1755 todo_wine
ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1756 todo_wine
ok(results
[0] == DSFXR_LOCSOFTWARE
, "Got result %#lx.\n", results
[0]);
1757 todo_wine
ok(!memcmp(&testdmo_input_type
, &wfx
, sizeof(WAVEFORMATEX
)), "Format blocks didn't match.\n");
1759 ResetEvent(notify_params
.hEventNotify
);
1760 hr
= IDirectSoundBuffer8_Play(buffer8
, 0, 0, 0);
1761 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1762 todo_wine
ok(got_Discontinuity
== 1, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity
);
1764 todo_wine
ok(!WaitForSingleObject(got_Process
, 100), "Wait timed out.\n");
1766 hr
= IDirectSoundBuffer8_Stop(buffer8
);
1767 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1768 todo_wine
ok(got_Discontinuity
== 1, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity
);
1769 ok(!WaitForSingleObject(notify_params
.hEventNotify
, 1000), "Wait timed out.\n");
1771 ResetEvent(notify_params
.hEventNotify
);
1772 hr
= IDirectSoundBuffer8_Play(buffer8
, 0, 0, 0);
1773 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1774 todo_wine
ok(got_Discontinuity
== 2, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity
);
1776 hr
= IDirectSoundBuffer8_Stop(buffer8
);
1777 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1778 ok(!WaitForSingleObject(notify_params
.hEventNotify
, 1000), "Wait timed out.\n");
1780 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 0, NULL
, NULL
);
1781 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1783 hr
= IDirectSoundBuffer8_GetObjectInPath(buffer8
, &GUID_All_Objects
, 0, &IID_IMediaObject
, (void **)&dmo
);
1784 ok(hr
== DSERR_OBJECTNOTFOUND
, "Got hr %#lx.\n", hr
);
1786 CloseHandle(got_Process
);
1787 IDirectSoundBuffer8_Release(buffer8
);
1788 ref
= IDirectSoundBuffer_Release(buffer
);
1789 ok(!ref
, "Got outstanding refcount %lu.\n", ref
);
1791 init_format(&wfx
, WAVE_FORMAT_PCM
, 11025, 16, 1);
1792 hr
= IDirectSound8_CreateSoundBuffer(dsound
, &buffer_desc
, &buffer
, NULL
);
1793 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1794 hr
= IDirectSoundBuffer_QueryInterface(buffer
, &IID_IDirectSoundBuffer8
, (void **)&buffer8
);
1795 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1797 results
[0] = 0xdeadbeef;
1798 hr
= IDirectSoundBuffer8_SetFX(buffer8
, 1, effects
, results
);
1799 ok(hr
== DMO_E_TYPE_NOT_ACCEPTED
, "Got hr %#lx.\n", hr
);
1800 todo_wine
ok(results
[0] == DSFXR_UNKNOWN
, "Got result %#lx.\n", results
[0]);
1802 IDirectSoundNotify_Release(notify
);
1803 IDirectSoundBuffer8_Release(buffer8
);
1804 ref
= IDirectSoundBuffer_Release(buffer
);
1805 ok(!ref
, "Got outstanding refcount %lu.\n", ref
);
1807 ref
= IDirectSound8_Release(dsound
);
1808 ok(!ref
, "Got outstanding refcount %lu.\n", ref
);
1811 static void test_AcquireResources(void)
1813 IDirectSound8
*dsound
;
1814 IDirectSoundBuffer
*primary
, *secondary
;
1815 DSBUFFERDESC bufdesc
;
1819 hr
= DirectSoundCreate8(NULL
, &dsound
, NULL
);
1820 ok(hr
== DS_OK
|| hr
== DSERR_NODRIVER
, "Got hr %#lx.\n", hr
);
1824 hr
= IDirectSound8_SetCooperativeLevel(dsound
, get_hwnd(), DSSCL_PRIORITY
);
1825 ok(hr
== DS_OK
, "Got hr %#lx.\n", hr
);
1827 bufdesc
.dwSize
= sizeof(bufdesc
);
1828 bufdesc
.dwFlags
= DSBCAPS_GETCURRENTPOSITION2
| DSBCAPS_PRIMARYBUFFER
;
1829 bufdesc
.dwBufferBytes
= 0;
1830 bufdesc
.dwReserved
= 0;
1831 bufdesc
.lpwfxFormat
= NULL
;
1832 bufdesc
.guid3DAlgorithm
= GUID_NULL
;
1834 hr
= IDirectSound8_CreateSoundBuffer(dsound
, &bufdesc
, &primary
, NULL
);
1835 ok(hr
== S_OK
, "CreateSoundBuffer failed: %08lx\n", hr
);
1837 IDirectSound_Release(dsound
);
1841 fmt
.wFormatTag
= WAVE_FORMAT_PCM
;
1843 fmt
.nSamplesPerSec
= 48000;
1844 fmt
.wBitsPerSample
= 16;
1845 fmt
.nBlockAlign
= fmt
.nChannels
* fmt
.wBitsPerSample
/ 8;
1846 fmt
.nAvgBytesPerSec
= fmt
.nBlockAlign
* fmt
.nSamplesPerSec
;
1849 bufdesc
.lpwfxFormat
= &fmt
;
1850 bufdesc
.dwBufferBytes
= fmt
.nSamplesPerSec
* fmt
.nBlockAlign
/ 10;
1851 bufdesc
.dwFlags
= DSBCAPS_LOCDEFER
| DSBCAPS_CTRLVOLUME
;
1853 /* see if we can create one more */
1854 hr
= IDirectSound8_CreateSoundBuffer(dsound
, &bufdesc
, &secondary
, NULL
);
1855 ok(hr
== S_OK
, "CreateSoundBuffer gave wrong error: %08lx\n", hr
);
1858 IDirectSoundBuffer8
*buffer8
;
1860 hr
= IDirectSoundBuffer_QueryInterface(secondary
, &IID_IDirectSoundBuffer8
, (void **)&buffer8
);
1861 ok(hr
== S_OK
, "got: %08lx\n", hr
);
1864 hr
= IDirectSoundBuffer8_GetStatus(buffer8
, &status
);
1865 ok(hr
== S_OK
, "got: %08lx\n", hr
);
1866 todo_wine
ok(status
== 0, "got: %08lx\n", status
);
1868 hr
= IDirectSoundBuffer8_AcquireResources(buffer8
, 0, 0, NULL
);
1869 ok(hr
== S_OK
, "got: %08lx\n", hr
);
1872 hr
= IDirectSoundBuffer8_GetStatus(buffer8
, &status
);
1873 ok(hr
== S_OK
, "got: %08lx\n", hr
);
1874 ok(status
== DSBSTATUS_LOCSOFTWARE
, "got: %08lx\n", status
);
1876 IDirectSoundBuffer8_Release(buffer8
);
1877 IDirectSoundBuffer_Release(secondary
);
1880 IDirectSoundBuffer_Release(primary
);
1881 IDirectSound_Release(dsound
);
1884 static void test_implicit_mta(void)
1888 struct apt_data test_apt_data
;
1890 check_apttype(&test_apt_data
);
1891 ok(test_apt_data
.type
== APTTYPE_UNITIALIZED
, "got apt type %d.\n", test_apt_data
.type
);
1893 /* test DirectSound8 object */
1894 hr
= CoCreateInstance(&CLSID_DirectSound8
, NULL
, CLSCTX_INPROC_SERVER
,
1895 &IID_IDirectSound8
, (void**)&dso
);
1896 ok(hr
== S_OK
, "CoCreateInstance(CLSID_DirectSound8) failed: %08lx\n", hr
);
1898 check_apttype(&test_apt_data
);
1899 ok(test_apt_data
.type
== APTTYPE_UNITIALIZED
, "got apt type %d.\n", test_apt_data
.type
);
1901 hr
= IDirectSound8_Initialize(dso
, NULL
);
1902 ok(hr
== DS_OK
|| hr
== DSERR_NODRIVER
|| hr
== DSERR_ALLOCATED
|| hr
== E_FAIL
,
1903 "IDirectSound8_Initialize() failed: %08lx\n", hr
);
1905 check_apttype(&test_apt_data
);
1906 ok(test_apt_data
.type
== APTTYPE_MTA
, "got apt type %d.\n", test_apt_data
.type
);
1907 ok(test_apt_data
.qualifier
== APTTYPEQUALIFIER_IMPLICIT_MTA
,
1908 "got apt type qualifier %d.\n", test_apt_data
.qualifier
);
1910 IDirectSound8_Release(dso
);
1912 check_apttype(&test_apt_data
);
1913 ok(test_apt_data
.type
== APTTYPE_UNITIALIZED
, "got apt type %d.\n", test_apt_data
.type
);
1915 /* test DirectSoundCreate8 */
1916 hr
= DirectSoundCreate8(NULL
, &dso
, NULL
);
1917 ok(hr
== DS_OK
|| hr
== DSERR_NODRIVER
|| hr
== DSERR_ALLOCATED
|| hr
== E_FAIL
,
1918 "DirectSoundCreate8() failed: %08lx\n", hr
);
1920 check_apttype(&test_apt_data
);
1921 ok(test_apt_data
.type
== APTTYPE_MTA
, "got apt type %d.\n", test_apt_data
.type
);
1922 ok(test_apt_data
.qualifier
== APTTYPEQUALIFIER_IMPLICIT_MTA
,
1923 "got apt type qualifier %d.\n", test_apt_data
.qualifier
);
1924 IDirectSound8_Release(dso
);
1927 check_apttype(&test_apt_data
);
1928 ok(test_apt_data
.type
== APTTYPE_UNITIALIZED
, "got apt type %d.\n", test_apt_data
.type
);
1938 /* Run implicit MTA tests before test COM so that a MTA won't be created before this test is run. */
1939 test_implicit_mta();
1941 IDirectSound8_tests();
1944 test_first_device();
1945 test_primary_flags();
1946 test_AcquireResources();
1948 hr
= CoRegisterClassObject(&testdmo_clsid
, (IUnknown
*)&testdmo_cf
,
1949 CLSCTX_INPROC_SERVER
, REGCLS_MULTIPLEUSE
, &cookie
);
1950 ok(hr
== S_OK
, "Failed to register class, hr %#lx.\n", hr
);
1954 CoRevokeClassObject(cookie
);