Microsoft DirectX 9.0

IDirectSoundBuffer8 Interface

The IDirectSoundBuffer8 interface is used to manage sound buffers.

The IDirectSoundBuffer8 interface supersedes IDirectSoundBuffer and adds new methods.

To obtain the interface, use the IDirectSound8::CreateSoundBuffer method to retrieve IDirectSoundBuffer, and then pass IID_IDirectSoundBuffer8 to IDirectSoundBuffer::QueryInterface.

For the primary buffer, you must use the IDirectSoundBuffer interface; IDirectSoundBuffer8 is not available. IDirectSoundBuffer is not documented separately. For documentation, see the corresponding IDirectSoundBuffer8 methods.

Not all methods of IDirectSoundBuffer are valid for primary buffers. For example, SetCurrentPosition will fail. See the reference topics for individual methods.

In addition to the methods inherited from IUnknown, the IDirectSoundBuffer8 interface exposes the following methods, arranged by category.

Effects

Method Description
GetObjectInPath Retrieves an interface for an effect object associated with the buffer.
SetFX Enables effects on a buffer.

Resource management

Method Description
AcquireResources Allocates resources for a buffer that was created with the DSBCAPS_LOCDEFER flag.
Restore Restores the memory allocation for a lost sound buffer

Play management

Method Description
GetCurrentPosition Retrieves the position of the play and write cursors in the sound buffer.
Lock Readies all or part of the buffer for a data write and returns pointers to which data can be written.
Play Causes the sound buffer to play, starting at the play cursor.
SetCurrentPosition Sets the position of the play cursor, which is the point at which the next byte of data is read from the buffer.
Stop Causes the sound buffer to stop playing.
Unlock Releases a locked sound buffer.

Sound parameters

Method Description
GetFrequency Retrieves the frequency, in samples per second, at which the buffer is playing.
GetPan Retrieves the relative volume of the left and right audio channels.
GetVolume Retrieves the attenuation of the sound.
SetFrequency Sets the frequency at which the audio samples are played.
SetPan Sets the relative volume of the left and right channels.
SetVolume Sets the attenuation of the sound.

Miscellaneous

Method Description
GetCaps Retrieves the capabilities of the buffer object.
GetFormat Retrieves a description of the format of the sound data in the buffer, or the buffer size needed to retrieve the format description.
GetStatus Retrieves the status of the sound buffer.
Initialize Initializes a sound buffer object if it has not yet been initialized.
SetFormat Sets the format of the primary buffer.

The following table shows which methods are supported for buffer objects obtained from a DirectMusic audiopath. Mix-in buffers accept sends from other buffers, and exist only in audiopath configurations created in DirectMusic Producer. All other buffers in the audiopath are sink-in buffers, which means that they accept data only from the synthesizer sink.

IDirectSoundBuffer8 method Mix-in Sink-in
AcquireResources No No
GetCaps Yes Yes
GetCurrentPosition No No
GetFormat Yes Yes
GetFrequency No No
GetObjectInPath Yes Yes
GetPan Yes Yes
GetStatus Yes Yes
GetVolume Yes Yes
Initialize No No
Lock No No
Play Yes No
Restore No No
SetCurrentPosition No No
SetFormat No No
SetFrequency No No
SetFX Yes Yes
SetPan Yes Yes
SetVolume Yes Yes
Stop Yes No
Unlock No No

The LPDIRECTSOUNDBUFFER8 type is defined as a pointer to the IDirectSoundBuffer interface:

typedef struct IDirectSoundBuffer8  *LPDIRECTSOUNDBUFFER8; 

Requirements

  Header: Declared in dsound.h.

See Also