XAudio2CreateReverb function (xaudio2fx.h)

Creates a new reverb audio processing object (APO), and returns a pointer to it.

Syntax

HRESULT XAudio2CreateReverb(
  [in, out] IUnknown     **ppApo,
  [in]      UINT32 Flags DEFAULT
);

Parameters

[in, out] ppApo

Contains a pointer to the reverb APO that is created.

[in] DEFAULT

Flags that specify the behavior of the APO. The value of this parameter must be 0.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

XAudio2CreateReverb creates an effect performing Princeton Digital Reverb. The XAPO effect library (XAPOFX) includes an alternate reverb effect. Use CreateFX to create this alternate effect.

The reverb APO supports has the following restrictions:

  • Input audio data must be FLOAT32.
  • Framerate must be within XAUDIO2FX_REVERB_MIN_FRAMERATE (20,000 Hz) and XAUDIO2FX_REVERB_MAX_FRAMERATE (48,000 Hz).
  • The input and output channels must be one of the following combinations.
    • Mono input and mono output
    • Mono input and 5.1 output
    • Stereo input and stereo output
    • Stereo input and 5.1 output
The reverb APO maintains internal state information between processing samples. You can only use an instance of the APO with one source of audio data at a time. Multiple voices that require reverb effects would each need to create a separate reverb effect with XAudio2CreateReverb.

For information about creating new effects for use with XAudio2, see the XAPO Overview.

Windows
Because XAudio2CreateReverb calls CoCreateInstance on Windows, the application must have called the CoInitializeEx method before calling XAudio2CreateReverb. XAudio2Create has the same requirement, which means CoInitializeEx typically will be called long before XAudio2CreateReverb is called.

A typical calling pattern on Windows would be as follows:

#ifndef _XBOX
CoInitializeEx(NULL, COINIT_MULTITHREADED);
#endif
IXAudio2* pXAudio2 = NULL;
HRESULT hr;
if ( FAILED(hr = XAudio2Create( &pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR ) ) )
    return hr;
...
IUnknown * pReverbAPO;
XAudio2CreateReverb(&pReverbAPO);

 

The xaudio2fx.h header defines the AudioReverb class GUID as a cross-platform audio processing object (XAPO).

class __declspec(uuid("C2633B16-471B-4498-B8C5-4F0959E2EC09")) AudioReverb;

XAudio2CreateReverb returns this object as a pointer to a pointer to IUnknown in the ppApo parameter. Although you can query the IXAPO and IXAPOParameters interfaces from this IUnknown, you typically never use these interfaces directly. Instead, you use them when you create a voice to add them as part of the effects chain.

The reverb uses the XAUDIO2FX_REVERB_PARAMETERS parameter structure that you access via the IXAudio2Voice::SetEffectParameters.

Note  XAudio2CreateReverb is an inline function in xaudio2fx.h that calls CreateAudioReverb: ``` syntax

XAUDIO2FX_STDAPI CreateAudioReverb(Outptr IUnknown** ppApo); __inline HRESULT XAudio2CreateReverb(Outptr IUnknown** ppApo, UINT32 /Flags/ DEFAULT(0)) { return CreateAudioReverb(ppApo); }


</div>
<div> </div>
<h3><a id="Platform_Requirements"></a><a id="platform_requirements"></a><a id="PLATFORM_REQUIREMENTS"></a>Platform Requirements</h3>
Windows 10 (XAudio2.9); Windows 8, Windows Phone 8 (XAudio 2.8); DirectX SDK (XAudio 2.7)

## Requirements
| Requirement | Value |
| ---- |:---- |
| **Target Platform** | Windows |
| **Header** | xaudio2fx.h |
| **Library** | Xaudio2.lib |
| **DLL** | Windows.Media.Audio.dll |

## See also

<a href="/windows/desktop/xaudio2/how-to--create-an-effect-chain">How to: Create an Effect Chain</a>



<a href="/windows/desktop/api/xaudio2/nf-xaudio2-ixaudio2voice-seteffectparameters">IXAudio2Voice::SetEffectParameters</a>



<a href="/windows/desktop/api/xaudio2fx/ns-xaudio2fx-xaudio2fx_reverb_parameters">XAUDIO2FX_REVERB_PARAMETERS</a>



<a href="/windows/desktop/xaudio2/functions">XAudio2 Functions</a>