Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Implemented XAudio2 target for Windows (and Xbox360, theoretically!).
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 4, 2011
1 parent 7cf57ff commit 524c503
Show file tree
Hide file tree
Showing 9 changed files with 534 additions and 0 deletions.
8 changes: 8 additions & 0 deletions VisualC/SDL/SDL_VS2005.vcproj
Expand Up @@ -847,6 +847,14 @@
RelativePath="..\..\src\audio\directsound\SDL_directsound.h"
>
</File>
<File
RelativePath="..\..\src\audio\xaudio2\SDL_xaudio2.c"
>
</File>
<File
RelativePath="..\..\src\audio\xaudio2\SDL_xaudio2.h"
>
</File>
<File
RelativePath="..\..\src\joystick\windows\SDL_dxjoystick.c"
>
Expand Down
8 changes: 8 additions & 0 deletions VisualC/SDL/SDL_VS2008.vcproj
Expand Up @@ -836,6 +836,14 @@
RelativePath="..\..\src\audio\directsound\SDL_directsound.h"
>
</File>
<File
RelativePath="..\..\src\audio\xaudio2\SDL_xaudio2.c"
>
</File>
<File
RelativePath="..\..\src\audio\xaudio2\SDL_xaudio2.h"
>
</File>
<File
RelativePath="..\..\src\joystick\windows\SDL_dxjoystick.c"
>
Expand Down
2 changes: 2 additions & 0 deletions VisualC/SDL/SDL_VS2010.vcxproj
Expand Up @@ -280,6 +280,7 @@
<ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
<ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.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_hints_c.h" />
<ClInclude Include="..\..\src\events\SDL_events_c.h" />
Expand Down Expand Up @@ -381,6 +382,7 @@
<ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
<ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.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\SDL_error.c" />
<ClCompile Include="..\..\src\events\SDL_events.c" />
Expand Down
9 changes: 9 additions & 0 deletions configure.in
Expand Up @@ -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(dsound.h, have_dsound=yes)
AC_CHECK_HEADER(dinput.h, have_dinput=yes)
AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
fi
}

Expand Down Expand Up @@ -2063,6 +2064,10 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
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
fi
# Set up dummy files for the joystick for now
Expand Down Expand Up @@ -2150,6 +2155,10 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
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
fi
# Set up files for the joystick library
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config.h.in
Expand Up @@ -184,6 +184,7 @@
#undef SDL_AUDIO_DRIVER_COREAUDIO
#undef SDL_AUDIO_DRIVER_DISK
#undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_XAUDIO2
#undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config_windows.h
Expand Up @@ -145,6 +145,7 @@ typedef unsigned int uintptr_t;
/* Enable various audio drivers */
#ifndef _WIN32_WCE
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_XAUDIO2 1
#endif
#define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1
Expand Down
4 changes: 4 additions & 0 deletions src/audio/SDL_audio.c
Expand Up @@ -52,6 +52,7 @@ extern AudioBootStrap SUNAUDIO_bootstrap;
extern AudioBootStrap ARTS_bootstrap;
extern AudioBootStrap ESD_bootstrap;
extern AudioBootStrap NAS_bootstrap;
extern AudioBootStrap XAUDIO2_bootstrap;
extern AudioBootStrap DSOUND_bootstrap;
extern AudioBootStrap WINMM_bootstrap;
extern AudioBootStrap PAUDIO_bootstrap;
Expand Down Expand Up @@ -97,6 +98,9 @@ static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_NAS
&NAS_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_XAUDIO2
&XAUDIO2_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DSOUND
&DSOUND_bootstrap,
#endif
Expand Down

0 comments on commit 524c503

Please sign in to comment.