2 * Tests the panning and 3D functions of DirectSound
4 * Part of this test involves playing test tones. But this only makes
5 * sense if someone is going to carefully listen to it, and would only
6 * bother everyone else.
7 * So this is only done if the test is being run in interactive mode.
9 * Copyright (c) 2002-2004 Francois Gouget
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #define NONAMELESSSTRUCT
27 #define NONAMELESSUNION
32 #include "wine/test.h"
36 #include "dsound_test.h"
38 static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL;
44 LPDIRECTSOUNDBUFFER dsbo;
52 static int buffer_refill8(play_state_t* state, DWORD size)
58 if (size>state->wave_len-state->written)
59 size=state->wave_len-state->written;
61 rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
62 &ptr1,&len1,&ptr2,&len2,0);
63 ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n",
64 DXGetErrorString8(rc));
68 memcpy(ptr1,state->wave+state->written,len1);
71 memcpy(ptr2,state->wave+state->written,len2);
74 state->offset=state->written % state->buffer_size;
75 rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
76 ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n",
77 DXGetErrorString8(rc));
83 static int buffer_silence8(play_state_t* state, DWORD size)
90 rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
91 &ptr1,&len1,&ptr2,&len2,0);
92 ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n",
93 DXGetErrorString8(rc));
97 s=(state->wfx->wBitsPerSample==8?0x80:0);
102 state->offset=(state->offset+size) % state->buffer_size;
103 rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
104 ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n",
105 DXGetErrorString8(rc));
111 static int buffer_service8(play_state_t* state)
113 DWORD last_play_pos,play_pos,buf_free;
116 rc=IDirectSoundBuffer_GetCurrentPosition(state->dsbo,&play_pos,NULL);
117 ok(rc==DS_OK,"IDirectSoundBuffer_GetCurrentPosition() failed: %s\n",
118 DXGetErrorString8(rc));
123 /* Update the amount played */
124 last_play_pos=state->played % state->buffer_size;
125 if (play_pos<last_play_pos)
126 state->played+=state->buffer_size-last_play_pos+play_pos;
128 state->played+=play_pos-last_play_pos;
130 if (winetest_debug > 1)
131 trace("buf size=%ld last_play_pos=%ld play_pos=%ld played=%ld / %ld\n",
132 state->buffer_size,last_play_pos,play_pos,state->played,
135 if (state->played>state->wave_len)
137 /* Everything has been played */
141 /* Refill the buffer */
142 if (state->offset<=play_pos)
143 buf_free=play_pos-state->offset;
145 buf_free=state->buffer_size-state->offset+play_pos;
147 if (winetest_debug > 1)
148 trace("offset=%ld free=%ld written=%ld / %ld\n",
149 state->offset,buf_free,state->written,state->wave_len);
153 if (state->written<state->wave_len)
155 int w=buffer_refill8(state,buf_free);
159 if (state->written==state->wave_len && winetest_debug > 1)
160 trace("last sound byte at %ld\n",
161 (state->written % state->buffer_size));
165 /* Fill with silence */
166 if (winetest_debug > 1)
167 trace("writing %ld bytes of silence\n",buf_free);
168 if (buffer_silence8(state,buf_free)==-1)
174 if (winetest_debug > 1)
175 trace("stopping playback\n");
176 rc=IDirectSoundBuffer_Stop(state->dsbo);
177 ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %s\n",
178 DXGetErrorString8(rc));
182 void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
183 BOOL is_primary, BOOL set_volume, LONG volume,
184 BOOL set_pan, LONG pan, BOOL play, double duration,
185 BOOL buffer3d, LPDIRECTSOUND3DLISTENER listener,
186 BOOL move_listener, BOOL move_sound)
190 WAVEFORMATEX wfx,wfx2;
191 DWORD size,status,freq;
194 /* DSOUND: Error: Invalid caps pointer */
195 rc=IDirectSoundBuffer_GetCaps(*dsbo,0);
196 ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have "
197 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
199 ZeroMemory(&dsbcaps, sizeof(dsbcaps));
201 /* DSOUND: Error: Invalid caps pointer */
202 rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps);
203 ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have "
204 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
206 dsbcaps.dwSize=sizeof(dsbcaps);
207 rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps);
208 ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n",
209 DXGetErrorString8(rc));
210 if (rc==DS_OK && winetest_debug > 1) {
211 trace(" Caps: flags=0x%08lx size=%ld\n",dsbcaps.dwFlags,
212 dsbcaps.dwBufferBytes);
215 /* Query the format size. Note that it may not match sizeof(wfx) */
217 rc=IDirectSoundBuffer_GetFormat(*dsbo,NULL,0,&size);
218 ok(rc==DS_OK && size!=0,"IDirectSoundBuffer_GetFormat() should have "
219 "returned the needed size: rc=%s size=%ld\n",DXGetErrorString8(rc),size);
221 rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,sizeof(wfx),NULL);
222 ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n",
223 DXGetErrorString8(rc));
224 if (rc==DS_OK && winetest_debug > 1) {
225 trace(" Format: %s tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
226 is_primary ? "Primary" : "Secondary",
227 wfx.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample,
228 wfx.nChannels,wfx.nAvgBytesPerSec,wfx.nBlockAlign);
231 /* DSOUND: Error: Invalid frequency buffer */
232 rc=IDirectSoundBuffer_GetFrequency(*dsbo,0);
233 ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetFrequency() should have "
234 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
236 /* DSOUND: Error: Primary buffers don't support CTRLFREQUENCY */
237 rc=IDirectSoundBuffer_GetFrequency(*dsbo,&freq);
238 ok((rc==DS_OK && !is_primary) || (rc==DSERR_CONTROLUNAVAIL&&is_primary) ||
239 (rc==DSERR_CONTROLUNAVAIL&&!(dsbcaps.dwFlags&DSBCAPS_CTRLFREQUENCY)),
240 "IDirectSoundBuffer_GetFrequency() failed: %s\n",DXGetErrorString8(rc));
242 ok(freq==wfx.nSamplesPerSec,"The frequency returned by GetFrequency "
243 "%ld does not match the format %ld\n",freq,wfx.nSamplesPerSec);
246 /* DSOUND: Error: Invalid status pointer */
247 rc=IDirectSoundBuffer_GetStatus(*dsbo,0);
248 ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetStatus() should have "
249 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
251 rc=IDirectSoundBuffer_GetStatus(*dsbo,&status);
252 ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %s\n",
253 DXGetErrorString8(rc));
254 ok(status==0,"status=0x%lx instead of 0\n",status);
258 /* We must call SetCooperativeLevel to be allowed to call SetFormat */
259 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
260 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
261 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) "
262 "failed: %s\n",DXGetErrorString8(rc));
266 /* DSOUND: Error: Invalid format pointer */
267 rc=IDirectSoundBuffer_SetFormat(*dsbo,0);
268 ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_SetFormat() should have "
269 "returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
271 init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
272 rc=IDirectSoundBuffer_SetFormat(*dsbo,&wfx2);
273 ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat() failed: %s\n",
274 DXGetErrorString8(rc));
276 /* There is no garantee that SetFormat will actually change the
277 * format to what we asked for. It depends on what the soundcard
278 * supports. So we must re-query the format.
280 rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,sizeof(wfx),NULL);
281 ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n",
282 DXGetErrorString8(rc));
284 (wfx.wFormatTag!=wfx2.wFormatTag ||
285 wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
286 wfx.wBitsPerSample!=wfx2.wBitsPerSample ||
287 wfx.nChannels!=wfx2.nChannels)) {
288 trace("Requested format tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
289 wfx2.wFormatTag,wfx2.nSamplesPerSec,wfx2.wBitsPerSample,
290 wfx2.nChannels,wfx2.nAvgBytesPerSec,wfx2.nBlockAlign);
291 trace("Got tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
292 wfx.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample,
293 wfx.nChannels,wfx.nAvgBytesPerSec,wfx.nBlockAlign);
296 ZeroMemory(&new_dsbcaps, sizeof(new_dsbcaps));
297 new_dsbcaps.dwSize = sizeof(new_dsbcaps);
298 rc=IDirectSoundBuffer_GetCaps(*dsbo,&new_dsbcaps);
299 ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n",
300 DXGetErrorString8(rc));
301 if (rc==DS_OK && winetest_debug > 1) {
302 trace(" new Caps: flags=0x%08lx size=%ld\n",new_dsbcaps.dwFlags,
303 new_dsbcaps.dwBufferBytes);
306 /* Check for primary buffer size change */
307 ok(new_dsbcaps.dwBufferBytes == dsbcaps.dwBufferBytes,
308 " buffer size changed after SetFormat() - "
309 "previous size was %lu, current size is %lu\n",
310 dsbcaps.dwBufferBytes, new_dsbcaps.dwBufferBytes);
312 /* Check for primary buffer flags change */
313 ok(new_dsbcaps.dwFlags == dsbcaps.dwFlags,
314 " flags changed after SetFormat() - "
315 "previous flags were %08lx, current flags are %08lx\n",
316 dsbcaps.dwFlags, new_dsbcaps.dwFlags);
318 /* Set the CooperativeLevel back to normal */
319 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
320 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
321 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) "
322 "failed: %s\n",DXGetErrorString8(rc));
327 DS3DLISTENER listener_param;
328 LPDIRECTSOUND3DBUFFER buffer=NULL;
329 DS3DBUFFER buffer_param;
330 DWORD start_time,now;
332 if (winetest_interactive) {
333 trace(" Playing %g second 440Hz tone at %ldx%dx%d\n", duration,
334 wfx.nSamplesPerSec, wfx.wBitsPerSample,wfx.nChannels);
338 /* We must call SetCooperativeLevel to be allowed to call Lock */
339 /* DSOUND: Setting DirectSound cooperative level to
340 * DSSCL_WRITEPRIMARY */
341 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),
344 "IDirectSound8_SetCooperativeLevel(DSSCL_WRITEPRIMARY) failed: "
345 "%s\n",DXGetErrorString8(rc));
350 LPDIRECTSOUNDBUFFER temp_buffer;
352 rc=IDirectSoundBuffer_QueryInterface(*dsbo,&IID_IDirectSound3DBuffer,
354 ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface() failed: %s\n",
355 DXGetErrorString8(rc));
359 /* check the COM interface */
360 rc=IDirectSoundBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer,
361 (LPVOID *)&temp_buffer);
362 ok(rc==DS_OK && temp_buffer!=NULL,
363 "IDirectSoundBuffer_QueryInterface() failed: %s\n",
364 DXGetErrorString8(rc));
365 ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
367 ref=IDirectSoundBuffer_Release(temp_buffer);
368 ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
369 "should have 1\n",ref);
372 rc=IDirectSound3DBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer,
373 (LPVOID *)&temp_buffer);
374 ok(rc==DS_OK && temp_buffer!=NULL,
375 "IDirectSound3DBuffer_QueryInterface() failed: %s\n",
376 DXGetErrorString8(rc));
377 ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
379 ref=IDirectSoundBuffer_Release(temp_buffer);
380 ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
381 "should have 1\n",ref);
383 ref=IDirectSoundBuffer_Release(*dsbo);
384 ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
385 "should have 0\n",ref);
387 rc=IDirectSound3DBuffer_QueryInterface(buffer,
388 &IID_IDirectSoundBuffer,
390 ok(rc==DS_OK && *dsbo!=NULL,"IDirectSound3DBuffer_QueryInterface() "
391 "failed: %s\n",DXGetErrorString8(rc));
393 /* DSOUND: Error: Invalid buffer */
394 rc=IDirectSound3DBuffer_GetAllParameters(buffer,0);
395 ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() "
396 "failed: %s\n",DXGetErrorString8(rc));
398 ZeroMemory(&buffer_param, sizeof(buffer_param));
400 /* DSOUND: Error: Invalid buffer */
401 rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
402 ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() "
403 "failed: %s\n",DXGetErrorString8(rc));
405 buffer_param.dwSize=sizeof(buffer_param);
406 rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
407 ok(rc==DS_OK,"IDirectSound3DBuffer_GetAllParameters() failed: %s\n",
408 DXGetErrorString8(rc));
411 if (dsbcaps.dwFlags & DSBCAPS_CTRLVOLUME) {
413 rc=IDirectSoundBuffer_GetVolume(*dsbo,&val);
414 ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n",
415 DXGetErrorString8(rc));
417 rc=IDirectSoundBuffer_SetVolume(*dsbo,volume);
418 ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume() failed: %s\n",
419 DXGetErrorString8(rc));
421 /* DSOUND: Error: Buffer does not have CTRLVOLUME */
422 rc=IDirectSoundBuffer_GetVolume(*dsbo,&volume);
423 ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetVolume() "
424 "should have returned DSERR_CONTROLUNAVAIL, returned: %s\n",
425 DXGetErrorString8(rc));
430 if (dsbcaps.dwFlags & DSBCAPS_CTRLPAN) {
432 rc=IDirectSoundBuffer_GetPan(*dsbo,&val);
433 ok(rc==DS_OK,"IDirectSoundBuffer_GetPan() failed: %s\n",
434 DXGetErrorString8(rc));
436 rc=IDirectSoundBuffer_SetPan(*dsbo,pan);
437 ok(rc==DS_OK,"IDirectSoundBuffer_SetPan() failed: %s\n",
438 DXGetErrorString8(rc));
440 /* DSOUND: Error: Buffer does not have CTRLPAN */
441 rc=IDirectSoundBuffer_GetPan(*dsbo,&pan);
442 ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetPan() "
443 "should have returned DSERR_CONTROLUNAVAIL, returned: %s\n",
444 DXGetErrorString8(rc));
448 state.wave=wave_generate_la(&wfx,duration,&state.wave_len);
452 state.buffer_size=dsbcaps.dwBufferBytes;
453 state.played=state.written=state.offset=0;
454 buffer_refill8(&state,state.buffer_size);
456 rc=IDirectSoundBuffer_Play(*dsbo,0,0,DSBPLAY_LOOPING);
457 ok(rc==DS_OK,"IDirectSoundBuffer_Play() failed: %s\n",
458 DXGetErrorString8(rc));
460 rc=IDirectSoundBuffer_GetStatus(*dsbo,&status);
461 ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %s\n",
462 DXGetErrorString8(rc));
463 ok(status==(DSBSTATUS_PLAYING|DSBSTATUS_LOOPING),
464 "GetStatus: bad status: %lx\n",status);
467 ZeroMemory(&listener_param,sizeof(listener_param));
468 listener_param.dwSize=sizeof(listener_param);
469 rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param);
470 ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
471 "failed: %s\n",DXGetErrorString8(rc));
473 listener_param.vPosition.x = -5.0;
474 listener_param.vVelocity.x = 10.0/duration;
476 rc=IDirectSound3DListener_SetAllParameters(listener,
479 ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: %s\n",
480 DXGetErrorString8(rc));
484 buffer_param.vPosition.x = 100.0;
485 buffer_param.vVelocity.x = -200.0/duration;
487 buffer_param.flMinDistance = 10;
488 rc=IDirectSound3DBuffer_SetAllParameters(buffer,&buffer_param,
490 ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %s\n",
491 DXGetErrorString8(rc));
494 start_time=GetTickCount();
495 while (buffer_service8(&state)) {
496 WaitForSingleObject(GetCurrentProcess(),TIME_SLICE);
498 if (listener && move_listener) {
499 listener_param.vPosition.x = -5.0+10.0*(now-start_time)/
501 if (winetest_debug>2)
502 trace("listener position=%g\n",listener_param.vPosition.x);
503 rc=IDirectSound3DListener_SetPosition(listener,
504 listener_param.vPosition.x,listener_param.vPosition.y,
505 listener_param.vPosition.z,DS3D_IMMEDIATE);
506 ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: "
507 "%s\n",DXGetErrorString8(rc));
509 if (buffer3d && move_sound) {
510 buffer_param.vPosition.x = 100-200.0*(now-start_time)/
512 if (winetest_debug>2)
513 trace("sound position=%g\n",buffer_param.vPosition.x);
514 rc=IDirectSound3DBuffer_SetPosition(buffer,
515 buffer_param.vPosition.x,buffer_param.vPosition.y,
516 buffer_param.vPosition.z,DS3D_IMMEDIATE);
517 ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %s\n",
518 DXGetErrorString8(rc));
521 /* Check the sound duration was within 10% of the expected value */
523 ok(fabs(1000*duration-now+start_time)<=100*duration,
524 "The sound played for %ld ms instead of %g ms\n",
525 now-start_time,1000*duration);
529 /* Set the CooperativeLevel back to normal */
530 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
531 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
532 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) "
533 "failed: %s\n",DXGetErrorString8(rc));
536 ref=IDirectSound3DBuffer_Release(buffer);
537 ok(ref==0,"IDirectSound3DBuffer_Release() has %d references, "
538 "should have 0\n",ref);
543 static HRESULT test_secondary8(LPGUID lpGuid, int play,
544 int has_3d, int has_3dbuffer,
545 int has_listener, int has_duplicate,
546 int move_listener, int move_sound)
549 LPDIRECTSOUND8 dso=NULL;
550 LPDIRECTSOUNDBUFFER primary=NULL,secondary=NULL;
551 LPDIRECTSOUND3DLISTENER listener=NULL;
552 DSBUFFERDESC bufdesc;
553 WAVEFORMATEX wfx, wfx1;
556 /* Create the DirectSound object */
557 rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
558 ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n",
559 DXGetErrorString8(rc));
563 /* We must call SetCooperativeLevel before creating primary buffer */
564 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
565 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
566 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: "
567 "%s\n",DXGetErrorString8(rc));
571 ZeroMemory(&bufdesc, sizeof(bufdesc));
572 bufdesc.dwSize=sizeof(bufdesc);
573 bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
575 bufdesc.dwFlags|=DSBCAPS_CTRL3D;
577 bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
578 rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
579 ok((rc==DS_OK && primary!=NULL) || (rc == DSERR_CONTROLUNAVAIL),
580 "IDirectSound8_CreateSoundBuffer() failed to create a %sprimary buffer: "
581 "%s\n",has_3d?"3D ":"", DXGetErrorString8(rc));
582 if (rc == DSERR_CONTROLUNAVAIL)
583 trace(" No Primary\n");
584 else if (rc==DS_OK && primary!=NULL) {
585 rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
586 ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n",
587 DXGetErrorString8(rc));
592 rc=IDirectSoundBuffer_QueryInterface(primary,
593 &IID_IDirectSound3DListener,
595 ok(rc==DS_OK && listener!=NULL,
596 "IDirectSoundBuffer_QueryInterface() failed to get a 3D "
597 "listener %s\n",DXGetErrorString8(rc));
598 ref=IDirectSoundBuffer_Release(primary);
599 ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
600 "should have 0\n",ref);
601 if (rc==DS_OK && listener!=NULL) {
602 DS3DLISTENER listener_param;
603 ZeroMemory(&listener_param,sizeof(listener_param));
604 /* DSOUND: Error: Invalid buffer */
605 rc=IDirectSound3DListener_GetAllParameters(listener,0);
606 ok(rc==DSERR_INVALIDPARAM,
607 "IDirectSound3dListener_GetAllParameters() should have "
608 "returned DSERR_INVALIDPARAM, returned: %s\n",
609 DXGetErrorString8(rc));
611 /* DSOUND: Error: Invalid buffer */
612 rc=IDirectSound3DListener_GetAllParameters(listener,
614 ok(rc==DSERR_INVALIDPARAM,
615 "IDirectSound3dListener_GetAllParameters() should have "
616 "returned DSERR_INVALIDPARAM, returned: %s\n",
617 DXGetErrorString8(rc));
619 listener_param.dwSize=sizeof(listener_param);
620 rc=IDirectSound3DListener_GetAllParameters(listener,
622 ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
623 "failed: %s\n",DXGetErrorString8(rc));
629 init_format(&wfx,WAVE_FORMAT_PCM,22050,16,2);
631 ZeroMemory(&bufdesc, sizeof(bufdesc));
632 bufdesc.dwSize=sizeof(bufdesc);
633 bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
635 bufdesc.dwFlags|=DSBCAPS_CTRL3D;
638 (DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
639 bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000,
641 bufdesc.lpwfxFormat=&wfx;
643 /* a stereo 3D buffer should fail */
644 rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
645 ok(rc==DSERR_INVALIDPARAM,
646 "IDirectSound8_CreateSoundBuffer(secondary) should have "
647 "returned DSERR_INVALIDPARAM, returned %s\n",
648 DXGetErrorString8(rc));
650 ref=IDirectSoundBuffer_Release(secondary);
651 init_format(&wfx,WAVE_FORMAT_PCM,22050,16,1);
654 if (winetest_interactive) {
655 trace(" Testing a %s%ssecondary buffer %s%s%s%sat %ldx%dx%d "
656 "with a primary buffer at %ldx%dx%d\n",
657 has_3dbuffer?"3D ":"",
658 has_duplicate?"duplicated ":"",
659 listener!=NULL||move_sound?"with ":"",
660 move_listener?"moving ":"",
661 listener!=NULL?"listener ":"",
662 listener&&move_sound?"and moving sound ":move_sound?
664 wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
665 wfx1.nSamplesPerSec,wfx1.wBitsPerSample,wfx1.nChannels);
667 rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
668 ok(rc==DS_OK && secondary!=NULL,"IDirectSound8_CreateSoundBuffer() "
669 "failed to create a %s%ssecondary buffer %s%s%s%sat %ldx%dx%d (%s): %s\n",
670 has_3dbuffer?"3D ":"", has_duplicate?"duplicated ":"",
671 listener!=NULL||move_sound?"with ":"", move_listener?"moving ":"",
672 listener!=NULL?"listener ":"",
673 listener&&move_sound?"and moving sound ":move_sound?
675 wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
676 getDSBCAPS(bufdesc.dwFlags),DXGetErrorString8(rc));
677 if (rc==DS_OK && secondary!=NULL) {
679 LONG refvol,vol,refpan,pan;
681 /* Check the initial secondary buffer's volume and pan */
682 rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
683 ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(secondary) failed: "
684 "%s\n",DXGetErrorString8(rc));
685 ok(vol==0,"wrong volume for a new secondary buffer: %ld\n",vol);
686 rc=IDirectSoundBuffer_GetPan(secondary,&pan);
687 ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(secondary) failed: "
688 "%s\n",DXGetErrorString8(rc));
689 ok(pan==0,"wrong pan for a new secondary buffer: %ld\n",pan);
691 /* Check that changing the secondary buffer's volume and pan
692 * does not impact the primary buffer's volume and pan
694 rc=IDirectSoundBuffer_GetVolume(primary,&refvol);
695 ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: "
696 "%s\n",DXGetErrorString8(rc));
697 rc=IDirectSoundBuffer_GetPan(primary,&refpan);
698 ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: "
699 "%s\n",DXGetErrorString8(rc));
701 rc=IDirectSoundBuffer_SetVolume(secondary,-1000);
702 ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: "
703 "%s\n",DXGetErrorString8(rc));
704 rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
705 ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: "
706 "%s\n",DXGetErrorString8(rc));
707 ok(vol==-1000,"secondary: wrong volume %ld instead of -1000\n",
709 rc=IDirectSoundBuffer_SetPan(secondary,-1000);
710 ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: "
711 "%s\n",DXGetErrorString8(rc));
712 rc=IDirectSoundBuffer_GetPan(secondary,&pan);
713 ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: "
714 "%s\n",DXGetErrorString8(rc));
715 ok(pan==-1000,"secondary: wrong pan %ld instead of -1000\n",
718 rc=IDirectSoundBuffer_GetVolume(primary,&vol);
719 ok(rc==DS_OK,"IDirectSoundBuffer_`GetVolume(primary) failed: i"
720 "%s\n",DXGetErrorString8(rc));
721 ok(vol==refvol,"The primary volume changed from %ld to %ld\n",
723 rc=IDirectSoundBuffer_GetPan(primary,&pan);
724 ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: "
725 "%s\n",DXGetErrorString8(rc));
726 ok(pan==refpan,"The primary pan changed from %ld to %ld\n",
729 rc=IDirectSoundBuffer_SetVolume(secondary,0);
730 ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: "
731 "%s\n",DXGetErrorString8(rc));
732 rc=IDirectSoundBuffer_SetPan(secondary,0);
733 ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: "
734 "%s\n",DXGetErrorString8(rc));
737 LPDIRECTSOUNDBUFFER duplicated=NULL;
739 /* DSOUND: Error: Invalid source buffer */
740 rc=IDirectSound8_DuplicateSoundBuffer(dso,0,0);
741 ok(rc==DSERR_INVALIDPARAM,
742 "IDirectSound8_DuplicateSoundBuffer() should have returned "
743 "DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
745 /* DSOUND: Error: Invalid dest buffer */
746 rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary,0);
747 ok(rc==DSERR_INVALIDPARAM,
748 "IDirectSound8_DuplicateSoundBuffer() should have returned "
749 "DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
751 /* DSOUND: Error: Invalid source buffer */
752 rc=IDirectSound8_DuplicateSoundBuffer(dso,0,&duplicated);
753 ok(rc==DSERR_INVALIDPARAM,
754 "IDirectSound8_DuplicateSoundBuffer() should have returned "
755 "DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
758 rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary,
760 ok(rc==DS_OK && duplicated!=NULL,
761 "IDirectSound8_DuplicateSoundBuffer() failed to duplicate "
762 "a secondary buffer: %s\n",DXGetErrorString8(rc));
764 if (rc==DS_OK && duplicated!=NULL) {
765 ref=IDirectSoundBuffer_Release(secondary);
766 ok(ref==0,"IDirectSoundBuffer_Release() secondary has %d "
767 "references, should have 0\n",ref);
768 secondary=duplicated;
772 if (rc==DS_OK && secondary!=NULL) {
774 duration=(move_listener || move_sound?4.0:1.0);
775 test_buffer8(dso,&secondary,0,FALSE,0,FALSE,0,
776 winetest_interactive,duration,has_3dbuffer,
777 listener,move_listener,move_sound);
778 ref=IDirectSoundBuffer_Release(secondary);
779 ok(ref==0,"IDirectSoundBuffer_Release() %s has %d references, "
780 "should have 0\n",has_duplicate?"duplicated":"secondary",
787 ref=IDirectSound3DListener_Release(listener);
788 ok(ref==0,"IDirectSound3dListener_Release() listener has %d "
789 "references, should have 0\n",ref);
791 ref=IDirectSoundBuffer_Release(primary);
792 ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
793 "should have 0\n",ref);
796 /* Set the CooperativeLevel back to normal */
797 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
798 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
799 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: "
800 "%s\n",DXGetErrorString8(rc));
803 ref=IDirectSound8_Release(dso);
804 ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
806 return DSERR_GENERIC;
811 static HRESULT test_for_driver8(LPGUID lpGuid)
814 LPDIRECTSOUND8 dso=NULL;
817 /* Create the DirectSound object */
818 rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
819 ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
820 "DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
824 ref=IDirectSound8_Release(dso);
825 ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
827 return DSERR_GENERIC;
832 static HRESULT test_primary8(LPGUID lpGuid)
835 LPDIRECTSOUND8 dso=NULL;
836 LPDIRECTSOUNDBUFFER primary=NULL;
837 DSBUFFERDESC bufdesc;
841 /* Create the DirectSound object */
842 rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
843 ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n",
844 DXGetErrorString8(rc));
848 /* Get the device capabilities */
849 ZeroMemory(&dscaps, sizeof(dscaps));
850 dscaps.dwSize=sizeof(dscaps);
851 rc=IDirectSound8_GetCaps(dso,&dscaps);
852 ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc));
856 /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
857 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
858 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
859 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: "
860 "%s\n",DXGetErrorString8(rc));
864 /* Testing the primary buffer */
866 ZeroMemory(&bufdesc, sizeof(bufdesc));
867 bufdesc.dwSize=sizeof(bufdesc);
868 bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN;
869 rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
870 ok((rc==DS_OK && primary!=NULL) || (rc == DSERR_CONTROLUNAVAIL),
871 "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: "
872 "%s\n",DXGetErrorString8(rc));
873 if (rc == DSERR_CONTROLUNAVAIL)
874 trace(" No Primary\n");
875 else if (rc==DS_OK && primary!=NULL) {
876 test_buffer8(dso,&primary,1,TRUE,0,TRUE,0,winetest_interactive &&
877 !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
878 if (winetest_interactive) {
881 volume = DSBVOLUME_MAX;
882 for (i = 0; i < 6; i++) {
883 test_buffer8(dso,&primary,1,TRUE,volume,TRUE,0,
884 winetest_interactive &&
885 !(dscaps.dwFlags & DSCAPS_EMULDRIVER),
887 volume -= ((DSBVOLUME_MAX-DSBVOLUME_MIN) / 40);
891 for (i = 0; i < 7; i++) {
892 test_buffer8(dso,&primary,1,TRUE,0,TRUE,pan,
893 winetest_interactive &&
894 !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
895 pan += ((DSBPAN_RIGHT-DSBPAN_LEFT) / 6);
898 ref=IDirectSoundBuffer_Release(primary);
899 ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
900 "should have 0\n",ref);
903 /* Set the CooperativeLevel back to normal */
904 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
905 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
906 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: "
907 "%s\n",DXGetErrorString8(rc));
910 ref=IDirectSound8_Release(dso);
911 ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
913 return DSERR_GENERIC;
918 static HRESULT test_primary_3d8(LPGUID lpGuid)
921 LPDIRECTSOUND8 dso=NULL;
922 LPDIRECTSOUNDBUFFER primary=NULL;
923 DSBUFFERDESC bufdesc;
927 /* Create the DirectSound object */
928 rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
929 ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n",
930 DXGetErrorString8(rc));
934 /* Get the device capabilities */
935 ZeroMemory(&dscaps, sizeof(dscaps));
936 dscaps.dwSize=sizeof(dscaps);
937 rc=IDirectSound8_GetCaps(dso,&dscaps);
938 ok(rc==DS_OK,"IDirectSound8_GetCaps failed: %s\n",DXGetErrorString8(rc));
942 /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
943 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
944 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
945 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: "
946 "%s\n",DXGetErrorString8(rc));
951 ZeroMemory(&bufdesc, sizeof(bufdesc));
952 bufdesc.dwSize=sizeof(bufdesc);
953 bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
954 rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
955 ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed "
956 "to create a primary buffer: %s\n",DXGetErrorString8(rc));
957 if (rc==DS_OK && primary!=NULL) {
958 ref=IDirectSoundBuffer_Release(primary);
959 ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
960 "should have 0\n",ref);
962 ZeroMemory(&bufdesc, sizeof(bufdesc));
963 bufdesc.dwSize=sizeof(bufdesc);
964 bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
965 rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
966 ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() "
967 "failed to create a 3D primary buffer: %s\n",DXGetErrorString8(rc));
968 if (rc==DS_OK && primary!=NULL) {
969 test_buffer8(dso,&primary,1,FALSE,0,FALSE,0,
970 winetest_interactive &&
971 !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
972 ref=IDirectSoundBuffer_Release(primary);
973 ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
974 "should have 0\n",ref);
977 /* Set the CooperativeLevel back to normal */
978 /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
979 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
980 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: "
981 "%s\n",DXGetErrorString8(rc));
984 ref=IDirectSound8_Release(dso);
985 ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
987 return DSERR_GENERIC;
992 static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
995 LPDIRECTSOUND8 dso=NULL;
996 LPDIRECTSOUNDBUFFER primary=NULL;
997 DSBUFFERDESC bufdesc;
1001 /* Create the DirectSound object */
1002 rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
1003 ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n",
1004 DXGetErrorString8(rc));
1008 /* Get the device capabilities */
1009 ZeroMemory(&dscaps, sizeof(dscaps));
1010 dscaps.dwSize=sizeof(dscaps);
1011 rc=IDirectSound8_GetCaps(dso,&dscaps);
1012 ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc));
1016 /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
1017 /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
1018 rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
1019 ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: "
1020 "%s\n",DXGetErrorString8(rc));
1024 ZeroMemory(&bufdesc, sizeof(bufdesc));
1025 bufdesc.dwSize=sizeof(bufdesc);
1026 bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
1027 rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
1028 ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed "
1029 "to create a 3D primary buffer %s\n",DXGetErrorString8(rc));
1030 if (rc==DS_OK && primary!=NULL) {
1031 LPDIRECTSOUND3DLISTENER listener=NULL;
1032 rc=IDirectSoundBuffer_QueryInterface(primary,
1033 &IID_IDirectSound3DListener,
1034 (void **)&listener);
1035 ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() "
1036 "failed to get a 3D listener: %s\n",DXGetErrorString8(rc));
1037 if (rc==DS_OK && listener!=NULL) {
1038 LPDIRECTSOUNDBUFFER temp_buffer=NULL;
1040 /* Checking the COM interface */
1041 rc=IDirectSoundBuffer_QueryInterface(primary,
1042 &IID_IDirectSoundBuffer,
1043 (LPVOID *)&temp_buffer);
1044 ok(rc==DS_OK && temp_buffer!=NULL,
1045 "IDirectSoundBuffer_QueryInterface() failed: %s\n",
1046 DXGetErrorString8(rc));
1047 ok(temp_buffer==primary,"COM interface broken: %p != %p\n",temp_buffer,primary);
1048 if (rc==DS_OK && temp_buffer!=NULL) {
1049 ref=IDirectSoundBuffer_Release(temp_buffer);
1050 ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
1051 "should have 1\n",ref);
1054 rc=IDirectSound3DListener_QueryInterface(listener,
1055 &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
1056 ok(rc==DS_OK && temp_buffer!=NULL,
1057 "IDirectSoundBuffer_QueryInterface() failed: %s\n",
1058 DXGetErrorString8(rc));
1059 ok(temp_buffer==primary,"COM interface broken: %p != %p\n",temp_buffer,primary);
1060 ref=IDirectSoundBuffer_Release(temp_buffer);
1061 ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
1062 "should have 1\n",ref);
1064 /* Testing the buffer */
1065 test_buffer8(dso,&primary,1,FALSE,0,FALSE,0,
1066 winetest_interactive &&
1067 !(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1068 1.0,0,listener,0,0);
1071 /* Testing the reference counting */
1072 ref=IDirectSound3DListener_Release(listener);
1073 ok(ref==0,"IDirectSound3DListener_Release() listener has %d "
1074 "references, should have 0\n",ref);
1077 /* Testing the reference counting */
1078 ref=IDirectSoundBuffer_Release(primary);
1079 ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
1080 "should have 0\n",ref);
1084 ref=IDirectSound8_Release(dso);
1085 ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
1087 return DSERR_GENERIC;
1092 static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
1093 LPCSTR lpcstrModule, LPVOID lpContext)
1096 trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
1098 rc = test_for_driver8(lpGuid);
1099 if (rc == DSERR_NODRIVER) {
1100 trace(" No Driver\n");
1102 } else if (rc == DSERR_ALLOCATED) {
1103 trace(" Already In Use\n");
1105 } else if (rc == E_FAIL) {
1106 trace(" No Device\n");
1110 trace(" Testing the primary buffer\n");
1111 test_primary8(lpGuid);
1113 trace(" Testing 3D primary buffer\n");
1114 test_primary_3d8(lpGuid);
1116 trace(" Testing 3D primary buffer with listener\n");
1117 test_primary_3d_with_listener8(lpGuid);
1119 /* Testing secondary buffers */
1120 test_secondary8(lpGuid,winetest_interactive,0,0,0,0,0,0);
1121 test_secondary8(lpGuid,winetest_interactive,0,0,0,1,0,0);
1123 /* Testing 3D secondary buffers */
1124 test_secondary8(lpGuid,winetest_interactive,1,0,0,0,0,0);
1125 test_secondary8(lpGuid,winetest_interactive,1,1,0,0,0,0);
1126 test_secondary8(lpGuid,winetest_interactive,1,1,0,1,0,0);
1127 test_secondary8(lpGuid,winetest_interactive,1,0,1,0,0,0);
1128 test_secondary8(lpGuid,winetest_interactive,1,0,1,1,0,0);
1129 test_secondary8(lpGuid,winetest_interactive,1,1,1,0,0,0);
1130 test_secondary8(lpGuid,winetest_interactive,1,1,1,1,0,0);
1131 test_secondary8(lpGuid,winetest_interactive,1,1,1,0,1,0);
1132 test_secondary8(lpGuid,winetest_interactive,1,1,1,0,0,1);
1133 test_secondary8(lpGuid,winetest_interactive,1,1,1,0,1,1);
1138 static void ds3d8_tests(void)
1141 rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
1142 ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
1151 hDsound = LoadLibraryA("dsound.dll");
1153 trace("dsound.dll not found\n");
1157 trace("DLL Version: %s\n", get_file_version("dsound.dll"));
1159 pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8");
1160 if (!pDirectSoundCreate8) {
1161 trace("ds3d8 test skipped\n");