## IAMDirectSound Interface

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

After 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. After 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.

Note Only the GetWindowFocus and SetWindowFocus methods are currently implemented for this interface.

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.

If you are using a WDM video capture filter, you can only query an output pin for this interface if the capture filter is connected to another filter in the graph.

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. Not currently implemented.
GetPrimaryBufferInterface | Retrieves a handle to the current sound device's primary sound buffer. Not currently implemented.
GetSecondaryBufferInterface | Retrieves a handle to the current sound device's secondary sound buffer. Not currently implemented.
ReleaseDirectSoundInterface | Releases the current sound device's IDirectSound interface. Not currently implemented.
ReleasePrimaryBufferInterface | Releases the current sound device's primary sound buffer. Not currently implemented.
ReleaseSecondaryBufferInterface | Releases the current sound device's secondary sound buffer. Not currently implemented.
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. Not currently implemented.

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. Not currently implemented.

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. Not currently implemented.

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. Not currently implemented.

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. Not currently implemented.

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. Not currently implemented.

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.