IAudioEffectsManager::GetAudioEffects method (audioclient.h)

Gets the current list of audio effects for the associated audio stream.

Syntax

HRESULT GetAudioEffects(
  AUDIO_EFFECT **effects,
  UINT32       *numEffects
);

Parameters

effects

Receives a pointer to an array of AUDIO_EFFECT structures representing the current list of audio effects.

numEffects

Receives the number of AUDIO_EFFECT structures returned in effects.

Return value

Returns an HRESULT including but not limited to the following.

Value Description
S_OK Success
AUDCLNT_E_DEVICE_INVALIDATED The associated audio stream has been destroyed.

Remarks

The caller is responsible for freeing the array using CoTaskMemFree.

Register an IAudioEffectsChangedNotificationClient to receive notifications when the list of audio effects changes.

Examples

The following example demonstrates the IAudioEffectsManager.GetAudioEffects to detect whether the AUDIO_EFFECT_TYPE_DEEP_NOISE_SUPPRESSION effect is present on the specified audio stream.

HRESULT IsPlatformDeepNoiseSuppressionPresent(_In_ IAudioClient *client, _Out_ bool *isPresent)
{
    *isPresent = false;
    wil::com_ptr_nothrow<IAudioEffectsManager> audioEffectsManager;
    RETURN_IF_FAILED(client->GetService(IID_PPV_ARGS(&audioEffectsManager)));
    wil::unique_cotaskmem_array_ptr<AUDIO_EFFECT> effects;
    UINT32 numEffects;
    RETURN_IF_FAILED(audioEffectsManager->GetAudioEffects(&effects, &numEffects));

    for (UINT32 i = 0; i < numEffects; i++)
    {
        // Check if noise suppression is part of the current effects
        if (effects[i].id == AUDIO_EFFECT_TYPE_DEEP_NOISE_SUPPRESSION)
        {
            *isPresent = true;
            return S_OK;
        }
    }

    return S_OK;
}

Requirements

Requirement Value
Minimum supported client Windows Build 22000
Header audioclient.h

See also

AUDIO_EFFECT IAudioEffectsChangedNotificationClient