WinRT: merged with latest SDL 2.x/HG code

SDL 2.x recently accepted patches to enable OpenGL ES 2 support via Google's ANGLE library.  The thought is to try to eventually merge SDL/WinRT's OpenGL code with SDL-official's.
This commit is contained in:
David Ludwig 2013-11-28 22:09:21 -05:00
commit ebfac58560
999 changed files with 140431 additions and 5035 deletions

View file

@ -56,7 +56,7 @@ extern AudioBootStrap XAUDIO2_bootstrap;
extern AudioBootStrap DSOUND_bootstrap;
extern AudioBootStrap WINMM_bootstrap;
extern AudioBootStrap PAUDIO_bootstrap;
extern AudioBootStrap BEOSAUDIO_bootstrap;
extern AudioBootStrap HAIKUAUDIO_bootstrap;
extern AudioBootStrap COREAUDIO_bootstrap;
extern AudioBootStrap SNDMGR_bootstrap;
extern AudioBootStrap DISKAUD_bootstrap;
@ -113,8 +113,8 @@ static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_PAUDIO
&PAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_BEOSAUDIO
&BEOSAUDIO_bootstrap,
#if SDL_AUDIO_DRIVER_HAIKU
&HAIKUAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_COREAUDIO
&COREAUDIO_bootstrap,
@ -722,10 +722,16 @@ SDL_GetAudioDeviceName(int index, int iscapture)
}
if ((iscapture) && (current_audio.impl.OnlyHasDefaultInputDevice)) {
if (index > 0) {
goto no_such_device;
}
return DEFAULT_INPUT_DEVNAME;
}
if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) {
if (index > 0) {
goto no_such_device;
}
return DEFAULT_OUTPUT_DEVNAME;
}

View file

@ -20,13 +20,14 @@
*/
#include "SDL_config.h"
#if SDL_AUDIO_DRIVER_BEOSAUDIO
#if SDL_AUDIO_DRIVER_HAIKU
/* Allow access to the audio stream on BeOS */
/* Allow access to the audio stream on Haiku */
#include <SoundPlayer.h>
#include <signal.h>
#include "../../main/beos/SDL_BeApp.h"
#include "../../main/haiku/SDL_BeApp.h"
extern "C"
{
@ -34,14 +35,13 @@ extern "C"
#include "SDL_audio.h"
#include "../SDL_audio_c.h"
#include "../SDL_sysaudio.h"
#include "../../thread/beos/SDL_systhread_c.h"
#include "SDL_beaudio.h"
#include "SDL_haikuaudio.h"
}
/* !!! FIXME: have the callback call the higher level to avoid code dupe. */
/* The BeOS callback for handling the audio buffer */
/* The Haiku callback for handling the audio buffer */
static void
FillSound(void *device, void *stream, size_t len,
const media_raw_audio_format & format)
@ -71,7 +71,7 @@ FillSound(void *device, void *stream, size_t len,
}
static void
BEOSAUDIO_CloseDevice(_THIS)
HAIKUAUDIO_CloseDevice(_THIS)
{
if (_this->hidden != NULL) {
if (_this->hidden->audio_obj) {
@ -85,8 +85,33 @@ BEOSAUDIO_CloseDevice(_THIS)
}
}
static const int sig_list[] = {
SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGWINCH, 0
};
static inline void
MaskSignals(sigset_t * omask)
{
sigset_t mask;
int i;
sigemptyset(&mask);
for (i = 0; sig_list[i]; ++i) {
sigaddset(&mask, sig_list[i]);
}
sigprocmask(SIG_BLOCK, &mask, omask);
}
static inline void
UnmaskSignals(sigset_t * omask)
{
sigprocmask(SIG_SETMASK, omask, NULL);
}
static int
BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
HAIKUAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
{
int valid_datatype = 0;
media_raw_audio_format format;
@ -151,7 +176,7 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
}
if (!valid_datatype) { /* shouldn't happen, but just in case... */
BEOSAUDIO_CloseDevice(_this);
HAIKUAUDIO_CloseDevice(_this);
return SDL_SetError("Unsupported audio format");
}
@ -162,15 +187,15 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
/* Subscribe to the audio stream (creates a new thread) */
sigset_t omask;
SDL_MaskSignals(&omask);
MaskSignals(&omask);
_this->hidden->audio_obj = new BSoundPlayer(&format, "SDL Audio",
FillSound, NULL, _this);
SDL_UnmaskSignals(&omask);
UnmaskSignals(&omask);
if (_this->hidden->audio_obj->Start() == B_NO_ERROR) {
_this->hidden->audio_obj->SetHasData(true);
} else {
BEOSAUDIO_CloseDevice(_this);
HAIKUAUDIO_CloseDevice(_this);
return SDL_SetError("Unable to start Be audio");
}
@ -179,13 +204,13 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
}
static void
BEOSAUDIO_Deinitialize(void)
HAIKUAUDIO_Deinitialize(void)
{
SDL_QuitBeApp();
}
static int
BEOSAUDIO_Init(SDL_AudioDriverImpl * impl)
HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Initialize the Be Application, if it's not already started */
if (SDL_InitBeApp() < 0) {
@ -193,9 +218,9 @@ BEOSAUDIO_Init(SDL_AudioDriverImpl * impl)
}
/* Set the function pointers */
impl->OpenDevice = BEOSAUDIO_OpenDevice;
impl->CloseDevice = BEOSAUDIO_CloseDevice;
impl->Deinitialize = BEOSAUDIO_Deinitialize;
impl->OpenDevice = HAIKUAUDIO_OpenDevice;
impl->CloseDevice = HAIKUAUDIO_CloseDevice;
impl->Deinitialize = HAIKUAUDIO_Deinitialize;
impl->ProvidesOwnCallbackThread = 1;
impl->OnlyHasDefaultOutputDevice = 1;
@ -204,12 +229,12 @@ BEOSAUDIO_Init(SDL_AudioDriverImpl * impl)
extern "C"
{
extern AudioBootStrap BEOSAUDIO_bootstrap;
extern AudioBootStrap HAIKUAUDIO_bootstrap;
}
AudioBootStrap BEOSAUDIO_bootstrap = {
"baudio", "BeOS BSoundPlayer", BEOSAUDIO_Init, 0
AudioBootStrap HAIKUAUDIO_bootstrap = {
"haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, 0
};
#endif /* SDL_AUDIO_DRIVER_BEOSAUDIO */
#endif /* SDL_AUDIO_DRIVER_HAIKU */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -62,7 +62,11 @@
/* WinRT always has access to the .the XAudio 2 SDK */
# define SDL_XAUDIO2_HAS_SDK
#else
#include <dxsdkver.h> /* XAudio2 exists as of the March 2008 DirectX SDK */
/* XAudio2 exists as of the March 2008 DirectX SDK
The XAudio2 implementation available in the Windows 8 SDK targets Windows 8 and newer.
If you want to build SDL with XAudio2 support you should install the DirectX SDK.
*/
#include <dxsdkver.h>
#if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284))
# pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.")
#else