Using AEC with VC components
Echo effect most often occurs when a side's B microphone picks up a signal from side A and rebroadcasts it back at site A:
That usually results in a feedback loop.
AEC module monitors incoming signal on side B, and then removes it from the outgoing signal, taking the room environment into account:
Microsoft has implemented AEC as an effect for the capture buffer used in DirectSound API since Windowx XP SP2.
Sample demo application
Because AEC is a part of DirectSound, we cannot use our WaveIn and WaveOut components. Instead we have create a new DX_FullDuplex component, which takes care of creating necessary DirectX buffers for audio capture and rendering.
We assign CodecIn as a consumer of DX_FullDuplex component, so it will receive and encode audio captured by AEC.
Encoded audio is sent to remote side, and incoming signal is sent to CodecOut component for decoding (decompression).
After decoding, a PCM stream should be sent to DX_FullDuplex component, therefore we assign it as a consumer of CodecOut:
DX_FullDuplex -> CodecIn -> IPClient -> CodecOut -> DX_FullDuplex
Microsoft implementation of AEC has some limitations:
Under Windows 2000 our demo will not be able to create full duplex interface even with AEC turned off:
That is reported as DirectSound error code (0x887800032) at the application's status bar.
Precompiled binary of this sample is included in the Demos package.