Jump to content
  • Advertisement
Sign in to follow this  
davethebrave

Error querying 3DListenerInterface

This topic is 4622 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
hi,

You made sure that you put CoInitialize() in the front of all of this, right?
You also made sure that you put CoUnitnitialize() at the end of you program, right?

Hope this works,
ProgrammingNerd

Share this post


Link to post
Share on other sites
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!