音響エコー キャンセル (AEC) の参照ストリームとして使用するオーディオ レンダリング エンドポイントを設定します。
構文
HRESULT SetEchoCancellationRenderEndpoint(
LPCWSTR endpointId
);
パラメーター
endpointId
AEC の参照ストリームとして使用する必要があるエンダー エンドポイントのエンドポイント ID。 無効なレンダー デバイス ID を設定すると、E_INVALIDARGで失敗します。 値を NULL に設定すると、Windows は独自のアルゴリズムを使用してループバック参照デバイスを選択します
戻り値
次のような HRESULT 値を返します。
価値 | 説明 |
---|---|
S_OK | 成功。 |
無効な引数エラー (E_INVALIDARG) | endpointId 値が無効です。 |
注釈
次の例は、 IAcousticEchoCancellationControl インターフェイスの使用方法を示しています。 IAcousticEchoCancellationControl インターフェイスの IID を渡して、IAudioClient::GetService を呼び出します。 成功した場合、キャプチャ エンドポイントは 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 |