Games for Windows and the DirectX SDK blog

Technical tips, tricks, and news about game development for Microsoft platforms including desktop, Xbox, and UWP


Project maintained by walbourn Hosted on GitHub Pages — Theme by mattgraham
Home | Posts by Tag | Posts by Month

DirectX Tool Kit for Audio

audio, codeplex, github, winphone, xbox

Originally posted to Chuck Walbourn's Blog on MSDN,

The December 2013 release of DirectX Tool Kit is now available on CodePlexGitHub, and includes a C++ implementation of the XNA Game Studio’s low-level audio framework using XAudio2 and X3DAudio. DirectX Tool Kit for Audio is included in both the DirectX 11 and DirectX 12 versions of DirectX Tool Kit.

  • AudioEngine - This class represents an XAudio2 audio graph, device, and mastering voice; similar to XNA's AudioEngine.
  • SoundEffect - A container class for sound resources which can be loaded from .wav files similar to XNA's SoundEffect. These can be played as 'one-shots' managed by the engine, or used to create a SoundEffectInstance.
  • SoundEffectInstance - Provides a single playing, looped, paused, or stopped instance of a sound similar to XNA's SoundEffectInstance. These support 3D positional audio and optionally reverb effects.
  • SoundStreamInstance (new in May 2020) - SoundEffectInstance for playing waves from a streaming XACT-style .xwb wave bank.
  • DynamicSoundEffectInstance - SoundEffectInstance where the application provides the audio data on demand similar to XNA's DynamicSoundEffectInstance.
  • WaveBank - A container class for sound resources packaged into an XACT-style .xwb wave bank, similar to XNA's WaveBank but with support for directly playing one-shots and creating SoundEffectInstances that refer to entries in the wave bank.
  • AudioListener, AudioEmitter - Utility classes used with SoundEffectInstance::Apply3D.

DirectXTK for Audio uses XAudio 2.8 for Windows Store apps for Windows 8.1, Windows Store apps for Windows 8.0, and Windows phone 8. The VS projects for these platforms all include the graphics and audio components.

When building Win32 desktop applications, you can either make use of XAudio 2.8 if targeting Windows 8.0 or later, XAudio 2.9 if targeting Windows 10, or you can make use of XAudio 2.7 with the legacy DirectX SDK (June 2010) to target Windows Vista, Windows 7, or later. There is one VS project for the graphics component, with distinct projects for the different audio versions.

Windows 10: When building with the Windows 10 SDK, DirectX Tool Kit for Audio uses XAudio 2.9 which includes xWMA format support which was not present in XAudio 2.8. Therefore the projects for UWP, Xbox, and Windows 10 include both graphics and audio components.

Windows 7 Update: There is now a NuGet package for using XAudio 2.9 down-level on Windows 7 Service Pack 1, Windows 8.0, and Windows 8.1. See Microsoft Docs for details. Support for legacy XAudio 2.7 has therefore been removed.

The DirectXTK package also includes a new command-line tool, XWBTool, which can be used to build XACT-style wave banks for more efficient management of audio data. DirectXTK for Audio does not make use of the legacy XACT Engine, XACT Cue, or XACT SoundBank. It only uses .xwb wave banks as a method for packing .wav data. The WaveBank class can use .xwb wave banks built with XWBTool or the legacy XACTBLD tool.

The xwbtool also fixes some known issues with the XACTBLD tool when trying to create compact wavebanks. See this commit.

More detailed documentation, full release notes, and other information can be found on the DirectXTK CodePlexGitHub site. Samples can be found here.

Related: XAudio2 and Windows 8, DirectXTK (March 2012), DirectXTK Update (Jan 2013), CodePlex VS 2013 Refresh, DirectXTK for Audio update

Update: The January 2014 release of DirectXTK includes voice management and optional mastering volume limiter. Refreshed all the Simple Sample releases to include DirectXTK for Audio demo. DirectX Tool Kit is also hosted on GitHub.

The May 2020 release added support for streaming from XACT-style .xwb files for PCM, ADCPM, xWMA, and XMA2 formats. The xwbtool can generate both streaming and in-memory wave banks.

The June 2020 release of DirectXTK removes all use of legacy XAudio 2.7 which required the deprecated DirectX SDK. For Windows 7 support, it now uses XAudio2Redist which provides XAudio 2.9 support for Windows 7 SP1, Windows 8.0, and Windows 8.1 with automatic forwarding to the built-in XAudio 2.9 on Windows 10.