Using Hardware Mixing

Most sound cards support some level of hardware mixing if there is a DirectSound driver for the card. The following tips will allow you to make the most of hardware mixing:

·Use static buffers for sounds that you want to be mixed in hardware. DirectSound will attempt to use hardware mixing on static buffers.

·Create sound buffers first for the sounds you use the most. There is a limit to the number of buffers that can be mixed by hardware.

·At run time, use the IDirectSound::GetCaps method to determine what formats are supported by the sound-accelerator hardware and use only those formats if possible.

·To create a static buffer, specify the DSBCAPS_STATIC flag in the dwFlags member of the DSBUFFERDESC structure when you create a secondary buffer. You can also specify the DSBCAPS_LOCHARDWARE flag to force hardware mixing for a buffer, however, if you do this and resources for hardware mixing are not available, the IDirectSound::CreateSoundBuffer method will fail.