IAMDirectSound Interface


The IAMDirectSound interface provides access from Microsoft® DirectShow™ to Microsoft DirectX™ audio interfaces, such as IDirectSound and IDirectSoundBuffer. This allows you to play back the audio portions of DirectShow-compatible media files anywhere within the 3D space of a DirectX application, making your applications much more absorbing and lifelike.

Once you connect the media source file to a sound renderer on a filter graph, you can use DirectSound's functionality to position or manipulate the sound playback as needed. For more information on the relevant DirectSound interfaces and methods, see the DirectX SDK documentation. Once you finish with an interface you obtained through IAMDirectSound, be sure to release it by calling the appropriate method. If you disconnect the sound renderer from the graph before releasing the interfaces, your application might fail.

The DSound Audio Renderer filter implements this interface; for additional information on how to use this filter in your applications, see Use the DSound Audio Renderer.

When to Implement

This interface is implemented by the DSound Audio Renderer filter.

When to Use

The DSound Audio Renderer filter uses this interface; it is not intended for other uses.

Methods in Vtable Order
IUnknown Methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IAMDirectSound Methods Description
GetDirectSoundInterface Retrieves a handle to the current sound device's IDirectSound interface.
GetPrimaryBufferInterface Retrieves a handle to the current sound device's primary sound buffer.
GetSecondaryBufferInterface Retrieves a handle to the current sound device's secondary sound buffer.
ReleaseDirectSoundInterface Releases the current sound device's IDirectSound interface.
ReleasePrimaryBufferInterface Releases the current sound device's primary sound buffer.
ReleaseSecondaryBufferInterface Releases the current sound device's secondary sound buffer.
SetWindowFocus Sets the window that will handle sound playback for the current media file.
GetWindowFocus Retrieves the window that is handling sound playback for the current media file.


IAMDirectSound::GetDirectSoundInterface

IAMDirectSound Interface

Retrieves a handle to the current sound device's IDirectSound interface.

HRESULT IAMDirectSound::GetDirectSoundInterface(
  LPDIRECTSOUND *lplpds
  );

Parameters
lplpds
Address of a pointer to an IDirectSound interface that will point to the current sound device's interface.
Return Values

Returns one of the following values.
Value Meaning
E_FAIL No sound device is available.
E_INVALIDARG The lplpds parameter is null.
E_NOTIMPL DirectSound isn't installed.
NOERROR The method succeeded.


IAMDirectSound::GetPrimaryBufferInterface

IAMDirectSound Interface

Retrieves a handle to the current sound device's primary sound buffer.

HRESULT IAMDirectSound::GetDirectSoundInterface(
  LPDIRECTSOUNDBUFFER *lplpdsb
  );

Parameters
lplpdsb
Address of a pointer to an IDirectSoundBuffer interface that will point to the current sound device's primary sound buffer.
Return Values

Returns one of the following values.
Value Meaning
E_FAIL No sound device is available.
E_INVALIDARG The lplpdsb parameter is null.
E_NOTIMPL DirectSound isn't installed.
NOERROR The method succeeded.


IAMDirectSound::GetSecondaryBufferInterface

IAMDirectSound Interface

Retrieves a handle to the current sound device's secondary sound buffer.

HRESULT IAMDirectSound::GetSecondaryBufferInterface(
  LPDIRECTSOUNDBUFFER *lplpdsb
  );

Parameters
lplpdsb
Address of a pointer to an IDirectSoundBuffer interface. On exit, it will point to the current sound device's secondary sound buffer.
Return Values

Returns one of the following values.
Value Meaning
E_FAIL No sound device is available.
E_INVALIDARG The lplpdsb parameter is null.
E_NOTIMPL DirectSound isn't installed.
NOERROR The method succeeded.


IAMDirectSound::GetWindowFocus

IAMDirectSound Interface

Retrieves the window that is handling sound playback for the current media file.

HRESULT IAMDirectSound::GetWindowFocus(
  HWND* hWnd,
  BOOL bMixingOnOrOff
  );

Parameters
hWnd
Handle to the sound playback window. If this value is null, the sound isn't associated with a window; note that Windows NT 4.0 does not currently support windowless sound playback.
bMixingOnOrOff
Value indicating whether to mix the sound (TRUE) or not (FALSE).
Return Values

Returns one of the following values.
Value Meaning
E_FAIL No sound device is available.
E_INVALIDARG The hWnd argument is invalid.
E_NOTIMPL DirectSound isn't installed.
NOERROR The method succeeded.


IAMDirectSound::ReleaseDirectSoundInterface

IAMDirectSound Interface

Releases the current sound device's IDirectSound interface.

HRESULT IAMDirectSound::ReleaseDirectSoundInterface(
  LPDIRECTSOUND lpds
  );

Parameters
lpds
Pointer to the IDirectSound interface to release.
Return Values

Returns one of the following values.
Value Meaning
E_FAIL There are no references to the specified IDirectSound interface, so it can't be released.
E_INVALIDARG The lpds parameter is null.
NOERROR The method succeeded.


IAMDirectSound::ReleasePrimaryBufferInterface

IAMDirectSound Interface

Releases the current sound device's primary sound buffer.

HRESULT IAMDirectSound::ReleasePrimaryBufferInterface(
  LPDIRECTSOUNDBUFFER lpdsb
  );

Parameters
lpdsb
Pointer to the IDirectSoundBuffer interface to release.
Return Values

Returns one of the following values.
Value Meaning
E_FAIL There are no references to the specified IDirectSoundBuffer interface, so it can't be released.
E_INVALIDARG The lpdsb parameter is null.
NOERROR The method succeeded.


IAMDirectSound::ReleaseSecondaryBufferInterface

IAMDirectSound Interface

Releases the current sound device's secondary sound buffer.

HRESULT IAMDirectSound::ReleaseSecondaryBufferInterface(
  LPDIRECTSOUNDBUFFER lpdsb
  );

Parameters
lpdsb
Pointer to the IDirectSoundBuffer interface to release.
Return Values

Returns one of the following values.
Value Meaning
E_FAIL There are no references to the specified IDirectSoundBuffer interface, so it can't be released.
E_INVALIDARG The lpdsb parameter is null.
NOERROR The method succeeded.


IAMDirectSound::SetWindowFocus

IAMDirectSound Interface

Sets the window that will handle sound playback for the current media file.

HRESULT IAMDirectSound::SetWindowFocus(
  HWND hWnd,
  BOOL bMixingOnOrOff
  );

Parameters
hWnd
Handle to the sound playback window. If this value is null, the sound will not be associated with any window; note that Windows NT 4.0 does not currently support windowless sound playback.
bMixingOnOrOff
Value indicating whether to mix the sound (TRUE) or not (FALSE).
Return Values

Returns one of the following values.
Value Meaning
E_FAIL No sound device is available.
E_INVALIDARG The hWnd argument is invalid.
E_NOTIMPL DirectSound isn't installed.
NOERROR The method succeeded.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.