Jump to content
  • Advertisement
Sign in to follow this  
zfathya

IDirectSound3DBuffer8 vs IDirectSoundBuffer8

This topic is 4811 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 would like to set the frequency (at which the audio samples are played) of an IDirectSound3DBuffer8 object, which parameter of the interface could do the job ? I know that IDirectSoundBuffer8 have the SetFrequency and GetFrequency methods to do that. Thanks Fathya

Share this post


Link to post
Share on other sites
Advertisement
zfathya,

The IDirectSoundBuffer8 interface and the IDirectSound3DBuffer8 are two interfaces exposed by the same object. They are just two different ways of interacting with it. What this means is that you can use the two in conjunction to manipulate the quality AND location of a sound.

In practice this means you can get an IDirectSoundBuffer8 interface. And then use the COM QueryInterface function to get access to the IDirectSound3DBuffer8 interface for that object.

Here's the code:



// Use this to create an IDirectSoundBuffer
// Make sure the DSBUFFERDESC struct contains DSBCAPS_CTRL3D enabled
HRESULT CreateSoundBuffer(
LPCDSBUFFERDESC pcDSBufferDesc, LPDIRECTSOUNDBUFFER * ppDSBuffer, LPUNKNOWN pUnkOuter );

// Once you've got the sound buffer, use QueryInterface to get the IDirectSoundBuffer8 Interface
ppDSBuffer->QueryInterface( IID_IDirectSoundBuffer8, (void**)&pSoundBuffer );

// Now you can use the pSoundBuffer to set frequency, etc...
// But you can also use it to get the 3d sound interface
pSoundBuffer->QueryInterface( IID_IDirectSound3DBuffer, (void**)pSoundBuffer3D );



Now you can use the two interfaces, pSoundBuffer and pSoundBuffer3D to set the positions, frequency, pan, position, etc...in combination.

Hope this helps, mate! Good luck!

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.

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!