Mixing

The most frequently used feature of DirectSound is the mixing of audio streams with little latency. Latency is the delay between the time that a sound buffer plays and the time that the speakers reproduce the sound. Your application can create one or more secondary sound buffers and write audio data to them. You can choose to play or stop any of these buffers. DirectSound mixes all playing buffers and writes the result to the primary sound buffer, which supplies the sound hardware with audio data. Only the available processing time limits the number of buffers that DirectSound can mix.

A user perceives no delay between the time that a buffer plays and the time that the speakers reproduce the sound when the latency is 20 milliseconds or less. The DirectSound mixer provides 20 milliseconds of latency, so there is no perceptible delay before play begins. Under these conditions, if your application plays a buffer and immediately begins a screen animation, the audio and video appear to start synchronously. However, if DirectSound must use the HAL emulation layer (if a DirectSound driver for the sound hardware is not present), the mixer cannot achieve low latency and a hardware-dependent delay (typically 100-150 milliseconds) occurs before the sound is reproduced.

Only buffers from a single application are audible at any given instance because only one application at a time can open a particular DirectSound device,