Capture Buffer Effects
[The feature associated with this page, DirectSound, is a legacy feature. It has been superseded by WASAPI and Audio Graphs. Media Casting have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Media Casting instead of DirectSound, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
Two capture buffer effects are available as kernel-mode implementations on Microsoft Windows XP:
Acoustic echo cancellation (AEC)
Noise suppression
Other effects in DMOs, such as those used on rendering buffers, are not supported.
Both the DirectSoundFullDuplexCreate8 function and the IDirectSoundCapture8::CreateCaptureBuffer method take as a parameter a DSCBUFFERDESC structure that points to an array of DSCEFFECTDESC structures describing desired effects. However, to use the Microsoft implementations you must create the capture buffer by using DirectSoundFullDuplexCreate8. You must also play the secondary sound buffer created by that function; until you do so, the effects are not applied.
In the dwFlags member for each DSCEFFECTDESC structure, you must specify either DSCFX_LOCHARDWARE or DSCFX_LOCSOFTWARE. In most cases, specify DSCFX_LOCSOFTWARE. Buffer creation fails if the effect is not available in the specified location.
The effect is identified in the guidDSCFXClass member of the DSCEFFECTDESC structure. To obtain the Microsoft software implementation, specify DSCFX_MS_AEC or DSCFX_MS_NS in the guidDSCFXInstance member. To use another implementation available in hardware or software, obtain the class and instance GUID from the manufacturer.
After the buffer has been created, you can retrieve information about the effects by using the IDirectSoundCaptureBuffer8::GetFXStatus method.
Acoustic echo cancellation (AEC) is primarily of interest for applications that use voice communication from one site to another. The signal from a microphone at site A is output from the speakers at site B and picked up by the microphone at site B. Without AEC, the signal is then sent back to site A, resulting in an echo and possibly a feedback squeal. AEC overcomes this problem by monitoring the incoming signal at each site, adjusting it to take the room environment into account, and then removing it from the outgoing signal. It also removes any local sounds being played by the computer, such as music, so that these do not interfere with the voice signal being sent over the network.
AEC is implemented at the kernel level of the operating system and is global in its effect. It has the following limitations:
Only one capture buffer at a time can use AEC.
AEC cannot be started if another application is capturing or playing audio. If AEC has been started, no other application can capture audio without using AEC.
Regardless of the input or output format, the kernel mixer processes the sound in 16-bit mono format. As a result, the quality of the sound may be reduced. To minimize processor usage, capture sounds in a 16-bit mono format.
While AEC is in use, all DirectSound hardware acceleration on the device is disabled, affecting the user experience for other applications sharing the device.
Changes to AEC parameters affect all applications that are running.
AEC does not work with some combinations of sound cards and drivers. Applications should always provide the user with the option of turning off AEC.
On versions of the operating system prior to Windows XP SP1, AEC does not work with USB speakers, or on any machine in which audio capture and rendering are provided by different devices with different clocks.
If the acoustic environment changes, the adaptive filter can take two seconds or more to adjust.
Any late reverberations occurring more than 128 milliseconds after the original signal are not removed from the outgoing signal.
Use the IDirectSoundCaptureFXAec8interface to set and retrieve AEC parameters on a capture buffer that contains this effect. You can also enable noise fill, which is a means of preventing complete silence when there is no new data in the outgoing signal.
Noise suppression can be applied only if AEC is also enabled. The noise suppression capture effect removes constant background noise, such as fan noise. Use the IDirectSoundCaptureFXNoiseSuppress8 interface to set and retrieve parameters.
The effect interfaces are obtained from the capture buffer object by using IDirectSoundCaptureBuffer8::GetObjectInPath.