Commit 46bb3d87 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Implemented XAudio2 target for Windows (and Xbox360, theoretically!).

parent 8fa65eea
...@@ -847,6 +847,14 @@ ...@@ -847,6 +847,14 @@
RelativePath="..\..\src\audio\directsound\SDL_directsound.h" RelativePath="..\..\src\audio\directsound\SDL_directsound.h"
> >
</File> </File>
<File
RelativePath="..\..\src\audio\xaudio2\SDL_xaudio2.c"
>
</File>
<File
RelativePath="..\..\src\audio\xaudio2\SDL_xaudio2.h"
>
</File>
<File <File
RelativePath="..\..\src\joystick\windows\SDL_dxjoystick.c" RelativePath="..\..\src\joystick\windows\SDL_dxjoystick.c"
> >
......
...@@ -836,6 +836,14 @@ ...@@ -836,6 +836,14 @@
RelativePath="..\..\src\audio\directsound\SDL_directsound.h" RelativePath="..\..\src\audio\directsound\SDL_directsound.h"
> >
</File> </File>
<File
RelativePath="..\..\src\audio\xaudio2\SDL_xaudio2.c"
>
</File>
<File
RelativePath="..\..\src\audio\xaudio2\SDL_xaudio2.h"
>
</File>
<File <File
RelativePath="..\..\src\joystick\windows\SDL_dxjoystick.c" RelativePath="..\..\src\joystick\windows\SDL_dxjoystick.c"
> >
......
...@@ -280,6 +280,7 @@ ...@@ -280,6 +280,7 @@
<ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" /> <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
<ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h" /> <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h" />
<ClInclude Include="..\..\src\audio\directsound\SDL_directsound.h" /> <ClInclude Include="..\..\src\audio\directsound\SDL_directsound.h" />
<ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2.h" />
<ClInclude Include="..\..\src\SDL_error_c.h" /> <ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_hints_c.h" /> <ClInclude Include="..\..\src\SDL_hints_c.h" />
<ClInclude Include="..\..\src\events\SDL_events_c.h" /> <ClInclude Include="..\..\src\events\SDL_events_c.h" />
...@@ -381,6 +382,7 @@ ...@@ -381,6 +382,7 @@
<ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" /> <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
<ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c" /> <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c" />
<ClCompile Include="..\..\src\audio\directsound\SDL_directsound.c" /> <ClCompile Include="..\..\src\audio\directsound\SDL_directsound.c" />
<ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c" />
<ClCompile Include="..\..\src\joystick\windows\SDL_dxjoystick.c" /> <ClCompile Include="..\..\src\joystick\windows\SDL_dxjoystick.c" />
<ClCompile Include="..\..\src\SDL_error.c" /> <ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\events\SDL_events.c" /> <ClCompile Include="..\..\src\events\SDL_events.c" />
......
...@@ -1726,6 +1726,7 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul ...@@ -1726,6 +1726,7 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul
AC_CHECK_HEADER(ddraw.h, have_ddraw=yes) AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
AC_CHECK_HEADER(dsound.h, have_dsound=yes) AC_CHECK_HEADER(dsound.h, have_dsound=yes)
AC_CHECK_HEADER(dinput.h, have_dinput=yes) AC_CHECK_HEADER(dinput.h, have_dinput=yes)
AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
fi fi
} }
...@@ -2063,6 +2064,10 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ...@@ -2063,6 +2064,10 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
fi fi
if test x$have_xaudio2 = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
fi
have_audio=yes have_audio=yes
fi fi
# Set up dummy files for the joystick for now # Set up dummy files for the joystick for now
...@@ -2150,6 +2155,10 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ...@@ -2150,6 +2155,10 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
fi fi
if test x$have_xaudio2 = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
fi
have_audio=yes have_audio=yes
fi fi
# Set up files for the joystick library # Set up files for the joystick library
......
...@@ -184,6 +184,7 @@ ...@@ -184,6 +184,7 @@
#undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_COREAUDIO
#undef SDL_AUDIO_DRIVER_DISK #undef SDL_AUDIO_DRIVER_DISK
#undef SDL_AUDIO_DRIVER_DUMMY #undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_XAUDIO2
#undef SDL_AUDIO_DRIVER_DSOUND #undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_ESD #undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
......
...@@ -145,6 +145,7 @@ typedef unsigned int uintptr_t; ...@@ -145,6 +145,7 @@ typedef unsigned int uintptr_t;
/* Enable various audio drivers */ /* Enable various audio drivers */
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
#define SDL_AUDIO_DRIVER_DSOUND 1 #define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_XAUDIO2 1
#endif #endif
#define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DISK 1
......
...@@ -52,6 +52,7 @@ extern AudioBootStrap SUNAUDIO_bootstrap; ...@@ -52,6 +52,7 @@ extern AudioBootStrap SUNAUDIO_bootstrap;
extern AudioBootStrap ARTS_bootstrap; extern AudioBootStrap ARTS_bootstrap;
extern AudioBootStrap ESD_bootstrap; extern AudioBootStrap ESD_bootstrap;
extern AudioBootStrap NAS_bootstrap; extern AudioBootStrap NAS_bootstrap;
extern AudioBootStrap XAUDIO2_bootstrap;
extern AudioBootStrap DSOUND_bootstrap; extern AudioBootStrap DSOUND_bootstrap;
extern AudioBootStrap WINMM_bootstrap; extern AudioBootStrap WINMM_bootstrap;
extern AudioBootStrap PAUDIO_bootstrap; extern AudioBootStrap PAUDIO_bootstrap;
...@@ -97,6 +98,9 @@ static const AudioBootStrap *const bootstrap[] = { ...@@ -97,6 +98,9 @@ static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_NAS #if SDL_AUDIO_DRIVER_NAS
&NAS_bootstrap, &NAS_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_XAUDIO2
&XAUDIO2_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DSOUND #if SDL_AUDIO_DRIVER_DSOUND
&DSOUND_bootstrap, &DSOUND_bootstrap,
#endif #endif
......
This diff is collapsed.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#ifndef _SDL_xaudio2_h
#define _SDL_xaudio2_h
#include "../SDL_sysaudio.h"
#include <XAudio2.h>
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
IXAudio2 *ixa2;
IXAudio2SourceVoice *source;
IXAudio2MasteringVoice *mastering;
HANDLE semaphore;
Uint8 *mixbuf;
int mixlen;
Uint8 *nextbuf;
};
#endif /* _SDL_xaudio2_h */
/* vi: set ts=4 sw=4 expandtab: */
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