Platform and CPU Support

XAudio2 is a beta version and should not be used by shipping titles. This beta expires on May 1, 2008.

XAudio2 is supported on Xbox 360 and on PCs that have Streaming SIMD Extensions (SSE) and run client versions of Windows XP or greater. Audio effects designed to be hosted in XAudio2 can also use SSE safely: XAudio2 guarantees that the audio buffers supplied to effects will satisfy SSE memory alignment requirements. Large-address-space and 64-bit systems are well supported, and virtual memory is automatically managed to avoid fragmentation.

Note    XAudio2 is not supported on systems that run Windows Server.

Instantiation

XAudio2 is implemented on Xbox 360 as a static library to which clients must link. On Windows, XAudio2 is a COM object implemented in a DLL, which clients can create using the COM CoCreateInstance function. On both platforms, the XAudio2Create helper function can be used to perform the appropriate instantiation and initialization tasks. On Xbox 360, XAudio2Create is a true library function. On Windows, however, it is merely an inline function, defined in XAudio2.h, that calls the CoCreateInstance and IXAudio2::Initialize functions.

The XAudio2Create function allows similar instantiation code to be used on both platforms; note, however, that on Windows the COM function CoInitialize still must be called before XAudio2Create. The rules of COM do not allow this function call to be incorporated into XAudio2Create.

Instances of XAudio2 can be created multiple times within a single process: each XAudio2 object operates independently of the others, with its own audio processing thread. Only the debug settings are shared. This is important on Windows, where several different components loaded in a single process—for example, Internet Explorer—might use XAudio2 simultaneously.

Component Object Model (COM)

XAudio2 uses COM technology, on both Xbox 360 and Windows platforms, in very precise ways that incur no performance costs. The top-level IXAudio2 object provides the COM IUnknown interface as well as the main IXAudio2 interface. The IUnknown::AddRef and IUnknown::Release methods maintain an object reference count as dictated by COM rules. When the reference count reaches 0, the XAudio2 object is destroyed—so there is no specific XAudio2Destroy API call. This facilitates shared usage of a single XAudio2 object by more than one component.

This is the full extent of XAudio2's COM usage on Xbox 360. On Windows, COM is additionally used as the instantiation mechanism for XAudio2 objects, as explained in the Instantiation section above. This simplifies certain Windows-specific issues such as library versioning and serviceability.

The debug and retail XAudio2 libraries are two separate in-process COM objects with different class IDs. They can be created using COM's CoCreateInstance method, as described below.

Library Versions

XAudio2 clients can choose between two versions of the library: the debug version, which is intended for use only during development and cannot be shipped in a retail product, and the retail version, which is redistributable. The debug version provides diagnostic information to aid development, but it is large and slow; the retail version is optimized, but it provides no safeguards against incorrect usage. The Windows and Xbox 360 procedures for specifying a library version are as follows:

  • On Windows, there are two ways to specifiy the library version: the client can call CoCreateInstance using the desired version's COM class ID. The debug library ID is _uuidof(XAudio2_Debug), and the retail library ID is _uuidof(XAudio2_Retail). The other option is to call XAudio2Create with the XAUDIO2_DEBUG_ENGINE flag. If the flag is not present, the retail library is used by default.
  • On Xbox 360, the only way to specify the debug or retail version is to link to the appropriate static library: XAudio2.lib for retail, XAudio2d.lib for debug. On this platform, the XAUDIO2_DEBUG_ENGINE flag has no effect.

See Also

XAudio2 Overviews