dsound/tests: Remove unneeded NONAMELESS* macros.
[wine] / dlls / dsound / tests / dsound.c
1 /*
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.
5  *
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.
10  *
11  * Copyright (c) 2002-2004 Francois Gouget
12  *
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.
17  *
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.
22  *
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
26  */
27
28 #include <windows.h>
29
30 #include "wine/test.h"
31 #include "dsound.h"
32 #include "dxerr8.h"
33 #include "dsconf.h"
34
35 #include "dsound_test.h"
36
37 static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
38                               LPCGUID lpGuid)
39 {
40     HRESULT rc;
41     DSCAPS dscaps;
42     int ref;
43     IUnknown * unknown;
44     IDirectSound * ds;
45     IDirectSound8 * ds8;
46     DWORD speaker_config, new_speaker_config;
47
48     /* Try to Query for objects */
49     rc=IDirectSound_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown);
50     ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IUnknown) failed: %s\n",
51        DXGetErrorString8(rc));
52     if (rc==DS_OK)
53         IDirectSound_Release(unknown);
54
55     rc=IDirectSound_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds);
56     ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IDirectSound) failed: %s\n",
57        DXGetErrorString8(rc));
58     if (rc==DS_OK)
59         IDirectSound_Release(ds);
60
61     rc=IDirectSound_QueryInterface(dso,&IID_IDirectSound8,(LPVOID*)&ds8);
62     ok(rc==E_NOINTERFACE,"IDirectSound_QueryInterface(IID_IDirectSound8) "
63        "should have failed: %s\n",DXGetErrorString8(rc));
64     if (rc==DS_OK)
65         IDirectSound8_Release(ds8);
66
67     if (initialized == FALSE) {
68         /* try uninitialized object */
69         rc=IDirectSound_GetCaps(dso,0);
70         ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetCaps(NULL) "
71            "should have returned DSERR_UNINITIALIZED, returned: %s\n",
72            DXGetErrorString8(rc));
73
74         rc=IDirectSound_GetCaps(dso,&dscaps);
75         ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetCaps() "
76            "should have returned DSERR_UNINITIALIZED, returned: %s\n",
77            DXGetErrorString8(rc));
78
79         rc=IDirectSound_Compact(dso);
80         ok(rc==DSERR_UNINITIALIZED,"IDirectSound_Compact() "
81            "should have returned DSERR_UNINITIALIZED, returned: %s\n",
82            DXGetErrorString8(rc));
83
84         rc=IDirectSound_GetSpeakerConfig(dso,&speaker_config);
85         ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetSpeakerConfig() "
86            "should have returned DSERR_UNINITIALIZED, returned: %s\n",
87            DXGetErrorString8(rc));
88
89         rc=IDirectSound_Initialize(dso,lpGuid);
90         ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
91            "IDirectSound_Initialize() failed: %s\n",DXGetErrorString8(rc));
92         if (rc==DSERR_NODRIVER) {
93             trace("  No Driver\n");
94             goto EXIT;
95         } else if (rc==E_FAIL) {
96             trace("  No Device\n");
97             goto EXIT;
98         } else if (rc==DSERR_ALLOCATED) {
99             trace("  Already In Use\n");
100             goto EXIT;
101         }
102     }
103
104     rc=IDirectSound_Initialize(dso,lpGuid);
105     ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSound_Initialize() "
106        "should have returned DSERR_ALREADYINITIALIZED: %s\n",
107        DXGetErrorString8(rc));
108
109     /* DSOUND: Error: Invalid caps buffer */
110     rc=IDirectSound_GetCaps(dso,0);
111     ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps(NULL) "
112        "should have returned DSERR_INVALIDPARAM, returned: %s\n",
113        DXGetErrorString8(rc));
114
115     ZeroMemory(&dscaps, sizeof(dscaps));
116
117     /* DSOUND: Error: Invalid caps buffer */
118     rc=IDirectSound_GetCaps(dso,&dscaps);
119     ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps() "
120        "should have returned DSERR_INVALIDPARAM, returned: %s\n",
121        DXGetErrorString8(rc));
122
123     dscaps.dwSize=sizeof(dscaps);
124
125     /* DSOUND: Running on a certified driver */
126     rc=IDirectSound_GetCaps(dso,&dscaps);
127     ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
128
129     rc=IDirectSound_Compact(dso);
130     ok(rc==DSERR_PRIOLEVELNEEDED,"IDirectSound_Compact() failed: %s\n",
131        DXGetErrorString8(rc));
132
133     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
134     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
135        DXGetErrorString8(rc));
136
137     rc=IDirectSound_Compact(dso);
138     ok(rc==DS_OK,"IDirectSound_Compact() failed: %s\n",DXGetErrorString8(rc));
139
140     rc=IDirectSound_GetSpeakerConfig(dso,0);
141     ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetSpeakerConfig(NULL) "
142        "should have returned DSERR_INVALIDPARAM, returned: %s\n",
143        DXGetErrorString8(rc));
144
145     rc=IDirectSound_GetSpeakerConfig(dso,&speaker_config);
146     ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %s\n",
147        DXGetErrorString8(rc));
148
149     speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO,
150                                         DSSPEAKER_GEOMETRY_WIDE);
151     rc=IDirectSound_SetSpeakerConfig(dso,speaker_config);
152     ok(rc==DS_OK,"IDirectSound_SetSpeakerConfig() failed: %s\n",
153        DXGetErrorString8(rc));
154     if (rc==DS_OK) {
155         rc=IDirectSound_GetSpeakerConfig(dso,&new_speaker_config);
156         ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %s\n",
157            DXGetErrorString8(rc));
158         if (rc==DS_OK && speaker_config!=new_speaker_config)
159                trace("IDirectSound_GetSpeakerConfig() failed to set speaker "
160                "config: expected 0x%08x, got 0x%08x\n",
161                speaker_config,new_speaker_config);
162     }
163
164 EXIT:
165     ref=IDirectSound_Release(dso);
166     ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
167 }
168
169 static void IDirectSound_tests(void)
170 {
171     HRESULT rc;
172     LPDIRECTSOUND dso=NULL;
173     LPCLASSFACTORY cf=NULL;
174
175     trace("Testing IDirectSound\n");
176
177     rc=CoGetClassObject(&CLSID_DirectSound, CLSCTX_INPROC_SERVER, NULL,
178                         &IID_IClassFactory, (void**)&cf);
179     ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
180        "failed: %s\n", DXGetErrorString8(rc));
181
182     rc=CoGetClassObject(&CLSID_DirectSound, CLSCTX_INPROC_SERVER, NULL,
183                         &IID_IUnknown, (void**)&cf);
184     ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound, IID_IUnknown) "
185        "failed: %s\n", DXGetErrorString8(rc));
186
187     /* try the COM class factory method of creation with no device specified */
188     rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
189                         &IID_IDirectSound, (void**)&dso);
190     ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n",
191        DXGetErrorString8(rc));
192     if (dso)
193         IDirectSound_test(dso, FALSE, NULL);
194
195     /* try the COM class factory method of creation with default playback
196      * device specified */
197     rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
198                         &IID_IDirectSound, (void**)&dso);
199     ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n",
200        DXGetErrorString8(rc));
201     if (dso)
202         IDirectSound_test(dso, FALSE, &DSDEVID_DefaultPlayback);
203
204     /* try the COM class factory method of creation with default voice
205      * playback device specified */
206     rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
207                         &IID_IDirectSound, (void**)&dso);
208     ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n",
209        DXGetErrorString8(rc));
210     if (dso)
211         IDirectSound_test(dso, FALSE, &DSDEVID_DefaultVoicePlayback);
212
213     /* try the COM class factory method of creation with a bad
214      * IID specified */
215     rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
216                         &CLSID_DirectSoundPrivate, (void**)&dso);
217     ok(rc==E_NOINTERFACE,
218        "CoCreateInstance(CLSID_DirectSound,CLSID_DirectSoundPrivate) "
219        "should have failed: %s\n",DXGetErrorString8(rc));
220
221     /* try the COM class factory method of creation with a bad
222      * GUID and IID specified */
223     rc=CoCreateInstance(&CLSID_DirectSoundPrivate, NULL, CLSCTX_INPROC_SERVER,
224                         &IID_IDirectSound, (void**)&dso);
225     ok(rc==REGDB_E_CLASSNOTREG,
226        "CoCreateInstance(CLSID_DirectSoundPrivate,IID_IDirectSound) "
227        "should have failed: %s\n",DXGetErrorString8(rc));
228
229     /* try with no device specified */
230     rc=DirectSoundCreate(NULL,&dso,NULL);
231     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
232        "DirectSoundCreate(NULL) failed: %s\n",DXGetErrorString8(rc));
233     if (rc==S_OK && dso)
234         IDirectSound_test(dso, TRUE, NULL);
235
236     /* try with default playback device specified */
237     rc=DirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL);
238     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
239        "DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %s\n",
240        DXGetErrorString8(rc));
241     if (rc==DS_OK && dso)
242         IDirectSound_test(dso, TRUE, NULL);
243
244     /* try with default voice playback device specified */
245     rc=DirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
246     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
247        "DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %s\n",
248        DXGetErrorString8(rc));
249     if (rc==DS_OK && dso)
250         IDirectSound_test(dso, TRUE, NULL);
251
252     /* try with a bad device specified */
253     rc=DirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL);
254     ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) "
255        "should have failed: %s\n",DXGetErrorString8(rc));
256     if (rc==DS_OK && dso)
257         IDirectSound_Release(dso);
258 }
259
260 static HRESULT test_dsound(LPGUID lpGuid)
261 {
262     HRESULT rc;
263     LPDIRECTSOUND dso=NULL;
264     int ref;
265
266     /* DSOUND: Error: Invalid interface buffer */
267     rc=DirectSoundCreate(lpGuid,0,NULL);
268     ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned "
269        "DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
270
271     /* Create the DirectSound object */
272     rc=DirectSoundCreate(lpGuid,&dso,NULL);
273     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
274        "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
275     if (rc!=DS_OK)
276         return rc;
277
278     /* Try the enumerated device */
279     IDirectSound_test(dso, TRUE, lpGuid);
280
281     /* Try the COM class factory method of creation with enumerated device */
282     rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
283                         &IID_IDirectSound, (void**)&dso);
284     ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n",
285        DXGetErrorString8(rc));
286     if (dso)
287         IDirectSound_test(dso, FALSE, lpGuid);
288
289     /* Create a DirectSound object */
290     rc=DirectSoundCreate(lpGuid,&dso,NULL);
291     ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
292     if (rc==DS_OK) {
293         LPDIRECTSOUND dso1=NULL;
294
295         /* Create a second DirectSound object */
296         rc=DirectSoundCreate(lpGuid,&dso1,NULL);
297         ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
298         if (rc==DS_OK) {
299             /* Release the second DirectSound object */
300             ref=IDirectSound_Release(dso1);
301             ok(ref==0,"IDirectSound_Release() has %d references, should have "
302                "0\n",ref);
303             ok(dso!=dso1,"DirectSound objects should be unique: dso=%p,dso1=%p\n",dso,dso1);
304         }
305
306         /* Release the first DirectSound object */
307         ref=IDirectSound_Release(dso);
308         ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",
309            ref);
310         if (ref!=0)
311             return DSERR_GENERIC;
312     } else
313         return rc;
314
315     /* Create a DirectSound object */
316     rc=DirectSoundCreate(lpGuid,&dso,NULL);
317     ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
318     if (rc==DS_OK) {
319         LPDIRECTSOUNDBUFFER secondary;
320         DSBUFFERDESC bufdesc;
321         WAVEFORMATEX wfx;
322
323         init_format(&wfx,WAVE_FORMAT_PCM,11025,8,1);
324         ZeroMemory(&bufdesc, sizeof(bufdesc));
325         bufdesc.dwSize=sizeof(bufdesc);
326         bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRL3D;
327         bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000,
328                                     wfx.nBlockAlign);
329         bufdesc.lpwfxFormat=&wfx;
330         rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
331         ok(rc==DS_OK && secondary!=NULL,
332            "IDirectSound_CreateSoundBuffer() failed to create a secondary "
333            "buffer %s\n",DXGetErrorString8(rc));
334         if (rc==DS_OK && secondary!=NULL) {
335             LPDIRECTSOUND3DBUFFER buffer3d;
336             rc=IDirectSound_QueryInterface(secondary, &IID_IDirectSound3DBuffer,
337                                            (void **)&buffer3d);
338             ok(rc==DS_OK && buffer3d!=NULL,"IDirectSound_QueryInterface() "
339                "failed:  %s\n",DXGetErrorString8(rc));
340             if (rc==DS_OK && buffer3d!=NULL) {
341                 ref=IDirectSound3DBuffer_AddRef(buffer3d);
342                 ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, "
343                    "should have 2\n",ref);
344             }
345             ref=IDirectSoundBuffer_AddRef(secondary);
346             ok(ref==2,"IDirectSoundBuffer_AddRef() has %d references, "
347                "should have 2\n",ref);
348         }
349         /* release with buffer */
350         ref=IDirectSound_Release(dso);
351         ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",
352            ref);
353         if (ref!=0)
354             return DSERR_GENERIC;
355     } else
356         return rc;
357
358     return DS_OK;
359 }
360
361 static HRESULT test_primary(LPGUID lpGuid)
362 {
363     HRESULT rc;
364     LPDIRECTSOUND dso=NULL;
365     LPDIRECTSOUNDBUFFER primary=NULL,second=NULL,third=NULL;
366     DSBUFFERDESC bufdesc;
367     DSCAPS dscaps;
368     WAVEFORMATEX wfx;
369     int ref;
370
371     /* Create the DirectSound object */
372     rc=DirectSoundCreate(lpGuid,&dso,NULL);
373     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
374        "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
375     if (rc!=DS_OK)
376         return rc;
377
378     /* Get the device capabilities */
379     ZeroMemory(&dscaps, sizeof(dscaps));
380     dscaps.dwSize=sizeof(dscaps);
381     rc=IDirectSound_GetCaps(dso,&dscaps);
382     ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
383     if (rc!=DS_OK)
384         goto EXIT;
385
386     /* DSOUND: Error: Invalid buffer description pointer */
387     rc=IDirectSound_CreateSoundBuffer(dso,0,0,NULL);
388     ok(rc==DSERR_INVALIDPARAM,
389        "IDirectSound_CreateSoundBuffer() should have failed: %s\n",
390        DXGetErrorString8(rc));
391
392     /* DSOUND: Error: Invalid buffer description pointer */
393     rc=IDirectSound_CreateSoundBuffer(dso,0,&primary,NULL);
394     ok(rc==DSERR_INVALIDPARAM && primary==0,
395        "IDirectSound_CreateSoundBuffer() should have failed: rc=%s,"
396        "dsbo=%p\n",DXGetErrorString8(rc),primary);
397
398     /* DSOUND: Error: Invalid buffer description pointer */
399     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,0,NULL);
400     ok(rc==DSERR_INVALIDPARAM && primary==0,
401        "IDirectSound_CreateSoundBuffer() should have failed: rc=%s,"
402        "dsbo=0x%p\n",DXGetErrorString8(rc),primary);
403
404     ZeroMemory(&bufdesc, sizeof(bufdesc));
405
406     /* DSOUND: Error: Invalid size */
407     /* DSOUND: Error: Invalid buffer description */
408     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
409     ok(rc==DSERR_INVALIDPARAM && primary==0,
410        "IDirectSound_CreateSoundBuffer() should have failed: rc=%s,"
411        "primary=%p\n",DXGetErrorString8(rc),primary);
412
413     /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
414     /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
415     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
416     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
417        DXGetErrorString8(rc));
418     if (rc!=DS_OK)
419         goto EXIT;
420
421     /* Testing the primary buffer */
422     primary=NULL;
423     ZeroMemory(&bufdesc, sizeof(bufdesc));
424     bufdesc.dwSize=sizeof(bufdesc);
425     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME;
426     bufdesc.lpwfxFormat = &wfx;
427     init_format(&wfx,WAVE_FORMAT_PCM,11025,8,2);
428     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
429     ok(rc==DSERR_INVALIDPARAM,"IDirectSound_CreateSoundBuffer() should have "
430        "returned DSERR_INVALIDPARAM, returned: %s\n", DXGetErrorString8(rc));
431     if (rc==DS_OK && primary!=NULL)
432         IDirectSoundBuffer_Release(primary);
433
434     primary=NULL;
435     ZeroMemory(&bufdesc, sizeof(bufdesc));
436     bufdesc.dwSize=sizeof(bufdesc);
437     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME;
438     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
439     ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
440        "IDirectSound_CreateSoundBuffer() failed to create a primary buffer: "
441        "%s\n",DXGetErrorString8(rc));
442     if (rc==DSERR_CONTROLUNAVAIL)
443         trace("  No Primary\n");
444     else if (rc==DS_OK && primary!=NULL) {
445         LONG vol;
446
447         /* Try to create a second primary buffer */
448         /* DSOUND: Error: The primary buffer already exists.
449          * Any changes made to the buffer description will be ignored. */
450         rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&second,NULL);
451         ok(rc==DS_OK && second==primary,
452            "IDirectSound_CreateSoundBuffer() should have returned original "
453            "primary buffer: %s\n",DXGetErrorString8(rc));
454         ref=IDirectSoundBuffer_Release(second);
455         ok(ref==1,"IDirectSoundBuffer_Release() primary has %d references, "
456            "should have 1\n",ref);
457
458         /* Try to duplicate a primary buffer */
459         /* DSOUND: Error: Can't duplicate primary buffers */
460         rc=IDirectSound_DuplicateSoundBuffer(dso,primary,&third);
461         /* rc=0x88780032 */
462         ok(rc!=DS_OK,"IDirectSound_DuplicateSoundBuffer() primary buffer "
463            "should have failed %s\n",DXGetErrorString8(rc));
464
465         rc=IDirectSoundBuffer_GetVolume(primary,&vol);
466         ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n",
467            DXGetErrorString8(rc));
468
469         if (winetest_interactive) {
470             trace("Playing a 5 seconds reference tone at the current "
471                   "volume.\n");
472             if (rc==DS_OK)
473                 trace("(the current volume is %d according to DirectSound)\n",
474                       vol);
475             trace("All subsequent tones should be identical to this one.\n");
476             trace("Listen for stutter, changes in pitch, volume, etc.\n");
477         }
478         test_buffer(dso,&primary,1,FALSE,0,FALSE,0,winetest_interactive &&
479                     !(dscaps.dwFlags & DSCAPS_EMULDRIVER),5.0,0,0,0,0,FALSE,0);
480
481         ref=IDirectSoundBuffer_Release(primary);
482         ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
483            "should have 0\n",ref);
484     }
485
486     /* Set the CooperativeLevel back to normal */
487     /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
488     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
489     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
490        DXGetErrorString8(rc));
491
492 EXIT:
493     ref=IDirectSound_Release(dso);
494     ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
495     if (ref!=0)
496         return DSERR_GENERIC;
497
498     return rc;
499 }
500
501 /*
502  * Test the primary buffer at different formats while keeping the
503  * secondary buffer at a constant format.
504  */
505 static HRESULT test_primary_secondary(LPGUID lpGuid)
506 {
507     HRESULT rc;
508     LPDIRECTSOUND dso=NULL;
509     LPDIRECTSOUNDBUFFER primary=NULL,secondary=NULL;
510     DSBUFFERDESC bufdesc;
511     DSCAPS dscaps;
512     WAVEFORMATEX wfx, wfx2;
513     int f,ref;
514
515     /* Create the DirectSound object */
516     rc=DirectSoundCreate(lpGuid,&dso,NULL);
517     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
518        "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
519     if (rc!=DS_OK)
520         return rc;
521
522     /* Get the device capabilities */
523     ZeroMemory(&dscaps, sizeof(dscaps));
524     dscaps.dwSize=sizeof(dscaps);
525     rc=IDirectSound_GetCaps(dso,&dscaps);
526     ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
527     if (rc!=DS_OK)
528         goto EXIT;
529
530     /* We must call SetCooperativeLevel before creating primary buffer */
531     /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
532     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
533     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
534        DXGetErrorString8(rc));
535     if (rc!=DS_OK)
536         goto EXIT;
537
538     ZeroMemory(&bufdesc, sizeof(bufdesc));
539     bufdesc.dwSize=sizeof(bufdesc);
540     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
541     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
542     ok(rc==DS_OK && primary!=NULL,
543        "IDirectSound_CreateSoundBuffer() failed to create a primary buffer "
544        "%s\n",DXGetErrorString8(rc));
545
546     if (rc==DS_OK && primary!=NULL) {
547         for (f=0;f<NB_FORMATS;f++) {
548             /* We must call SetCooperativeLevel to be allowed to call
549              * SetFormat */
550             /* DSOUND: Setting DirectSound cooperative level to
551              * DSSCL_PRIORITY */
552             rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
553             ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
554                DXGetErrorString8(rc));
555             if (rc!=DS_OK)
556                 goto EXIT;
557
558             init_format(&wfx,WAVE_FORMAT_PCM,formats[f][0],formats[f][1],
559                         formats[f][2]);
560             wfx2=wfx;
561             rc=IDirectSoundBuffer_SetFormat(primary,&wfx);
562             ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %s\n",
563                format_string(&wfx), DXGetErrorString8(rc));
564
565             /* There is no guarantee that SetFormat will actually change the
566              * format to what we asked for. It depends on what the soundcard
567              * supports. So we must re-query the format.
568              */
569             rc=IDirectSoundBuffer_GetFormat(primary,&wfx,sizeof(wfx),NULL);
570             ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n",
571                DXGetErrorString8(rc));
572             if (rc==DS_OK &&
573                 (wfx.wFormatTag!=wfx2.wFormatTag ||
574                  wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
575                  wfx.wBitsPerSample!=wfx2.wBitsPerSample ||
576                  wfx.nChannels!=wfx2.nChannels)) {
577                 trace("Requested primary format tag=0x%04x %dx%dx%d "
578                       "avg.B/s=%d align=%d\n",
579                       wfx2.wFormatTag,wfx2.nSamplesPerSec,wfx2.wBitsPerSample,
580                       wfx2.nChannels,wfx2.nAvgBytesPerSec,wfx2.nBlockAlign);
581                 trace("Got tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
582                       wfx.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample,
583                       wfx.nChannels,wfx.nAvgBytesPerSec,wfx.nBlockAlign);
584             }
585
586             /* Set the CooperativeLevel back to normal */
587             /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
588             rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
589             ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
590                DXGetErrorString8(rc));
591
592             init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
593
594             secondary=NULL;
595             ZeroMemory(&bufdesc, sizeof(bufdesc));
596             bufdesc.dwSize=sizeof(bufdesc);
597             bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
598             bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000,
599                                         wfx.nBlockAlign);
600             bufdesc.lpwfxFormat=&wfx2;
601             if (winetest_interactive) {
602                 trace("  Testing a primary buffer at %dx%dx%d with a "
603                       "secondary buffer at %dx%dx%d\n",
604                       wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
605                       wfx2.nSamplesPerSec,wfx2.wBitsPerSample,wfx2.nChannels);
606             }
607             rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
608             ok(rc==DS_OK && secondary!=NULL,
609                "IDirectSound_CreateSoundBuffer() failed to create a secondary "
610                "buffer %s\n",DXGetErrorString8(rc));
611
612             if (rc==DS_OK && secondary!=NULL) {
613                 test_buffer(dso,&secondary,0,FALSE,0,FALSE,0,
614                             winetest_interactive,1.0,0,NULL,0,0,FALSE,0);
615
616                 ref=IDirectSoundBuffer_Release(secondary);
617                 ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
618                    "should have 0\n",ref);
619             }
620         }
621
622         ref=IDirectSoundBuffer_Release(primary);
623         ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
624            "should have 0\n",ref);
625     }
626
627     /* Set the CooperativeLevel back to normal */
628     /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
629     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
630     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
631        DXGetErrorString8(rc));
632
633 EXIT:
634     ref=IDirectSound_Release(dso);
635     ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
636     if (ref!=0)
637         return DSERR_GENERIC;
638
639     return rc;
640 }
641
642 static HRESULT test_secondary(LPGUID lpGuid)
643 {
644     HRESULT rc;
645     LPDIRECTSOUND dso=NULL;
646     LPDIRECTSOUNDBUFFER primary=NULL,secondary=NULL;
647     DSBUFFERDESC bufdesc;
648     DSCAPS dscaps;
649     WAVEFORMATEX wfx, wfx1;
650     DWORD f;
651     int ref;
652
653     /* Create the DirectSound object */
654     rc=DirectSoundCreate(lpGuid,&dso,NULL);
655     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
656        "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
657     if (rc!=DS_OK)
658         return rc;
659
660     /* Get the device capabilities */
661     ZeroMemory(&dscaps, sizeof(dscaps));
662     dscaps.dwSize=sizeof(dscaps);
663     rc=IDirectSound_GetCaps(dso,&dscaps);
664     ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
665     if (rc!=DS_OK)
666         goto EXIT;
667
668     /* We must call SetCooperativeLevel before creating primary buffer */
669     /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
670     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
671     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
672        DXGetErrorString8(rc));
673     if (rc!=DS_OK)
674         goto EXIT;
675
676     ZeroMemory(&bufdesc, sizeof(bufdesc));
677     bufdesc.dwSize=sizeof(bufdesc);
678     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
679     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
680     ok(rc==DS_OK && primary!=NULL,
681        "IDirectSound_CreateSoundBuffer() failed to create a primary buffer "
682        "%s\n",DXGetErrorString8(rc));
683
684     if (rc==DS_OK && primary!=NULL) {
685         rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
686         ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n",
687            DXGetErrorString8(rc));
688         if (rc!=DS_OK)
689             goto EXIT1;
690
691         for (f=0;f<NB_FORMATS;f++) {
692             init_format(&wfx,WAVE_FORMAT_PCM,formats[f][0],formats[f][1],
693                         formats[f][2]);
694             secondary=NULL;
695             ZeroMemory(&bufdesc, sizeof(bufdesc));
696             bufdesc.dwSize=sizeof(bufdesc);
697             bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
698             bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000,
699                                         wfx.nBlockAlign);
700             rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
701             ok(rc==DSERR_INVALIDPARAM,"IDirectSound_CreateSoundBuffer() "
702                "should have returned DSERR_INVALIDPARAM, returned: %s\n",
703                DXGetErrorString8(rc));
704             if (rc==DS_OK && secondary!=NULL)
705                 IDirectSoundBuffer_Release(secondary);
706
707             secondary=NULL;
708             ZeroMemory(&bufdesc, sizeof(bufdesc));
709             bufdesc.dwSize=sizeof(bufdesc);
710             bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
711             bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000,
712                                         wfx.nBlockAlign);
713             bufdesc.lpwfxFormat=&wfx;
714             if (winetest_interactive) {
715                 trace("  Testing a secondary buffer at %dx%dx%d "
716                       "with a primary buffer at %dx%dx%d\n",
717                       wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
718                       wfx1.nSamplesPerSec,wfx1.wBitsPerSample,wfx1.nChannels);
719             }
720             rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
721             ok(rc==DS_OK && secondary!=NULL,
722                "IDirectSound_CreateSoundBuffer() failed to create a secondary "
723                "buffer %s\n",DXGetErrorString8(rc));
724
725             if (rc==DS_OK && secondary!=NULL) {
726                 test_buffer(dso,&secondary,0,FALSE,0,FALSE,0,
727                             winetest_interactive,1.0,0,NULL,0,0,FALSE,0);
728
729                 ref=IDirectSoundBuffer_Release(secondary);
730                 ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
731                    "should have 0\n",ref);
732             }
733         }
734 EXIT1:
735         ref=IDirectSoundBuffer_Release(primary);
736         ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
737            "should have 0\n",ref);
738     }
739
740     /* Set the CooperativeLevel back to normal */
741     /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
742     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
743     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
744        DXGetErrorString8(rc));
745
746 EXIT:
747     ref=IDirectSound_Release(dso);
748     ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
749     if (ref!=0)
750         return DSERR_GENERIC;
751
752     return rc;
753 }
754
755 static HRESULT test_block_align(LPGUID lpGuid)
756 {
757     HRESULT rc;
758     LPDIRECTSOUND dso=NULL;
759     LPDIRECTSOUNDBUFFER secondary=NULL;
760     DSBUFFERDESC bufdesc;
761     DSBCAPS dsbcaps;
762     WAVEFORMATEX wfx;
763     int ref;
764
765     /* Create the DirectSound object */
766     rc=DirectSoundCreate(lpGuid,&dso,NULL);
767     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
768        "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
769     if (rc!=DS_OK)
770         return rc;
771
772     init_format(&wfx,WAVE_FORMAT_PCM,11025,16,2);
773     ZeroMemory(&bufdesc, sizeof(bufdesc));
774     bufdesc.dwSize=sizeof(bufdesc);
775     bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
776     bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec + 1;
777     bufdesc.lpwfxFormat=&wfx;
778     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
779     ok(rc==DS_OK,"IDirectSound_CreateSoundBuffer() "
780        "should have returned DS_OK, returned: %s\n",
781        DXGetErrorString8(rc));
782
783     if (rc==DS_OK && secondary!=NULL) {
784         ZeroMemory(&dsbcaps, sizeof(dsbcaps));
785         dsbcaps.dwSize = sizeof(dsbcaps);
786         rc=IDirectSoundBuffer_GetCaps(secondary,&dsbcaps);
787         ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() should have returned DS_OK, "
788            "returned: %s\n", DXGetErrorString8(rc));
789         if (rc==DS_OK)
790             ok(dsbcaps.dwBufferBytes==(wfx.nAvgBytesPerSec + wfx.nBlockAlign),
791                "Buffer size not a multiple of nBlockAlign: requested %d, "
792                "got %d, should be %d\n", bufdesc.dwBufferBytes,
793                dsbcaps.dwBufferBytes, wfx.nAvgBytesPerSec + wfx.nBlockAlign);
794         ref=IDirectSoundBuffer_Release(secondary);
795         ok(ref==0,"IDirectSoundBuffer_Release() secondary has %d references, "
796            "should have 0\n",ref);
797     }
798
799     ref=IDirectSound_Release(dso);
800     ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
801     if (ref!=0)
802         return DSERR_GENERIC;
803
804     return rc;
805 }
806
807 static struct fmt {
808     int bits;
809     int channels;
810 } fmts[] = { { 8, 1 }, { 8, 2 }, { 16, 1 }, {16, 2 } };
811
812 static HRESULT test_frequency(LPGUID lpGuid)
813 {
814     HRESULT rc;
815     LPDIRECTSOUND dso=NULL;
816     LPDIRECTSOUNDBUFFER primary=NULL,secondary=NULL;
817     DSBUFFERDESC bufdesc;
818     DSCAPS dscaps;
819     WAVEFORMATEX wfx, wfx1;
820     DWORD f, r;
821     int ref;
822     int rates[] = { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100,
823                     48000, 96000 };
824
825     /* Create the DirectSound object */
826     rc=DirectSoundCreate(lpGuid,&dso,NULL);
827     ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
828        "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
829     if (rc!=DS_OK)
830         return rc;
831
832     /* Get the device capabilities */
833     ZeroMemory(&dscaps, sizeof(dscaps));
834     dscaps.dwSize=sizeof(dscaps);
835     rc=IDirectSound_GetCaps(dso,&dscaps);
836     ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
837     if (rc!=DS_OK)
838         goto EXIT;
839
840     /* We must call SetCooperativeLevel before creating primary buffer */
841     /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
842     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
843     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
844        DXGetErrorString8(rc));
845     if (rc!=DS_OK)
846         goto EXIT;
847
848     ZeroMemory(&bufdesc, sizeof(bufdesc));
849     bufdesc.dwSize=sizeof(bufdesc);
850     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
851     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
852     ok(rc==DS_OK && primary!=NULL,
853        "IDirectSound_CreateSoundBuffer() failed to create a primary buffer "
854        "%s\n",DXGetErrorString8(rc));
855
856     if (rc==DS_OK && primary!=NULL) {
857         rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
858         ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n",
859            DXGetErrorString8(rc));
860         if (rc!=DS_OK)
861             goto EXIT1;
862
863         for (f=0;f<sizeof(fmts)/sizeof(fmts[0]);f++) {
864         for (r=0;r<sizeof(rates)/sizeof(rates[0]);r++) {
865             init_format(&wfx,WAVE_FORMAT_PCM,11025,fmts[f].bits,
866                         fmts[f].channels);
867             secondary=NULL;
868             ZeroMemory(&bufdesc, sizeof(bufdesc));
869             bufdesc.dwSize=sizeof(bufdesc);
870             bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2|DSBCAPS_CTRLFREQUENCY;
871             bufdesc.dwBufferBytes=align((wfx.nAvgBytesPerSec*rates[r]/11025)*
872                                         BUFFER_LEN/1000,wfx.nBlockAlign);
873             bufdesc.lpwfxFormat=&wfx;
874             if (winetest_interactive) {
875                 trace("  Testing a secondary buffer at %dx%dx%d "
876                       "with a primary buffer at %dx%dx%d\n",
877                       wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
878                       wfx1.nSamplesPerSec,wfx1.wBitsPerSample,wfx1.nChannels);
879             }
880             rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
881             ok(rc==DS_OK && secondary!=NULL,
882                "IDirectSound_CreateSoundBuffer() failed to create a secondary "
883                "buffer %s\n",DXGetErrorString8(rc));
884
885             if (rc==DS_OK && secondary!=NULL) {
886                 test_buffer(dso,&secondary,0,FALSE,0,FALSE,0,
887                             winetest_interactive,1.0,0,NULL,0,0,TRUE,rates[r]);
888
889                 ref=IDirectSoundBuffer_Release(secondary);
890                 ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
891                    "should have 0\n",ref);
892             }
893         }
894         }
895 EXIT1:
896         ref=IDirectSoundBuffer_Release(primary);
897         ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
898            "should have 0\n",ref);
899     }
900
901     /* Set the CooperativeLevel back to normal */
902     /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
903     rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
904     ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
905        DXGetErrorString8(rc));
906
907 EXIT:
908     ref=IDirectSound_Release(dso);
909     ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
910     if (ref!=0)
911         return DSERR_GENERIC;
912
913     return rc;
914 }
915
916 static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
917                                    LPCSTR lpcstrModule, LPVOID lpContext)
918 {
919     HRESULT rc;
920     trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
921     rc = test_dsound(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");
928     else {
929         test_block_align(lpGuid);
930         test_primary(lpGuid);
931         test_primary_secondary(lpGuid);
932         test_secondary(lpGuid);
933         test_frequency(lpGuid);
934     }
935
936     return 1;
937 }
938
939 static void dsound_tests(void)
940 {
941     HRESULT rc;
942     rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
943     ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
944 }
945
946 START_TEST(dsound)
947 {
948     CoInitialize(NULL);
949
950     trace("DLL Version: %s\n", get_file_version("dsound.dll"));
951
952     IDirectSound_tests();
953     dsound_tests();
954
955     CoUninitialize();
956 }