Compartilhar via


Buffer Control Options

[The feature associated with this page, DirectSound, is a legacy feature. It has been superseded by WASAPI and Audio Graphs. Media Casting have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Media Casting instead of DirectSound, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

When creating a sound buffer, your application must specify the control options needed for that buffer. This is done with the dwFlags member of the DSBUFFERDESC structure, which can contain one or more of the flags in the following table.

Flag Description
DSBCAPS_CTRL3D The sound source can be moved in 3D space.
DSBCAPS_CTRLFX Effects can be added to the buffer.
DSBCAPS_CTRLFREQUENCY The frequency of the sound can be changed.
DSBCAPS_CTRLPAN The sound source can be moved from left to right.
DSBCAPS_CTRLPOSITIONNOTIFY Notification positions can be set on the buffer.
DSBCAPS_CTRLVOLUME The volume of the sound can be changed.

Note that certain combinations of controls are not allowed. For more information, see DSBUFFERDESC.

To obtain the best performance on all sound cards, your application should specify only control options it will use.

DirectSound uses the control options in determining whether hardware resources can be allocated to sound buffers. For example, a device might support hardware buffers but provide no pan control on those buffers. In this case, DirectSound would use hardware acceleration only if the DSBCAPS_CTRLPAN flag was not specified.

If your application attempts to use a control that a buffer lacks, the method call fails. For example, if you attempt to change the volume by using the IDirectSoundBuffer8::SetVolume method, the method can succeed only if the DSBCAPS_CTRLVOLUME flag was specified when the buffer was created. Otherwise the method fails and returns the DSERR_CONTROLUNAVAIL error code.

See Also

Playback Controls