From: Jon Koops <jonkoops@gmail.com> Signed-off-by: Jon Koops <jonkoops@gmail.com> --- dlls/dsound/tests/dsound.c | 90 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index a7d6fa0fc3b..4821701353c 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -2192,6 +2192,95 @@ static void test_implicit_mta(void) ok(test_apt_data.type == APTTYPE_UNITIALIZED, "got apt type %d.\n", test_apt_data.type); } +static void test_primary_independent(void) +{ + HRESULT rc; + LPDIRECTSOUND dso1=NULL; + LPDIRECTSOUND dso2=NULL; + LPDIRECTSOUNDBUFFER primary1=NULL; + LPDIRECTSOUNDBUFFER primary2=NULL; + DSBUFFERDESC bufdesc; + DSBCAPS bufcaps; + LONG vol; + + rc=DirectSoundCreate(NULL,&dso1,NULL); + ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, + "DirectSoundCreate() failed: %08lx\n",rc); + if (rc!=DS_OK) + return; + + rc=DirectSoundCreate(NULL,&dso2,NULL); + ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, + "DirectSoundCreate() failed: %08lx\n",rc); + if (rc!=DS_OK) { + IDirectSound_Release(dso1); + return; + } + + rc=IDirectSound_SetCooperativeLevel(dso1,get_hwnd(),DSSCL_PRIORITY); + ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(dso1) failed: %08lx\n",rc); + if (rc!=DS_OK) + goto EXIT; + + rc=IDirectSound_SetCooperativeLevel(dso2,get_hwnd(),DSSCL_PRIORITY); + ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(dso2) failed: %08lx\n",rc); + if (rc!=DS_OK) + goto EXIT; + + /* Create a primary buffer on dso1 with CTRL3D but without CTRLVOLUME */ + ZeroMemory(&bufdesc, sizeof(bufdesc)); + bufdesc.dwSize=sizeof(bufdesc); + bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D; + rc=IDirectSound_CreateSoundBuffer(dso1,&bufdesc,&primary1,NULL); + ok(rc==DS_OK && primary1!=NULL, + "IDirectSound_CreateSoundBuffer(dso1) failed: %08lx\n",rc); + if (rc!=DS_OK || primary1==NULL) + goto EXIT; + + /* Create a primary buffer on dso2 with CTRLVOLUME */ + ZeroMemory(&bufdesc, sizeof(bufdesc)); + bufdesc.dwSize=sizeof(bufdesc); + bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME; + rc=IDirectSound_CreateSoundBuffer(dso2,&bufdesc,&primary2,NULL); + ok(rc==DS_OK && primary2!=NULL, + "IDirectSound_CreateSoundBuffer(dso2) failed: %08lx\n",rc); + if (rc!=DS_OK || primary2==NULL) + goto RELEASE1; + + /* Check whether the two IDirectSound objects share a primary buffer */ + todo_wine + ok(primary1!=primary2, + "Two IDirectSound objects should have independent primary buffers\n"); + + /* GetVolume on dso2's primary buffer should succeed */ + todo_wine + { + rc=IDirectSoundBuffer_GetVolume(primary2,&vol); + ok(rc==DS_OK, + "IDirectSoundBuffer_GetVolume(primary2) failed: %08lx\n",rc); + } + + /* Verify dso2's primary buffer has CTRLVOLUME */ + ZeroMemory(&bufcaps, sizeof(bufcaps)); + bufcaps.dwSize=sizeof(bufcaps); + rc=IDirectSoundBuffer_GetCaps(primary2,&bufcaps); + ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps(primary2) failed: %08lx\n",rc); + if (rc==DS_OK) { + todo_wine + ok(bufcaps.dwFlags & DSBCAPS_CTRLVOLUME, + "primary2 should have DSBCAPS_CTRLVOLUME: %08lx\n",bufcaps.dwFlags); + } + + IDirectSoundBuffer_Release(primary2); + +RELEASE1: + IDirectSoundBuffer_Release(primary1); + +EXIT: + IDirectSound_Release(dso2); + IDirectSound_Release(dso1); +} + START_TEST(dsound) { CoInitialize(NULL); @@ -2201,6 +2290,7 @@ START_TEST(dsound) IDirectSound_tests(); dsound_tests(); test_hw_buffers(); + test_primary_independent(); CoUninitialize(); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10726