Commit 40480fb3 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Make sure XAudio2 is supported by the DirectX headers at compile time.

--HG--
extra : rebase_source : a461903e0d9d4334a29cb0c9848a36f268d8f0e6
parent afc8e3d3
......@@ -27,6 +27,8 @@
#define INITGUID 1
#include "SDL_xaudio2.h"
#if SDL_HAVE_XAUDIO2_H
static __inline__ char *
utf16_to_utf8(const WCHAR *S)
{
......@@ -370,9 +372,15 @@ XAUDIO2_Deinitialize(void)
WIN_CoUninitialize();
}
#endif /* SDL_HAVE_XAUDIO2_H */
static int
XAUDIO2_Init(SDL_AudioDriverImpl * impl)
{
#if !SDL_HAVE_XAUDIO2_H
return 0; /* no XAudio2 support, ever. Update your SDK! */
#else
/* XAudio2Create() is a macro that uses COM; we don't load the .dll */
IXAudio2 *ixa2 = NULL;
if (FAILED(WIN_CoInitialize())) {
......@@ -398,6 +406,7 @@ XAUDIO2_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = XAUDIO2_Deinitialize;
return 1; /* this audio target is available. */
#endif
}
AudioBootStrap XAUDIO2_bootstrap = {
......
......@@ -25,6 +25,15 @@
#include "../SDL_sysaudio.h"
/* XAudio2 is available as of the March 2008 DirectX SDK */
#include <dxsdkver.h>
#if (defined(_DXSDK_BUILD_MAJOR) && (_DXSDK_BUILD_MAJOR >= 1284))
# define SDL_HAVE_XAUDIO2_H 1
#else
# define SDL_HAVE_XAUDIO2_H 0
#endif
#if SDL_HAVE_XAUDIO2_H
#include <XAudio2.h>
/* Hidden "this" pointer for the audio functions */
......@@ -40,6 +49,7 @@ struct SDL_PrivateAudioData
int mixlen;
Uint8 *nextbuf;
};
#endif
#endif /* _SDL_xaudio2_h */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment