Microsoft DirectX 8.1 (Visual Basic) |
The DirectSound object represents a device and is used to manage that device and create sound buffers.
Multiple applications can create DirectSound objects for the same sound device. When the input focus changes between applications, the audio output automatically switches from one application's streams to the other's. As a result, applications do not have to repeatedly play and stop their buffers when the input focus changes.
The DirectSound buffer object represents a buffer containing sound data. Buffer objects are used to start, stop, and pause sound playback, as well as to set attributes such as frequency and format.
The
A short sound can be loaded into a buffer in its entirety and played at any time by a simple method call. Longer sounds have to be streamed. An application can ascertain when it is time to stream more data into the buffer either by polling the position of the play cursor or by requesting notification when the play cursor reaches certain points.
DirectX for Visual Basic has methods for creating sound buffers that automatically load a complete sound from a wave file or resource. For longer sounds, the application must handle the parsing and streaming.