We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1277

Summary: XAudio2.h missing.
Product: SDL Reporter: Christian Johansson <dalkon>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Windows (All)   
Attachments: Attempt to work around problem.

Description Christian Johansson 2011-08-15 11:31:15 UTC
Windows does not have XAudio2.h by default.
Comment 1 Ryan C. Gordon 2011-08-15 13:15:44 UTC
This is in the DirectX SDK. My understanding is that we need this SDK for other parts of SDL, too.

--ryan.
Comment 2 Christian Johansson 2011-08-15 14:56:11 UTC
So it's just the audio parts that are not included in default SDKs.
Comment 3 Ryan C. Gordon 2011-08-20 23:34:28 UTC
Created attachment 677 [details]
Attempt to work around problem.


It's likely that on older Visual Studios (or Platform SDKs? or maybe alternate compilers?), there are older DirectX SDK headers included, and you need to install an actual DirectX SDK to get the XAudio2 headers.

Any DirectX SDK from March 2008 and later should work. It's a free download from Microsoft.

I'm attaching an untested patch that checks for the SDK version, and doesn't compile the XAudio2 support if XAudio2.h would be missing. When I get back to a Windows box, I'll test it myself, but if you want to try it in the meantime, here it is.

--ryan.
Comment 4 Christian Johansson 2011-08-21 06:29:19 UTC
dxsdkver.h is not included in default SDKs either.
Comment 5 Christian Johansson 2011-08-21 07:02:04 UTC
If you have a DirectX SDK downloaded the patch works just fine.
I'm trying to find a workaround for the Visual Studio SDK right now so there's no need for 600MB of unused files.
Comment 6 Ryan C. Gordon 2011-08-21 09:55:39 UTC
(In reply to comment #4)
> dxsdkver.h is not included in default SDKs either.

Ugh!

We only need the header, not any libraries from the DirectX SDK (XAudio2 is accessed by asking the OS for a specific COM object)...so maybe we can just include XAudio2.h with SDL's sources, or something like that.

Sam, you have any thoughts on the right way to fix this? The configure script can check this, but it obviously doesn't help for the Visual Studio projects.

Christian: if you have an immediate need to fix this, so you can get on with your work, just change that dxsdkver.h test to be zero in my patch, and it'll remove the XAudio2 target from the build.

--ryan.
Comment 7 Ryan C. Gordon 2011-08-22 11:59:33 UTC
I've changed this in my sandbox repo to just need the SDL_AUDIO_DRIVER_XAUDIO2 line commented out in include/SDL_config_windows.h. This is about the best I can offer if we need to build without the DirectX SDK installed.

(If building with the configure script, it'll handle this for you by testing for the XAudio2.h header, but for Visual Studio, you'll have to comment out the line in the header.)

I'll resolve this bug when this moves from my sandbox repo to the main repository.

--ryan.
Comment 8 Ryan C. Gordon 2011-10-11 18:28:15 UTC
This is in the main repo now.

--ryan.