Microsoft DirectX 8.1 (C++) |
Description
The AdjustSound sample shows how to create a DirectSound secondary buffer to play a wave file, and how to change the parameters of the buffer.
Path
Source: (SDK root)\Samples\Multimedia\DirectSound\AdjustSound
Executable: (SDK root)\Samples\Multimedia\DirectSound\Bin
User's Guide
Load a wave file by clicking Sound File. Select Focus and Buffer Mixing options; note that the various settings are explained under Expected Behavior as you select them. Click Play. If you don't hear any sound, check the Status pane. The application might fail to create the buffer in hardware if this option has been selected.
By using the sliders you can adjust the frequency, pan, and volume dynamically as the buffer is playing.
Programming Notes
For a simpler example of how to set up a DirectSound buffer without as many controls, see the PlaySound sample.
To set the focus behavior of the buffer, the application calls IDirectSound8::CreateSoundBuffer with DSBCAPS_GLOBALFOCUS or DSBCAPS_STICKYFOCUS, or neither of these flags. To set the memory location of the buffer, it sets either DSBCAPS_LOCHARDWARE or DSBCAPS_LOCSOFTWARE, or neither of these flags to allow DirectSound to create the buffer in a either hardware or software.
Parameters are set by using IDirectSoundBuffer8::SetFrequency, IDirectSoundBuffer8::SetPan, and IDirectSoundBuffer8::SetVolume.
See Also