Obtaining the 3D Buffer Object

The IDirectSound3DBuffer8 interface is obtained from a secondary DirectSound buffer that has been created with the DSBCAPS_CTRL3D flag in the dwFlags member of the DSBUFFERDESC structure.

You can retrieve the IDirectSound3DBuffer8 interface by calling QueryInterface method on the buffer, as in the following sample code, where lpDsbSecondary is an IDirectSoundBuffer8 interface.

LPDIRECTSOUND3DBUFFER8 lpDs3dBuffer;
 
HRESULT hr = lpDsbSecondary->QueryInterface(IID_IDirectSound3DBuffer8, 
                (LPVOID *)&lpDs3dBuffer);