Microsoft DirectX 9.0 |
DirectSound and DirectMusic are separate components of DirectX with some overlapping functionality. Both play WAV sounds, and DirectMusic ultimately synthesizes all sounds into waveforms that are played through DirectSound buffers.
DirectMusic is a much more full-featured API that offers a complete solution for most audio scenarios in games and other interactive applications. Despite its name, DirectMusic plays all kinds of sounds including nonmusical sound effects. DirectSound is the API of choice for scenarios that require low-level management of hardware resources, such as games with many short sounds that must be played with the lowest possible latency and use of system resources.
You can use the DirectSound API independently to play WAV sounds, even in applications that use DirectMusic to play other content. You can also use DirectSound to manipulate sound buffers that are managed by DirectMusic. For example, you can obtain a DirectSound buffer from a DirectMusic audiopath and move it in 3-D space.
The following table summarizes the functionality offered by the two APIs.
Functionality | DirectMusic | DirectSound |
Play WAV sounds | Yes | Yes |
Play MIDI | Yes | No |
Play DirectMusic Producer segments | Yes | No |
Load content files and manage objects | Yes | No, but some support in sample code |
Control musical parameters at run time | Yes | No |
Manage timeline for cuing sounds | Yes | No |
Use downloadable sounds (DLS) | Yes | No |
Set volume, pitch, and pan of individual sounds | Yes, through DirectSound API | Yes |
Set volume on multiple sounds (audiopaths) | Yes | No |
Implement 3-D sounds | Yes, through DirectSound API | Yes |
Apply effects (DMOs) | Yes, through DirectMusic Producer content or DirectSound API | Yes |
Chain buffers for mix-in (send) effects | Yes, through DirectMusic Producer content | No |
Capture WAV sounds | No | Yes |
Implement full duplex | No | Yes |
Capture MIDI | Yes | No |
Control allocation of hardware buffers | No | Yes |