Alistair Leslie-Hughes : dsound: Primary buffer doesn't support flag DSBCAPS_CTRLFX.
Alexandre Julliard
julliard at winehq.org
Mon Apr 20 15:01:48 CDT 2020
Module: wine
Branch: oldstable
Commit: 017a0173ac1b3032f46a6e9590be0392d04e43a0
URL: https://source.winehq.org/git/wine.git/?a=commit;h=017a0173ac1b3032f46a6e9590be0392d04e43a0
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri Sep 27 03:46:55 2019 +0000
dsound: Primary buffer doesn't support flag DSBCAPS_CTRLFX.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40740
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit eabb3d444c4cd78381a096665133e286e0805267)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/dmime/performance.c | 1 +
dlls/dsound/dsound.c | 6 ++++++
dlls/dsound/tests/dsound8.c | 50 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index 6e4dae6be7..b7b4d01017 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -1064,6 +1064,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
/* Update description for creating primary buffer */
desc.dwFlags |= DSBCAPS_PRIMARYBUFFER;
+ desc.dwFlags &= ~DSBCAPS_CTRLFX;
desc.dwBufferBytes = 0;
desc.lpwfxFormat = NULL;
diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
index 2fbb3ce40d..6437d090ac 100644
--- a/dlls/dsound/dsound.c
+++ b/dlls/dsound/dsound.c
@@ -449,6 +449,12 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer(
return DSERR_INVALIDPARAM;
}
+ if (dsbd->dwFlags & DSBCAPS_CTRLFX)
+ {
+ WARN("Invalid parameter DSBCAPS_CTRLFX\n");
+ return DSERR_INVALIDPARAM;
+ }
+
if (device->primary) {
WARN("Primary Buffer already created\n");
IDirectSoundBuffer8_AddRef(&device->primary->IDirectSoundBuffer8_iface);
diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c
index fabd8a037e..b6f8c60c7e 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -1173,6 +1173,55 @@ static void test_COM(void)
while (IUnknown_Release(unk));
}
+static void test_primary_flags(void)
+{
+ HRESULT rc;
+ IDirectSound8 *dso;
+ IDirectSoundBuffer *primary = NULL;
+ IDirectSoundFXI3DL2Reverb *reverb;
+ DSBUFFERDESC bufdesc;
+ DSCAPS dscaps;
+
+ /* Create a DirectSound8 object */
+ rc = pDirectSoundCreate8(NULL, &dso, NULL);
+ ok(rc == DS_OK || rc==DSERR_NODRIVER, "Failed: %08x\n",rc);
+
+ if (rc!=DS_OK)
+ return;
+
+ rc = IDirectSound8_SetCooperativeLevel(dso, get_hwnd(), DSSCL_PRIORITY);
+ ok(rc == DS_OK,"Failed: %08x\n", rc);
+ if (rc != DS_OK) {
+ IDirectSound8_Release(dso);
+ return;
+ }
+
+ dscaps.dwSize = sizeof(dscaps);
+ rc = IDirectSound8_GetCaps(dso, &dscaps);
+ ok(rc == DS_OK,"Failed: %08x\n", rc);
+ trace("0x%x\n", dscaps.dwFlags);
+
+ ZeroMemory(&bufdesc, sizeof(bufdesc));
+ bufdesc.dwSize = sizeof(bufdesc);
+ bufdesc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLFX;
+ rc = IDirectSound8_CreateSoundBuffer(dso, &bufdesc, &primary, NULL);
+ ok(rc == E_INVALIDARG, "got %08x\n", rc);
+
+ ZeroMemory(&bufdesc, sizeof(bufdesc));
+ bufdesc.dwSize = sizeof(bufdesc);
+ bufdesc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRL3D;
+ rc = IDirectSound8_CreateSoundBuffer(dso, &bufdesc, &primary, NULL);
+ ok((rc == DS_OK && primary != NULL), "Failed to create a primary buffer: %08x\n", rc);
+ if (rc == DS_OK) {
+ rc = IDirectSoundBuffer_QueryInterface(primary, &IID_IDirectSoundFXI3DL2Reverb, (LPVOID*)&reverb);
+ ok(rc==E_NOINTERFACE,"Failed: %08x\n", rc);
+
+ IDirectSoundBuffer_Release(primary);
+ }
+
+ IDirectSound8_Release(dso);
+}
+
static void test_effects(void)
{
HRESULT rc;
@@ -1396,6 +1445,7 @@ START_TEST(dsound8)
dsound8_tests();
test_hw_buffers();
test_first_device();
+ test_primary_flags();
test_effects();
}
else
More information about the wine-cvs
mailing list