src/audio/xaudio2/SDL_xaudio2.c
changeset 5636 44bfdab5eaf1
parent 5635 bef0f093c9da
child 6044 35448a5ea044
     1.1 --- a/src/audio/xaudio2/SDL_xaudio2.c	Mon Aug 22 14:37:45 2011 -0400
     1.2 +++ b/src/audio/xaudio2/SDL_xaudio2.c	Mon Aug 22 14:56:46 2011 -0400
     1.3 @@ -22,18 +22,19 @@
     1.4  #include "../../core/windows/SDL_windows.h"
     1.5  #include "SDL_audio.h"
     1.6  #include "../SDL_audio_c.h"
     1.7 +#include "../SDL_sysaudio.h"
     1.8  #include "SDL_assert.h"
     1.9  
    1.10 -#include "../SDL_sysaudio.h"
    1.11 -
    1.12  #if SDL_AUDIO_DRIVER_XAUDIO2
    1.13 +
    1.14  #include <dxsdkver.h> /* XAudio2 exists as of the March 2008 DirectX SDK */
    1.15 -#if (defined(_DXSDK_BUILD_MAJOR) && (_DXSDK_BUILD_MAJOR >= 1284))
    1.16 -#   define SDL_HAVE_XAUDIO2_H 1
    1.17 -#endif
    1.18 +#if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284))
    1.19 +#  warning Your DirectX SDK is too old. Disabling XAudio2 support.
    1.20 +#else
    1.21 +#  define SDL_XAUDIO2_HAS_SDK 1
    1.22  #endif
    1.23  
    1.24 -#ifdef SDL_HAVE_XAUDIO2_H
    1.25 +#ifdef SDL_XAUDIO2_HAS_SDK
    1.26  
    1.27  #define INITGUID 1
    1.28  #include <XAudio2.h>
    1.29 @@ -396,13 +397,14 @@
    1.30      WIN_CoUninitialize();
    1.31  }
    1.32  
    1.33 -#endif  /* SDL_HAVE_XAUDIO2_H */
    1.34 +#endif  /* SDL_XAUDIO2_HAS_SDK */
    1.35  
    1.36  
    1.37  static int
    1.38  XAUDIO2_Init(SDL_AudioDriverImpl * impl)
    1.39  {
    1.40 -#if !SDL_HAVE_XAUDIO2_H
    1.41 +#ifndef SDL_XAUDIO2_HAS_SDK
    1.42 +    SDL_SetError("XAudio2: SDL was built without XAudio2 support (old DirectX SDK).");
    1.43      return 0;  /* no XAudio2 support, ever. Update your SDK! */
    1.44  #else
    1.45      /* XAudio2Create() is a macro that uses COM; we don't load the .dll */
    1.46 @@ -437,4 +439,6 @@
    1.47      "xaudio2", "XAudio2", XAUDIO2_Init, 0
    1.48  };
    1.49  
    1.50 +#endif  /* SDL_AUDIO_DRIVER_XAUDIO2 */
    1.51 +
    1.52  /* vi: set ts=4 sw=4 expandtab: */