XAudio2Create function

Creates a new XAudio2 object and returns a pointer to its IXAudio2 interface.


HRESULT XAudio2Create(
  IXAudio2          **ppXAudio2,
  UINT32            Flags,
  XAUDIO2_PROCESSOR XAudio2Processor



If the operation is successful, returns a pointer to an IXAudio2 object.



Return Value

Returns S_OK if successful, an error code otherwise. See XAudio2 Error Codes for descriptions of XAudio2 specific error codes.


The DirectX SDK versions of XAUDIO2 supported a flag XAUDIO2_DEBUG_ENGINE to select between the release and 'checked' version. This flag is not supported or defined in the Windows 8 version of XAUDIO2.

Note  No versions of the DirectX SDK contain the xaudio2.lib import library. DirectX SDK versions use COM to create a new XAudio2 object.

Platform Requirements

Windows 10 (XAudio2.9); Windows 8, Windows Phone 8 (XAudio 2.8); DirectX SDK (XAudio 2.7)

Windows Phone 8.1: This API is supported.


Target Platform Windows
Header xaudio2.h
Library Xaudio2.lib
DLL Windows.Media.Audio.dll

See Also

How to: Build a Basic Audio Processing Graph

XAudio2 Functions