Win32 API 日本語リファレンス
ホームMedia.Audio › IAcousticEchoCancellationControl

IAcousticEchoCancellationControl

COM
IIDf4ae25b5-aaa3-437d-b6b3-dbbe2d0e9549継承元IUnknown自前メソッド開始 vtbl3

公式ドキュメント

オーディオキャプチャエンドポイントが音響エコーキャンセレーション(AEC)をサポートしているかどうかを判定する仕組みを提供します。サポートしている場合、参照ストリームとして使用するオーディオレンダーエンドポイントをクライアントが設定できるようにします。

解説(Remarks)

次の例は 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));

}

メソッド 1

vtbl = vtable インデックス(0始まり)。HSP等からCOMメソッドをインデックス指定で呼ぶ際に使用します。0〜2 は IUnknown。

vtbl 3 HRESULT SetEchoCancellationRenderEndpoint(LPWSTR endpointId)

音響エコーキャンセレーション(AEC)の参照ストリームとして使用するオーディオレンダーエンドポイントを設定します。

endpointIdLPWSTRinAEC の参照ストリームとして使用するレンダーエンドポイントのエンドポイント ID。無効なレンダーデバイス ID を設定すると E_INVALIDARG で失敗します。値を NULL に設定すると、Windows が独自のアルゴリズムを使用してループバック参照デバイスを選択します。

戻り値

次のものを含む HRESULT 値を返します:

説明
S_OK 成功。
E_INVALIDARG endpointId の値が無効です。

解説(Remarks)

次の例は 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));

}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

HSP用 COM定義

#usecom / #comfunc によるHSPのCOM呼び出し定義。数字は vtbl インデックス(0始まり)。クラスIDが無い場合 #usecom の末尾は "{}"、ある場合は "{CLSID}"

#define global IID_IAcousticEchoCancellationControl "{F4AE25B5-AAA3-437D-B6B3-DBBE2D0E9549}"
#usecom global IAcousticEchoCancellationControl IID_IAcousticEchoCancellationControl "{}"
#comfunc global IAcousticEchoCancellationControl_SetEchoCancellationRenderEndpoint  3 wstr
; ※数字は vtbl インデックス(0始まり)。0/1/2 は IUnknown(QueryInterface/AddRef/Release)。
; ※このインターフェースは直接 CoCreateInstance するクラスIDが無いため "{}"(他メソッド/アクティベーションで取得)。