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.DirectSound和DirectMusic是DirectX的两个独立组件,但是功能尚有部分重叠。二者都可以播放WAV文件,DirectMusic最终还是合成所有的声音,并通过DirectSound的缓冲区播放出来。
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. 在大部分的声音场合,DirectMusic提供完整的解决方案,但他并不仅仅是一个全功能的API。 不考虑它的名字,DirectMusic可以播放所有格式的声音,包括非音乐的声音效果。 当你需要对硬件资源进行底层控制,DirectSound是可供选择的另外一个API,比如说①游戏中包含了大量的短的声音、并且不需要频繁播放,②使用系统资源。
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.
功能DirectMusicDirectSound播放WAV文件YesYes播放MIDIYesNoPlay DirectMusic Producer segmentsYesNoLoad content files and manage objectsYesNo, but some support in sample codeControl musical parameters at run timeYesNoManage timeline for cuing soundsYesNoUse downloadable sounds (DLS)YesNoSet volume, pitch, and pan of individual soundsYes, through DirectSound APIYesSet volume on multiple sounds (audiopaths)YesNoImplement 3-D soundsYes, through DirectSound APIYesApply effects (DMOs)Yes, through DirectMusic Producer content or DirectSound APIYesChain buffers for mix-in (send) effectsYes, through DirectMusic Producer contentNoCapture WAV soundsNoYesImplement full duplexNoYesCapture MIDIYesNoControl allocation of hardware buffersNoYes