XAudio2 – The replacement to DirectSound.
I have recently wanted to start a programming project which will involve sound manipulation on a Windows based PC. It looks like it is possible using DircetSound but as this is on it’s way out i didn’t want to spend time learning something that is at the end of its life. After a in-depth web searching session it was apparent that the new boy on the block is XAudio2 which is now part of the DirectX SDK. From my short time of reading i am under the impression that XAudio was written for the XBox360, but as DirectSound on the PC is nearing the end of its useful life and adding to that there is a need to update XAudio for the XBox, XAudio2 was born.
XAudio2 is a cross platform (Xbox and PC) sound API (Application Programmers Interface) which allows programmers/developers to be able to write programs that utilise the PC or Xbox’s sound system without having to interact with the actual hardware level of the device (like in the DOS days). From what i have read it is not an upgrade to DirectSound on the PC but a complete rewrite from the ground up.
Unfortunately at the time of writing this article i have been unable to start my project because there is a severe lack of learning resources for the new XAudio2 API. I have found that in the March 2008 update of the DirectX SDK from Microsoft there are 3 XAudio2 tutorials:
XAudio2BasicSound – Shows how to setup the engine and play WAV files.
XAudio2BasicStream – Demonstrates file streaming using asynchronous file I/O.
XAudio2Sound3D – How to use X3DAudio with XAudio2 API to play spatialised sounds and reverb effects.
These are useful, but quite limited. I am hoping the next release of the DirectX SDK will add to these.
I have also searched the web for 3rd party tutorials and even book, but at this point i see nothing that can help me learn the XAudio2 API. Unfortunatly i have to read an awful lot of tutorials and background to be able to learn something new.
Anyway here are some links to what i have found so far:
Microsoft’s MSDN pages for XAudio2.
Great XAudio2 overview at Gamasutra.
That’s about it until more learning resources and XAudio2 tutorials appear on the net.

XAudio2 – The replacement to DirectSound…
Mircosoft is in the process of replacing DirectSound with a new audio API that is cross platform between the Xbox and PC. The new audio API is called XAudio2 and a short overview of the new XAudio2 API is available in this article….
Microsoft FTL. Nice blog though mate!
I am also searching about resources for the new XAudio2 API and yes, it is quite hard to find valuable learning info about new XAudio2 API but I will check out the tutorial links that you just shared here. Thanks!
Great blog, subscribed to your rss feed. Thanks.
I came across this blog the other day and you got some great info here – thanks.
I love your site… But what’s going on – the last article you posted was written on April 18th… I hope you didn’t loose your enthusiasm!
Been very busy, but will write more soon.
Yeah, I’ve embarked on the same journey of despair and frustration. I need some audio support for a .NET DJing application that I’m writing. Regrettably, of the dozens of options out there – legacy DirectSound, *really* legacy WinMM interop, DirectShow via Mp3Sharp, XAudio2, interfacing with Windows Media Player, etc. – none of them meet my needs (or even seem well-coded!)
Multimedia programming on .NET is pretty much dead for the moment. This is outrageous, and the duration of this deadlock is unguessable.
- David Stein
it’s a good article. thank you very much.
Well its now well into september and I put a entry on the msdn C++ forum asking about this, no replies yet.
Audio should be so easy, get a buffer, put your data into it, have something (callback, flag, windows message etc) tell you the buffer is say 1/4 full and put more data in.
Instead Ive found as you say even in the August 08 release the three examples. Great if you just want to play a wav file, or if you want a rediculously complicated game sound. All I want to do is play PCM from my program. Should be very very easy. But the streaming example is horrendous and requires you to use special tools to create buffers etc.
After two weeks I went back to the 2007 SDK and found all the DirectSound examples (that have been removed in 2008) there, except annoyingly the streaming example. But I found that one on the web.
Seems to be a bigger and bigger hill to climb evertime theres a release. And they often dont complile either, the new 2008 SDK doesnt compile on the 2008 Visual Studio pro unless you include the tools library in the exectutable directories. And if you’re on VC6 a huge bunch of linker errors have to be resolved!!
All very frustrating for something you would expect to have working in a day.
My call right now…unless someone provides an example for XAudio2 that doesnt require sounds banks to be created etc I’m going back to DirectSound. At least I have some chance with that.
Hi, I found your blog on this new directory of WordPress Blogs at blackhatbootcamp.com/listofwordpressblogs. I dont know how your blog came up, must have been a typo, i duno. Anyways, I just clicked it and here I am. Your blog looks good. Have a nice day. James.
That’s true, going through the tutorials is just a big headache along with waiting for next release. I think sometimes its just a waste of time. Anyways your article is good.
Nice post. Thank you for the info. Keep it up.
Thanks for the resource link in Xaudio2, this is a big help for developers like us..
I came across this blog the other day and you got some great info here – thanks.
I also think that XAudio is indeed for XBox360 so perhaps we really need to update it when time comes.
This kind of sound replacement requires some good experience with programing and working with API’s
I am also searching about resources for the new XAudio2 API and yes, it is quite hard to find valuable learning info about new XAudio2 API but I will check out the tutorial links that you just shared here. Thanks!
Sounds good to me. I`m intrigued by the new reporting info you`ll be providing.
Hi,
As with you i am a developer starting a project that of course needs 3d sound. As with you i found the directx xaudio2 api and i am in the process of integrating it into my engine. The engine already has mesh loading and scripting and an easy to use object loader but i am having one hell of a time integrating this xaudio2. I do know in the 2009 release of the direct x sdk there is another sample for using a source listener from xaudio but its layout is, well not what i would do i will let you know if i can break up the layout and get it running in the simplest way possible. Good luck and nice blog.
HEy just wanted to post that msdn is finally doing right on xaudio2 and has some well layed out tutorials and info on xaudio2:
http://msdn.microsoft.com/en-us/library/bb694503(VS.85).aspx
good luck!
I am in the same boat. I am planning to write some new audio classes for my projects as my DirectSound classes are a bit outdated (still work though).
I am digging around as well for all the info I can find. I’ll keep you posted
When i start the game prototype,i get an error saying “could not find xaudio2″ and there is no sound ingame?
exelent post! mercy!!!
Good , When i start the game prototype,i get an error saying “could not find xaudio2″ and there is no sound ingame?
Hey, great post.. Thanks mate!
When i start the game prototype,i get an error saying “could not find xaudio2″ and there is no sound ingame?
XAudio2 is exactly what our business has been lacking. Keep up the excellent work. I wish I would have thought of it first.
Problem width XAudio2.
I needed to reproduce some streaming audio and since I am new (never used DirectSound) I followed guidelines in my DirectX help and used XAudio2. Everything works fine until I move my application to some other PC, where XAudio fails to initialize.
Actually XAudio2Create fails.
First I thought that DirectX version is not updated and installed new DirectX Endpoint.
http://www.microsoft.com/downloads/details.aspx?FamilyID=2da43d38-db71-4c1b-bc6a-9b6652cd92a3.
But after installation it still did not work and the problem is the same.
On booth mentioned PC I have XP SP3 installed and on the PC where I developed application I have DXSDK Installed.
Any help appreciated
if( FAILED( pDlg->hr = XAudio2Create( &pDlg->m_pXAudio2, pDlg->m_uiFlags ) ) )
{
wprintf( L”Failed to init XAudio2 engine: %#X\n”, pDlg->hr );
CoUninitialize();
return 0;
}
Great Blog, The Microsoft stuff has been moved and can now be found at this url:
http://msdn.microsoft.com/en-us/library/ee415737(VS.85).aspx