diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index 9a2653f7e8..b31755e611 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -453,6 +453,136 @@ EXIT: return rc; } +/* + * Test the primary buffer at different formats while keeping the + * secondary buffer at a constant format. + */ +static HRESULT test_primary_secondary(LPGUID lpGuid) +{ + HRESULT rc; + LPDIRECTSOUND dso=NULL; + LPDIRECTSOUNDBUFFER primary=NULL,secondary=NULL; + DSBUFFERDESC bufdesc; + DSCAPS dscaps; + WAVEFORMATEX wfx, wfx2; + int f,ref; + + /* Create the DirectSound object */ + rc=DirectSoundCreate(lpGuid,&dso,NULL); + ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc)); + if (rc!=DS_OK) + return rc; + + /* Get the device capabilities */ + ZeroMemory(&dscaps, sizeof(dscaps)); + dscaps.dwSize=sizeof(dscaps); + rc=IDirectSound_GetCaps(dso,&dscaps); + ok(rc==DS_OK,"IDirectSound_GetCaps failed: %s\n",DXGetErrorString8(rc)); + if (rc!=DS_OK) + goto EXIT; + + /* We must call SetCooperativeLevel before creating primary buffer */ + /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ + rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); + ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) + goto EXIT; + + ZeroMemory(&bufdesc, sizeof(bufdesc)); + bufdesc.dwSize=sizeof(bufdesc); + bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; + rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); + ok(rc==DS_OK && primary!=NULL, + "IDirectSound_CreateSoundBuffer failed to create a primary buffer %s\n", + DXGetErrorString8(rc)); + + if (rc==DS_OK && primary!=NULL) { + for (f=0;f