設定音訊轉譯端點,該端點應作為聲場迴音取消的參考數據流(AEC)。
語法
HRESULT SetEchoCancellationRenderEndpoint(
LPCWSTR endpointId
);
參數
endpointId
應作為 AEC 參考數據流之結束端點的端點標識碼。 設定無效的轉譯裝置標識碼將會因為E_INVALIDARG而失敗。 將值設定為 NULL 會導致 Windows 使用自己的演算法來挑選回送參考裝置
返回值
傳回 HRESULT 值,包括下列專案:
價值觀 | 說明 |
---|---|
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 |