src/audio/xaudio2/SDL_xaudio2.c
changeset 7226 1c440669e32c
parent 7218 08c403ba173e
child 7689 c64896ddeeae
child 8477 ad08f0d710f3
equal deleted inserted replaced
7225:4070fc496bc1 7226:1c440669e32c
    26 #include "SDL_audio.h"
    26 #include "SDL_audio.h"
    27 #include "../SDL_audio_c.h"
    27 #include "../SDL_audio_c.h"
    28 #include "../SDL_sysaudio.h"
    28 #include "../SDL_sysaudio.h"
    29 #include "SDL_assert.h"
    29 #include "SDL_assert.h"
    30 
    30 
       
    31 #ifdef __GNUC__
       
    32 /* The configure script already did any necessary checking */
       
    33 #  define SDL_XAUDIO2_HAS_SDK 1
       
    34 #else
    31 #include <dxsdkver.h> /* XAudio2 exists as of the March 2008 DirectX SDK */
    35 #include <dxsdkver.h> /* XAudio2 exists as of the March 2008 DirectX SDK */
    32 #if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284))
    36 #if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284))
    33 #  pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.")
    37 #  pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.")
    34 #else
    38 #else
    35 #  define SDL_XAUDIO2_HAS_SDK 1
    39 #  define SDL_XAUDIO2_HAS_SDK 1
    36 #endif
    40 #endif
       
    41 #endif /* __GNUC__ */
    37 
    42 
    38 #ifdef SDL_XAUDIO2_HAS_SDK
    43 #ifdef SDL_XAUDIO2_HAS_SDK
    39 
    44 
    40 #define INITGUID 1
    45 #define INITGUID 1
    41 #include <XAudio2.h>
    46 #include <xaudio2.h>
    42 
    47 
    43 /* Hidden "this" pointer for the audio functions */
    48 /* Hidden "this" pointer for the audio functions */
    44 #define _THIS   SDL_AudioDevice *this
    49 #define _THIS   SDL_AudioDevice *this
    45 
    50 
    46 struct SDL_PrivateAudioData
    51 struct SDL_PrivateAudioData
    67 XAUDIO2_DetectDevices(int iscapture, SDL_AddAudioDevice addfn)
    72 XAUDIO2_DetectDevices(int iscapture, SDL_AddAudioDevice addfn)
    68 {
    73 {
    69     IXAudio2 *ixa2 = NULL;
    74     IXAudio2 *ixa2 = NULL;
    70     UINT32 devcount = 0;
    75     UINT32 devcount = 0;
    71     UINT32 i = 0;
    76     UINT32 i = 0;
    72     void *ptr = NULL;
       
    73 
    77 
    74     if (iscapture) {
    78     if (iscapture) {
    75         SDL_SetError("XAudio2: capture devices unsupported.");
    79         SDL_SetError("XAudio2: capture devices unsupported.");
    76         return;
    80         return;
    77     } else if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) {
    81     } else if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) {