Microsoft DirectX 8.1 (Visual Basic)

DirectSound and DirectMusic

Previous versions of DirectX presented audio features as two discrete components: DirectSound and DirectMusic. DirectSound was for playing and capturing prerecorded digital samples (waves), and DirectMusic was for playing message-based data ranging from simple MIDI files to musical segments authored in DirectMusic Producer. Although DirectMusic has always been capable of playing nonmusical sound effects through the use of DLS, the emphasis in the past was on its ability to play music.

With DirectX 8, the DirectMusic interfaces are the primary mechanism for loading and playing all sounds, whether they originate as files or resources in wave format, MIDI format, DirectMusic Producer format, or indeed any format for which an add-on loader and tools are available.

Applications can still use the DirectSound interfaces for wave playback, and DirectSoundCapture remains the API for wave capture. However, in most applications DirectSound does its work downstream from the DirectMusic synthesizer. It takes the output from the synthesizer, routes it through effects filters, applies 3-D effects, and does the final mixing before streaming the data to the output device.

If you've used DirectSound in the past, you'll find that switching to the DirectMusic interfaces for loading and playing waves offers the following advantages:

Waves incorporated in DirectMusic Producer files have additional advantages. MIDI controller effects such as pitch bend can be added to waves. Segments can contain wave variations, adding a random element to playback.

These advantages don't mean you have to lose the low-level control offered by DirectSound. The DirectMusic API enables you to access any object in the audiopath. If you want to get an interface for an existing buffer, you can easily do so. You can also take advantage of all the new features of the DirectSound API for adding filters and effects.