Microsoft DirectX 8.1 (C++)

IDirectSoundBuffer8

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.

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 between the left and right audio channels.
GetVolume Retrieves the volume of the buffer.
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 sound volume.

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 an audiopath; that is, buffers created by a DirectMusic performance. Mix-in buffers accept sends from other buffers. 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    
GetCaps Yes Yes
GetCurrentPosition    
GetFormat Yes Yes
GetFrequency    
GetObjectInPath Yes Yes
GetPan Yes Yes
GetStatus Yes Yes
GetVolume Yes Yes
Initialize    
Lock    
Play Yes  
Restore    
SetCurrentPosition    
SetFormat    
SetFrequency    
SetFX Yes Yes
SetPan Yes Yes
SetVolume Yes Yes
Stop Yes  
Unlock    

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

typedef struct IDirectSoundBuffer8  *LPDIRECTSOUNDBUFFER8; 

Requirements

  Header: Declared in dsound.h.