[PATCH] dsound: WAVEFORMATEXTENSIBLE wValidBitsPerSample can be 0

Maarten Lankhorst maarten at codeweavers.com
Sun Oct 14 11:49:22 CDT 2007


---
 dlls/dsound/dsound.c        |    4 ++--
 dlls/dsound/tests/dsound.c  |    9 +++++++++
 dlls/dsound/tests/dsound8.c |    9 +++++++++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
index 094f8f1..ea94713 100644
--- a/dlls/dsound/dsound.c
+++ b/dlls/dsound/dsound.c
@@ -1603,9 +1603,9 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
                 WARN("Samples.wValidBitsPerSample(%d) > Format.wBitsPerSample (%d)\n", pwfxe->Samples.wValidBitsPerSample, pwfxe->Format.wBitsPerSample);
                 return DSERR_INVALIDPARAM;
             }
-            if (pwfxe->Samples.wValidBitsPerSample < dsbd->lpwfxFormat->wBitsPerSample)
+            if (pwfxe->Samples.wValidBitsPerSample && pwfxe->Samples.wValidBitsPerSample < dsbd->lpwfxFormat->wBitsPerSample)
             {
-                FIXME("Non-packed formats not supported right now.\n");
+                FIXME("Non-packed formats not supported right now: %d/%d\n", pwfxe->Samples.wValidBitsPerSample, dsbd->lpwfxFormat->wBitsPerSample);
                 return DSERR_CONTROLUNAVAIL;
             }
         }
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 1146e5d..eaeb606 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -778,6 +778,15 @@ static HRESULT test_secondary(LPGUID lpGuid)
                 IDirectSoundBuffer_Release(secondary);
             --wfxe.Samples.wValidBitsPerSample;
 
+            wfxe.Samples.wValidBitsPerSample = 0;
+            rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+            ok(rc==DS_OK && secondary,
+                "IDirectSound_CreateSoundBuffer() returned: %s %p\n",
+                DXGetErrorString8(rc), secondary);
+            if (secondary)
+                IDirectSoundBuffer_Release(secondary);
+            wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample;
+
             rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
             ok(rc==DS_OK && secondary!=NULL,
                 "IDirectSound_CreateSoundBuffer() failed to create a secondary "
diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c
index a535665..e08767e 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -809,6 +809,15 @@ static HRESULT test_secondary8(LPGUID lpGuid)
                 IDirectSoundBuffer_Release(secondary);
             --wfxe.Samples.wValidBitsPerSample;
 
+            wfxe.Samples.wValidBitsPerSample = 0;
+            rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
+            ok(rc==DS_OK && secondary,
+                "IDirectSound_CreateSoundBuffer() returned: %s %p\n",
+                DXGetErrorString8(rc), secondary);
+            if (secondary)
+                IDirectSoundBuffer_Release(secondary);
+            wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample;
+
             rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
             ok(rc==DS_OK && secondary!=NULL,
                 "IDirectSound_CreateSoundBuffer() failed to create a secondary "
-- 
1.5.2.5


--------------050204040200000409060903--



More information about the wine-patches mailing list