What do you use for Audio in DirectX applications?

Started by
13 comments, last by kubera 11 years, 7 months ago
This concerns mainly a problem I found with the new windows SDK that includes DirectX headers.Even with this + Visual Studio 2012,it still gives me the ''The program can't start because XAudio2_8.dll is missing from your computer.Try reinstalling the program to fix the problem.'' error.Would it be better to just use DirectSound instead of XAudio2?Is XAudio2 really worth the trouble?
Advertisement
That probably depends on your audio needs.

XAudio 2 was designed to address some of the limitations of the original DirectSound API, which was designed back in the mid 1990's when ISA soundcards with on-board audio RAM were all the rage and a cutting edge PC was a 66MHz Pentium I. XAudio 2 was designed with a software implementation in mind.
If all you need to do is play back a few sound effects, and you know DirectSound, then it'll probably work just fine.
XAudio 2 does support several useful features that DSound doesn't, though.
Native run-time decompression (ADPCM and wma), digital signal processing (for reverbs, filtering or arbitrary audio processing), submixing, audio graphbuilding and a more transparent 3D implementation. If you think you may want to use those at some point, it's probably worth learning and using XAudio 2. (the compressed sound support alone may be worth the switch).

Big Disclaimer-- I was the primary architect for XAudio 2 back when I was at Microsoft, so may be biased :).

There are of course other 3rd party audio API's out there such as FMOD, WWise, Miles, etc, that may be worth looking at.

Brian Schmidt
Final 3 weeks for Earlybird Discount
GameSoundCon 2012, San Francisco.
Oct 24-25

Brian Schmidt

Executive Director, GameSoundCon:

GameSoundCon 2016:September 27-28, Los Angeles, CA

Founder, Brian Schmidt Studios, LLC

Music Composition & Sound Design

Audio Technology Consultant


That probably depends on your audio needs.

XAudio 2 was designed to address some of the limitations of the original DirectSound API, which was designed back in the mid 1990's when ISA soundcards with on-board audio RAM were all the rage and a cutting edge PC was a 66MHz Pentium I. XAudio 2 was designed with a software implementation in mind.
If all you need to do is play back a few sound effects, and you know DirectSound, then it'll probably work just fine.
XAudio 2 does support several useful features that DSound doesn't, though.
Native run-time decompression (ADPCM and wma), digital signal processing (for reverbs, filtering or arbitrary audio processing), submixing, audio graphbuilding and a more transparent 3D implementation. If you think you may want to use those at some point, it's probably worth learning and using XAudio 2. (the compressed sound support alone may be worth the switch).

Big Disclaimer-- I was the primary architect for XAudio 2 back when I was at Microsoft, so may be biased smile.png.

There are of course other 3rd party audio API's out there such as FMOD, WWise, Miles, etc, that may be worth looking at.

Brian Schmidt
Final 3 weeks for Earlybird Discount
GameSoundCon 2012, San Francisco.
Oct 24-25


XAudio2 is perfect,however it just doesn't run,it wants some XAudio2_8.dll.I don't understant WHY it wants the DLL,when it's obviously a Windows 8 dll that hasn't even come out yet,why does my code in Windows7 in a normal DirectX11 application require me to have a DLL that is in Windows 8,how do I get that DLL?No one seems to have info on the issue of missing XAudio2_8.dll.I can't even call it missing,since it's not even supposed to be there,Windows 7 has XAudio2_7.dll.Why my program requires a dll that it shouldn't even know about is beyond me. blink.png
It requires you to have that DLL because you're linking against it. Unless MS decides to package it up in a redistributable or install it via service pack, I don't think you can use it on Windows 7.
I'm only including this:

#include <xaudio2.h>
#include <x3daudio.h>
#include <xaudio2fx.h>

#pragma comment (lib, "xaudio2.lib")
#pragma comment (lib, "x3daudio.lib")


It worked fine before with just

#include <xaudio2.h>
#pragma comment (lib, "xaudio2.lib")


However I don't understand why implementing 3D audio causes the problem.I mean the same headers and libraries are included in the SDK 3D Audio sample and I can run it fine,however when I use these functions in my project,the missing DLL thing comes up.Now I've checked project options carefuly at both my project and the SDK sample one,all the settings are the same,I checked all their code,there is no reference in the source for such a dll,so perhaps it's called for in the libs?But how can that be if those libs were made over 2 years ago while this dll that it wants is from Windows 8
to use the old (v7) version of XAudio2 you should install the DirectX 2010 SDK and make sure your project is pointing at it for headers and lib files. I haven't moved to VS 2012 yet (waiting for the official release next week) but reading around this seems to be the way to go to support Win7.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni


to use the old (v7) version of XAudio2 you should install the DirectX 2010 SDK and make sure your project is pointing at it for headers and lib files. I haven't moved to VS 2012 yet (waiting for the official release next week) but reading around this seems to be the way to go to support Win7.


Ok I found something weird:In the DirectX 2010 SDK(atleast in mine,which I reainstalled 3 times) there is no XAudio2.lib and in the sample XAudio2 projects from the SDK,no XAudio2.lib is linked.However,there is XAudio2.lib in the new Windows 8 SDK,so I figured I should just not be linking it.But when I unlink it,it gives me
Unhandled exception at 0x5019DEF0 (msvcr110d.dll) in Engine.exe: 0xC0000005: Access violation writing location 0x0F7B0460.[/quote]
You can use something like this:

#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
#include <xaudio2.h> // from Windows 8.0 SDK
#pragma comment(lib,"xaudio2.lib")
#else
#include <c:\dxsdk\include\xaudio2.h> // from DirectX SDK
#endif

for more information read this.

I'm only including this:

#include <xaudio2.h>
#include <x3daudio.h>
#include <xaudio2fx.h>

#pragma comment (lib, "xaudio2.lib")
#pragma comment (lib, "x3daudio.lib")


It worked fine before with just

#include <xaudio2.h>
#pragma comment (lib, "xaudio2.lib")


However I don't understand why implementing 3D audio causes the problem.I mean the same headers and libraries are included in the SDK 3D Audio sample and I can run it fine,however when I use these functions in my project,the missing DLL thing comes up.Now I've checked project options carefuly at both my project and the SDK sample one,all the settings are the same,I checked all their code,there is no reference in the source for such a dll,so perhaps it's called for in the libs?But how can that be if those libs were made over 2 years ago while this dll that it wants is from Windows 8


Those libraries you're linking to are import libraries. Basically they're just stubs that allow to linker to hook up your code's function calls to the functions exported by the DLL, instead of having to manually ask for the address of the DLL function at runtime. When you link to a DLL's import lib your app now has a dependency on that DLL, which means it will attempt to load that DLL when the app starts up. If it can't find the right DLL, you get that error.

You can use something like this:

#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
#include <xaudio2.h> // from Windows 8.0 SDK
#pragma comment(lib,"xaudio2.lib")
#else
#include <c:\dxsdk\include\xaudio2.h> // from DirectX SDK
#endif

for more information read this.


I did all this and this time it actualy loads XAudio2_7.dll properly(I see it quickly in the orange bar at the bottom after build time),but it gives me a Unhandled exception at 0x52FEDEF0 (msvcr110d.dll) in Engine.exe: 0xC0000005: Access violation writing location 0x0F7E0460. with no source code avaliable.Is there anything else special that I must install/import?

This topic is closed to new replies.

Advertisement