dsound test: Remove unneeded Caps/3D test

Robert Reif reif at earthlink.net
Sun Jul 18 17:21:16 CDT 2004


Please don't apply this patch. The point of the test is to test the 
QueryInterface reference
counting which you just removed.  Please just fix the flag bug and not 
remove the point of
the test.

Francois Gouget wrote:

> This fixes another dsound Windows crash: we first create a buffer 
> without DSBCAPS_CTRL3D, then we query the IDirectSound3DBuffer on it 
> which obviously fails so that we try to do an AddRef on a NULL pointer 
> (buffer3d).
>
> But this 3D buffer is not really needed for this test since we already 
> have the secondary buffer reference. Also MSDN recommends only using 
> CDSBCAPS_TRL3D when necessary because DirectSound can optimize things 
> when it's not specified. It may not yet be the case in Wine but I'd 
> prefer to keep the dsound.c test as simple as possible. So I removed 
> all references to this 3D buffer. I also went through the caps we 
> request on our buffers and remove all the unneeded ones.
>
>
> Changelog:
>
>  * dlls/dsound/tests/dsound.c
>
>    Francois Gouget <fgouget at codeweavers.com>
>    Don't try to create a IDirectSound3DBuffer, partly to keep this 
> test simple and partly because it's going to fail since we did not 
> request DSBCAPS_CTRL3D. Fixes a crash on Windows.
>    Don't request unneeded caps.
>
>------------------------------------------------------------------------
>
>Index: dlls/dsound/tests/dsound.c
>===================================================================
>RCS file: /var/cvs/wine/dlls/dsound/tests/dsound.c,v
>retrieving revision 1.24
>diff -u -r1.24 dsound.c
>--- dlls/dsound/tests/dsound.c	13 Jul 2004 23:35:09 -0000	1.24
>+++ dlls/dsound/tests/dsound.c	16 Jul 2004 17:07:59 -0000
>@@ -336,18 +342,13 @@
>         init_format(&wfx,WAVE_FORMAT_PCM,11025,8,1);
>         ZeroMemory(&bufdesc, sizeof(bufdesc));
>         bufdesc.dwSize=sizeof(bufdesc);
>-        bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
>-        bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
>+        bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLVOLUME;
>         bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
>         bufdesc.lpwfxFormat=&wfx;
>         rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
>         ok(rc==DS_OK && secondary!=NULL,"CreateSoundBuffer failed to create a secondary buffer 0x%lx\n", rc);
>         if (rc==DS_OK && secondary!=NULL) {
>-            LPDIRECTSOUND3DBUFFER buffer3d;
>-            rc=IDirectSound_QueryInterface(secondary, &IID_IDirectSound3DBuffer, (void **)&buffer3d);
>-            ok(rc==DS_OK && buffer3d!=NULL,"QueryInterface failed:  %s\n",DXGetErrorString9(rc));
>             /* add some more refs */
>-            IDirectSound3DBuffer_AddRef(buffer3d);
>             IDirectSoundBuffer_AddRef(secondary);
>         }
>         /* release with buffer */
>@@ -459,18 +460,13 @@
>         init_format(&wfx,WAVE_FORMAT_PCM,11025,8,1);
>         ZeroMemory(&bufdesc, sizeof(bufdesc));
>         bufdesc.dwSize=sizeof(bufdesc);
>-        bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
>-        bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
>+        bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLVOLUME;
>         bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
>         bufdesc.lpwfxFormat=&wfx;
>         rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
>         ok(rc==DS_OK && secondary!=NULL,"CreateSoundBuffer failed to create a secondary buffer 0x%lx\n", rc);
>         if (rc==DS_OK && secondary!=NULL) {
>-            LPDIRECTSOUND3DBUFFER buffer3d;
>-            rc=IDirectSound8_QueryInterface(secondary, &IID_IDirectSound3DBuffer, (void **)&buffer3d);
>-            ok(rc==DS_OK && buffer3d!=NULL,"QueryInterface failed:  %s\n",DXGetErrorString9(rc));
>             /* add some more refs */
>-            IDirectSound3DBuffer_AddRef(buffer3d);
>             IDirectSoundBuffer8_AddRef(secondary);
>         }
>         /* release with buffer */
>@@ -614,7 +617,6 @@
>     ZeroMemory(&bufdesc, sizeof(bufdesc));
>     bufdesc.dwSize=sizeof(bufdesc);
>     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
>-    bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
>     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
>     ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a primary buffer 0x%lx\n", rc);
> 
>@@ -625,7 +627,6 @@
>             ZeroMemory(&bufdesc, sizeof(bufdesc));
>             bufdesc.dwSize=sizeof(bufdesc);
>             bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
>-            bufdesc.dwFlags|=(DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
>             bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
>             bufdesc.lpwfxFormat=&wfx;
>             trace("  Testing a secondary buffer at %ldx%dx%d\n",
>  
>





More information about the wine-patches mailing list