设置音频呈现终结点,该终结点应用作声学回声取消的参考流(AEC)。
语法
HRESULT SetEchoCancellationRenderEndpoint(
LPCWSTR endpointId
);
参数
endpointId
应用作 AEC 引用流的最终用户终结点的终结点 ID。 设置无效的呈现设备 ID 将失败,E_INVALIDARG。 将值设置为 NULL 将导致 Windows 使用自己的算法选取环回引用设备
返回值
返回 HRESULT 值,包括以下内容:
价值 | DESCRIPTION |
---|---|
S_OK | 成功。 |
E_INVALIDARG | endpointId 值无效。 |
注解
以下示例说明了 IAcousticEchoCancellationControl 接口的用法。 调用 IAudioClient::GetService,传入 IAcousticEchoCancellationControl 接口的 IID。 如果成功,捕获终结点支持控制 AEC 的环回引用终结点。 请注意,终结点可能支持 AEC,但可能不支持控制 AEC 的环回引用终结点。 调用 SetEchoCancellationRenderEndpoint 以设置 AEC 的引用流。 如果对 GetService 的调用失败并 E_NOINTERFACE,则 AEC 对终结点的影响(如果受支持),则不允许控制环回引用终结点。
wil::com_ptr_nothrow<IAudioClient> audioClient;
RETURN_IF_FAILED(device->Activate(_uuidof(IAudioClient), CLSCTX_INPROC_SERVER, nullptr, (void **)&audioClient));
// Call Initialize before calling GetService
// Implementation of IAudioClient::Initialize has been omitted from this sample for brevity.
RETURN_IF_FAILED(audioClient->Initialize(…));
// If the capture endpoint supports acoustic echo cancellation (AEC), pass it the endpoint id of the
// audio render endpoint that should be used as the reference stream. If the capture endpoint does not
// support AEC, the GetService call fails with E_NOINTERFACE, so errors from GetService are not
// treated as fatal.
wil::com_ptr_nothrow<IAcousticEchoCancellationControl> audioAcousticEchoCancellationControl;
if (SUCCEEDED(audioClient->GetService(IID_PPV_ARGS(&audioAcousticEchoCancellationControl))))
{
RETURN_IF_FAILED(audioAcousticEchoCancellationControl-> SetEchoCancellationRenderEndpoint(endpointIdOfReferenceAudioStream));
}
要求
要求 | 价值 |
---|---|
最低支持的客户端 | Windows 内部版本 22621 |
标头 | audioclient.h |