Share via


IAcousticEchoCancellationControl::SetEchoCancellationRenderEndpoint-Methode (audioclient.h)

Legt den Audiorenderingendpunkt fest, der als Referenzdatenstrom für die akustische Echounterdrückung (Acoustic Echo Cancellation, AEC) verwendet werden soll.

Syntax

HRESULT SetEchoCancellationRenderEndpoint(
  LPCWSTR endpointId
);

Parameter

endpointId

Die Endpunkt-ID des Enderendpunkts, der als Referenzdatenstrom für AEC verwendet werden soll. Das Festlegen einer ungültigen Rendergeräte-ID schlägt mit E_INVALIDARG fehl. Wenn Sie den Wert auf NULL festlegen, verwendet Windows einen eigenen Algorithmus, um das Loopback-Referenzgerät zu wählen.

Rückgabewert

Gibt einen HRESULT-Wert zurück, der Folgendes enthält:

Wert BESCHREIBUNG
S_OK Erfolg.
E_INVALIDARG Der EndpointId-Wert ist ungültig.

Hinweise

Im folgenden Beispiel wird die Verwendung der IAcousticEchoCancellationControl-Schnittstelle veranschaulicht. Rufen Sie IAudioClient::GetService auf, und übergeben Sie die IID für die IAcousticEchoCancellationControl-Schnittstelle . Wenn dies erfolgreich ist, unterstützt der Erfassungsendpunkt die Steuerung des Loopbackverweisendpunkts für AEC. Beachten Sie, dass ein Endpunkt möglicherweise AEC unterstützt, die Steuerung des Loopbackverweisendpunkts für AEC jedoch nicht unterstützt. Rufen Sie SetEchoCancellationRenderEndpoint auf, um den Verweisdatenstrom für AEC festzulegen. Wenn der Aufruf von GetService mit E_NOINTERFACE fehlschlägt, lässt der AEC-Effekt auf den Endpunkt (sofern unterstützt) keine Kontrolle über den Loopbackverweisendpunkt zu.

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));

}

Anforderungen

Anforderung Wert
Unterstützte Mindestversion (Client) Windows Build 22621
Kopfzeile audioclient.h