Each sound device installed in the system is represented by a DirectSound object that is accessed through the IDirectSound interface. Your application can create a DirectSound object by calling the DirectSoundCreate function that returns an IDirectSound interface. DirectSound objects installed in the system can be enumerated by calling the DirectSoundEnumerate function.
Windows is a multitasking operating system. Typically, users run several programs at once and expect them all to share resources. DirectSound objects share sound devices by tracking the input focus. They produce sound only when their owning application has the input focus. When an application loses the input focus, the audio streams from that object are muted. 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.
Note The header file for DirectSound includes C programming macro definitions for the methods of the IDirectSound and IDirectSoundBuffer interfaces.