The DirectSound buffer object represents a buffer containing sound data in pulse code modulation (PCM) format. Buffer objects are used to start, stop, and pause sound playback, as well as to set attributes such as frequency and format.
The primary sound buffer holds the audio that the listener will hear. Secondary sound buffers each contain a single sound or stream of audio. DirectSound automatically creates a primary buffer, but it is the application's responsibility to create secondary buffers. When sounds in secondary buffers are played, DirectSound mixes them in the primary buffer and sends them to the output device. Only the available processing time limits the number of buffers that DirectSound can mix.
DirectSound does not include functions for parsing a sound file. It is your responsibility to stream data in the correct format into the secondary sound buffers.
Normally, buffers from only a single application are audible at any given moment, because only one application at a time has access to a particular DirectSound device.
Depending on the card type, DirectSound buffers can exist in hardware as on-board RAM, wave-table memory, a direct memory access (DMA) channel, or a virtual buffer (for an I/O port based audio card). Where there is no hardware implementation of a DirectSound buffer, it is emulated in system memory.
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 another's. As a result, applications do not have to repeatedly play and stop their buffers when the input focus changes.
Through the IDirectSoundNotify interface, DirectSound provides a mechanism to notify the client when the play cursor reaches positions within a buffer that have been specified by the client, or when playback has stopped.