Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


3D Sound

This topic is 5331 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 hope anybody could help me. I have a weird problem going on with 3DSound using Direct Audio 8.1. I have ONE global 3D listener object managed by my audio-engine which I get from the primary sound buffer like this:
ZeroMemory(&dsbd, sizeof(DSBUFFERDESC));
dsbd.dwSize = sizeof(DSBUFFERDESC);

if SUCCEEDED(directSound->CreateSoundBuffer(&dsbd, &lpdsbPrimary, NULL))
	// Get listener interface.

	if FAILED(lpdsbPrimary->QueryInterface(IID_IDirectSound3DListener8,(void**)&listener3D))
		cerr << "Failed to get 3D audio listener in audio path." << endl;
everything works fine here and I don't get any errors. BUT whenever I try to change the position of my listender nothing happens!!! i.e. listener3D->SetPosition(10.0f, 0.0f, 10.0f, DS3D_IMMEDIATE); the listener seems to be stuck to my gameworld origin (because the closer I am to 0/0 the louder the sound - which plays on a 3D audio-path gets) Does anybody have an idea what's going on here? Thanks in advance! [edited by - melonjelly on August 29, 2002 2:56:35 AM]

Share this post

Link to post
Share on other sites
hmmm... nobody has an idea? hmm...
Unfortunately I still have not figured out what''s going on...

Either my 3D soundbuffers don''t move as expected or my 3D listener does not change its position.

Please help!

Share this post

Link to post
Share on other sites
You need to set the position of two things: The listener and the sound.

From what you describe you are not setting the sound position. Therefore it stays at its default position 0,0,0. Also setting the min and max range is important as it will affect how far away you must move before the volume changes.

You will need get get a DirectSound3DBuffer interface, and call the SetPosition function.


John Reynolds
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
Hi,this is my source from 3Dsound.cpp, it works fine.
// Name: Set3DPosition()
// Desc: Set the 3D buffer parameters
// iID is the soundbuffer
// xp, yp, zp are the cartians vector values. default in meters''s
// Example: 0,0,0 is normal position.
// -10,0,10 is left front speaker
// 10,0,10 is right front speaker
// 10,0,-10 is right rear speaker
// -10,0,-10 is left rear speaker
// the yp has no efffect i think..?
BOOL Set3DPosition(int iID,float xp, float yp, float zp)
// Get the 3D buffer from the secondary buffer
if( FAILED( hr = g_pSound[iID]->Get3DBufferInterface( 0, &g_pDS3DBuffer ) ) )
MessageBox( NULL, "Could not get 3D buffer.",
" PuppetShow",

return FALSE;


return TRUE;

} // end Set3DPosition

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!