Sign in to follow this  
davethebrave

Error querying 3DListenerInterface

Recommended Posts

davethebrave    122
Hi! I try to get the li3dListener Interface from my IDirectSound8. DSBUFFERDESC is filled with DSBCAPS_CTRL3D | BufferDesc.guid3DAlgorithm and DS3DALG_DEFAULT. the last hr allways gives me a E_NOINTERFACE. Any suggestions? [cpp] // Listener LPDIRECTSOUND3DLISTENER8 pListener; // Die IDirectSound8-Schnittstelle LPDIRECTSOUND8 pDSound; // Primärer Soundpuffer LPDIRECTSOUNDBUFFER pPrimaryBuffer; HWND hWnd = GetForegroundWindow(); HRESULT hr; DSBUFFERDESC BufferDesc; ZeroMemory(&BufferDesc, sizeof(DSBUFFERDESC)); BufferDesc.dwSize = sizeof(DSBUFFERDESC); BufferDesc.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_PRIMARYBUFFER; BufferDesc.dwBufferBytes = 0; BufferDesc.dwReserved = 0; BufferDesc.lpwfxFormat = NULL; BufferDesc.guid3DAlgorithm = DS3DALG_DEFAULT; // DirectSound-Schnittstelle generieren hr = DirectSoundCreate8(NULL, &pDSound, NULL); // Kooperationsebene setzen hr = pDSound->SetCooperativeLevel(hWnd, DSSCL_PRIORITY); // Primären Soundpuffer erstellen hr = pDSound->CreateSoundBuffer(&BufferDesc, &pPrimaryBuffer, NULL); // Listener holen hr = pDSound->QueryInterface(IID_IDirectSound3DListener8, (LPVOID *)&pListener); [/cpp]

Share this post


Link to post
Share on other sites
davethebrave    122
I put that stuff in a win32 project, and replaced the
HWND hWnd = GetForegroundWindow();
with the HWND I got from CreateWindow()


I also tried to run the example from
http://msdn.microsoft.com/library/en-us/directx9_c/Obtaining_the_3D_Listener.asp?frame=true

no change, and still no clue what´s wrong

Share this post


Link to post
Share on other sites
davethebrave    122
argh...solved!

BAD: hr = pDSound->QueryInterface(IID_IDirectSound3DListener8, (LPVOID *)&pListener);
GOOD: hr = pDSound->QueryInterface(IID_IDirectSound3DListener8, (LPVOID *)pListener);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this