Compartilhar via


Playback Controls

[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.]

To retrieve and set the volume at which a buffer is played, your application can use the IDirectSoundBuffer8::GetVolume and IDirectSoundBuffer8::SetVolume methods. Setting the volume on the primary buffer changes the waveform-audio volume of the sound card. Volume is measured as hundredths of decibels (dB) of attenuation; it is not possible to amplify the default volume. Note that the decibel scale is not linear; a reduction in volume of 3 dB is equivalent to a halving of the sound energy, and sounds generally become inaudible long before the maximum attenuation of 100 dB is reached.

By calling the IDirectSoundBuffer8::GetFrequency and IDirectSoundBuffer8::SetFrequency methods, you can retrieve and set the frequency at which audio samples play. You cannot change the frequency of the primary buffer.

To retrieve and set the position of the sound source on the left-right axis, you can call the IDirectSoundBuffer8::GetPan and IDirectSoundBuffer8::SetPan methods. Buffers with 3D capabilities cannot be panned.

In order to use any of these controls, you must set the appropriate flags when creating the buffer. See Buffer Control Options.