# 3D Sound programming with DirectX or Windows SDK (DirectShow)

## Recommended Posts

Hi all ,

I looked at forum topics , still not sure if the question is for the right place
but sorry if it does not fit here

To implement 3D Sound , in all examples I have seen , people are using
DirectMusic with DirectSound.

Actually what I am looking for is either of these :

1. Implementing with Directshow , I am ok with Directshow but I dont know how to use 3DListener interfaces with them if it is possible

2. Implementing with only DirectSound and getting rid of DirectMusic. Since DMusic is deprecated.

Id appreciate it any answer

##### Share on other sites
I use just DirectSound. Actually, I'm not familiar with DirectShow or DirectMusic so that's a default.

I create the DirectSound object and set the speaker config to DSSPEAKER_HEADPHONE for the best effect.

I create one or more sound buffers for the desired sound(s) with creation parameters = DSBCAPS_CTRL3D and guid3DAlgorithm = DS3DALG_HRTF_FULL.

I get (and retain) the 3dlistener interface from the primary buffer.

During gameplay, in my update function, I set the sound buffer parameters to reflect the current position of the sound(s), and set the 3dlistener params to my player's current position and direction.

Then.. play the sound(s).

##### Share on other sites
You should look into XAudio2, it's pretty standard now. I haven't tried 3D sounds with it yet, but from I've just quickly looked up, the X3DAudio API seems to work well with it. It only took me a few hours in a couple days to get from not knowing a thing about XAudio2 to having a working sound engine.

http://msdn.microsoft.com/en-us/library/ee415737(v=VS.85).aspx

##### Share on other sites
Quote:
 Original post by YartchYou should look into XAudio2, it's pretty standard now. I haven't tried 3D sounds with it yet, but from I've just quickly looked up, the X3DAudio API seems to work well with it. It only took me a few hours in a couple days to get from not knowing a thing about XAudio2 to having a working sound engine.http://msdn.microsoft.com/en-us/library/ee415737(v=VS.85).aspx

I would second that. Having just started my journey with DirectX, I have to say XAudio2 is the way to go.

## 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

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627636
• Total Posts
2978319

• 10
• 12
• 22
• 13
• 33