mirror of https://github.com/encounter/SDL.git
cleanup init functions of audio
- use SDL_bool if possible - assume NULL/SDL_FALSE filled impl - skip zfill of current_audio at the beginning of SDL_AudioInit (done before the init() calls)
This commit is contained in:
parent
6fcfcc3d6f
commit
0dda8a7f4c
|
@ -943,15 +943,14 @@ SDL_GetAudioDriver(int index)
|
||||||
int
|
int
|
||||||
SDL_AudioInit(const char *driver_name)
|
SDL_AudioInit(const char *driver_name)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i;
|
||||||
int initialized = 0;
|
SDL_bool initialized = SDL_FALSE, tried_to_init = SDL_FALSE;
|
||||||
int tried_to_init = 0;
|
|
||||||
|
|
||||||
if (SDL_GetCurrentAudioDriver()) {
|
if (SDL_GetCurrentAudioDriver()) {
|
||||||
SDL_AudioQuit(); /* shutdown driver if already running. */
|
SDL_AudioQuit(); /* shutdown driver if already running. */
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_zero(current_audio);
|
// SDL_zero(current_audio); -- no need at this point, done before init()
|
||||||
SDL_zeroa(open_devices);
|
SDL_zeroa(open_devices);
|
||||||
|
|
||||||
/* Select the proper audio driver */
|
/* Select the proper audio driver */
|
||||||
|
@ -977,7 +976,7 @@ SDL_AudioInit(const char *driver_name)
|
||||||
for (i = 0; bootstrap[i]; ++i) {
|
for (i = 0; bootstrap[i]; ++i) {
|
||||||
if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
|
if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
|
||||||
(SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
|
(SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
|
||||||
tried_to_init = 1;
|
tried_to_init = SDL_TRUE;
|
||||||
SDL_zero(current_audio);
|
SDL_zero(current_audio);
|
||||||
current_audio.name = bootstrap[i]->name;
|
current_audio.name = bootstrap[i]->name;
|
||||||
current_audio.desc = bootstrap[i]->desc;
|
current_audio.desc = bootstrap[i]->desc;
|
||||||
|
@ -994,7 +993,7 @@ SDL_AudioInit(const char *driver_name)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tried_to_init = 1;
|
tried_to_init = SDL_TRUE;
|
||||||
SDL_zero(current_audio);
|
SDL_zero(current_audio);
|
||||||
current_audio.name = bootstrap[i]->name;
|
current_audio.name = bootstrap[i]->name;
|
||||||
current_audio.desc = bootstrap[i]->desc;
|
current_audio.desc = bootstrap[i]->desc;
|
||||||
|
|
|
@ -84,12 +84,11 @@ typedef struct SDL_AudioDriverImpl
|
||||||
/* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */
|
/* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */
|
||||||
|
|
||||||
/* Some flags to push duplicate code into the core and reduce #ifdefs. */
|
/* Some flags to push duplicate code into the core and reduce #ifdefs. */
|
||||||
/* !!! FIXME: these should be SDL_bool */
|
SDL_bool ProvidesOwnCallbackThread;
|
||||||
int ProvidesOwnCallbackThread;
|
SDL_bool HasCaptureSupport;
|
||||||
int HasCaptureSupport;
|
SDL_bool OnlyHasDefaultOutputDevice;
|
||||||
int OnlyHasDefaultOutputDevice;
|
SDL_bool OnlyHasDefaultCaptureDevice;
|
||||||
int OnlyHasDefaultCaptureDevice;
|
SDL_bool AllowsArbitraryDeviceNames;
|
||||||
int AllowsArbitraryDeviceNames;
|
|
||||||
} SDL_AudioDriverImpl;
|
} SDL_AudioDriverImpl;
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,8 +176,8 @@ typedef struct AudioBootStrap
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *desc;
|
const char *desc;
|
||||||
int (*init) (SDL_AudioDriverImpl * impl);
|
SDL_bool (*init) (SDL_AudioDriverImpl * impl);
|
||||||
int demand_only; /* 1==request explicitly, or it won't be available. */
|
SDL_bool demand_only; /* 1==request explicitly, or it won't be available. */
|
||||||
} AudioBootStrap;
|
} AudioBootStrap;
|
||||||
|
|
||||||
/* Not all of these are available in a given build. Use #ifdefs, etc. */
|
/* Not all of these are available in a given build. Use #ifdefs, etc. */
|
||||||
|
|
|
@ -268,7 +268,7 @@ aaudio_Deinitialize(void)
|
||||||
LOGI("End AAUDIO %s", SDL_GetError());
|
LOGI("End AAUDIO %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
aaudio_Init(SDL_AudioDriverImpl *impl)
|
aaudio_Init(SDL_AudioDriverImpl *impl)
|
||||||
{
|
{
|
||||||
aaudio_result_t res;
|
aaudio_result_t res;
|
||||||
|
@ -280,7 +280,7 @@ aaudio_Init(SDL_AudioDriverImpl *impl)
|
||||||
* See https://github.com/google/oboe/issues/40 for more information.
|
* See https://github.com/google/oboe/issues/40 for more information.
|
||||||
*/
|
*/
|
||||||
if (SDL_GetAndroidSDKVersion() < 27) {
|
if (SDL_GetAndroidSDKVersion() < 27) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_zero(ctx);
|
SDL_zero(ctx);
|
||||||
|
@ -315,12 +315,12 @@ aaudio_Init(SDL_AudioDriverImpl *impl)
|
||||||
|
|
||||||
/* and the capabilities */
|
/* and the capabilities */
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultCaptureDevice = 1;
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||||
|
|
||||||
/* this audio target is available. */
|
/* this audio target is available. */
|
||||||
LOGI("SDL aaudio_Init OK");
|
LOGI("SDL aaudio_Init OK");
|
||||||
return 1;
|
return SDL_TRUE;
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
if (ctx.handle) {
|
if (ctx.handle) {
|
||||||
|
@ -331,11 +331,11 @@ failure:
|
||||||
}
|
}
|
||||||
ctx.handle = NULL;
|
ctx.handle = NULL;
|
||||||
ctx.builder = NULL;
|
ctx.builder = NULL;
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap aaudio_bootstrap = {
|
AudioBootStrap aaudio_bootstrap = {
|
||||||
"AAudio", "AAudio audio driver", aaudio_Init, 0
|
"AAudio", "AAudio audio driver", aaudio_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Pause (block) all non already paused audio devices by taking their mixer lock */
|
/* Pause (block) all non already paused audio devices by taking their mixer lock */
|
||||||
|
|
|
@ -997,11 +997,11 @@ ALSA_Deinitialize(void)
|
||||||
UnloadALSALibrary();
|
UnloadALSALibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
ALSA_Init(SDL_AudioDriverImpl * impl)
|
ALSA_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (LoadALSALibrary() < 0) {
|
if (LoadALSALibrary() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -1017,12 +1017,12 @@ ALSA_Init(SDL_AudioDriverImpl * impl)
|
||||||
|
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioBootStrap ALSA_bootstrap = {
|
AudioBootStrap ALSA_bootstrap = {
|
||||||
"alsa", "ALSA PCM audio", ALSA_Init, 0
|
"alsa", "ALSA PCM audio", ALSA_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_ALSA */
|
#endif /* SDL_AUDIO_DRIVER_ALSA */
|
||||||
|
|
|
@ -120,7 +120,7 @@ ANDROIDAUDIO_CloseDevice(_THIS)
|
||||||
SDL_free(this->hidden);
|
SDL_free(this->hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
|
ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -133,14 +133,14 @@ ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
|
|
||||||
/* and the capabilities */
|
/* and the capabilities */
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultCaptureDevice = 1;
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap ANDROIDAUDIO_bootstrap = {
|
AudioBootStrap ANDROIDAUDIO_bootstrap = {
|
||||||
"android", "SDL Android audio driver", ANDROIDAUDIO_Init, 0
|
"android", "SDL Android audio driver", ANDROIDAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Pause (block) all non already paused audio devices by taking their mixer lock */
|
/* Pause (block) all non already paused audio devices by taking their mixer lock */
|
||||||
|
|
|
@ -320,16 +320,16 @@ ARTS_Deinitialize(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
ARTS_Init(SDL_AudioDriverImpl * impl)
|
ARTS_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (LoadARTSLibrary() < 0) {
|
if (LoadARTSLibrary() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (SDL_NAME(arts_init) () != 0) {
|
if (SDL_NAME(arts_init) () != 0) {
|
||||||
UnloadARTSLibrary();
|
UnloadARTSLibrary();
|
||||||
SDL_SetError("ARTS: arts_init failed (no audio server?)");
|
SDL_SetError("ARTS: arts_init failed (no audio server?)");
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Play a stream so aRts doesn't crash */
|
/* Play a stream so aRts doesn't crash */
|
||||||
|
@ -350,14 +350,14 @@ ARTS_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->GetDeviceBuf = ARTS_GetDeviceBuf;
|
impl->GetDeviceBuf = ARTS_GetDeviceBuf;
|
||||||
impl->CloseDevice = ARTS_CloseDevice;
|
impl->CloseDevice = ARTS_CloseDevice;
|
||||||
impl->Deinitialize = ARTS_Deinitialize;
|
impl->Deinitialize = ARTS_Deinitialize;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioBootStrap ARTS_bootstrap = {
|
AudioBootStrap ARTS_bootstrap = {
|
||||||
"arts", "Analog RealTime Synthesizer", ARTS_Init, 0
|
"arts", "Analog RealTime Synthesizer", ARTS_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_ARTS */
|
#endif /* SDL_AUDIO_DRIVER_ARTS */
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ COREAUDIO_Deinitialize(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
COREAUDIO_Init(SDL_AudioDriverImpl * impl)
|
COREAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -1164,18 +1164,18 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->DetectDevices = COREAUDIO_DetectDevices;
|
impl->DetectDevices = COREAUDIO_DetectDevices;
|
||||||
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
|
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
|
||||||
#else
|
#else
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultCaptureDevice = 1;
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
impl->ProvidesOwnCallbackThread = 1;
|
impl->ProvidesOwnCallbackThread = SDL_TRUE;
|
||||||
impl->HasCaptureSupport = 1;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap COREAUDIO_bootstrap = {
|
AudioBootStrap COREAUDIO_bootstrap = {
|
||||||
"coreaudio", "CoreAudio", COREAUDIO_Init, 0
|
"coreaudio", "CoreAudio", COREAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_COREAUDIO */
|
#endif /* SDL_AUDIO_DRIVER_COREAUDIO */
|
||||||
|
|
|
@ -575,11 +575,11 @@ DSOUND_Deinitialize(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
DSOUND_Init(SDL_AudioDriverImpl * impl)
|
DSOUND_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (!DSOUND_Load()) {
|
if (!DSOUND_Load()) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -596,11 +596,11 @@ DSOUND_Init(SDL_AudioDriverImpl * impl)
|
||||||
|
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap DSOUND_bootstrap = {
|
AudioBootStrap DSOUND_bootstrap = {
|
||||||
"directsound", "DirectSound", DSOUND_Init, 0
|
"directsound", "DirectSound", DSOUND_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_DSOUND */
|
#endif /* SDL_AUDIO_DRIVER_DSOUND */
|
||||||
|
|
|
@ -177,7 +177,7 @@ DISKAUDIO_DetectDevices(void)
|
||||||
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2);
|
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
|
DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -191,14 +191,14 @@ DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->CloseDevice = DISKAUDIO_CloseDevice;
|
impl->CloseDevice = DISKAUDIO_CloseDevice;
|
||||||
impl->DetectDevices = DISKAUDIO_DetectDevices;
|
impl->DetectDevices = DISKAUDIO_DetectDevices;
|
||||||
|
|
||||||
impl->AllowsArbitraryDeviceNames = 1;
|
impl->AllowsArbitraryDeviceNames = SDL_TRUE;
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap DISKAUDIO_bootstrap = {
|
AudioBootStrap DISKAUDIO_bootstrap = {
|
||||||
"disk", "direct-to-disk audio", DISKAUDIO_Init, 1
|
"disk", "direct-to-disk audio", DISKAUDIO_Init, SDL_TRUE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_DISK */
|
#endif /* SDL_AUDIO_DRIVER_DISK */
|
||||||
|
|
|
@ -301,13 +301,13 @@ look_for_devices_test(int fd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
DSP_Init(SDL_AudioDriverImpl * impl)
|
DSP_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
InitTimeDevicesExist = SDL_FALSE;
|
InitTimeDevicesExist = SDL_FALSE;
|
||||||
SDL_EnumUnixAudioDevices(0, look_for_devices_test);
|
SDL_EnumUnixAudioDevices(0, look_for_devices_test);
|
||||||
if (!InitTimeDevicesExist) {
|
if (!InitTimeDevicesExist) {
|
||||||
return 0; /* maybe try a different backend. */
|
return SDL_FALSE; /* maybe try a different backend. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -319,15 +319,15 @@ DSP_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->CaptureFromDevice = DSP_CaptureFromDevice;
|
impl->CaptureFromDevice = DSP_CaptureFromDevice;
|
||||||
impl->FlushCapture = DSP_FlushCapture;
|
impl->FlushCapture = DSP_FlushCapture;
|
||||||
|
|
||||||
impl->AllowsArbitraryDeviceNames = 1;
|
impl->AllowsArbitraryDeviceNames = SDL_TRUE;
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioBootStrap DSP_bootstrap = {
|
AudioBootStrap DSP_bootstrap = {
|
||||||
"dsp", "OSS /dev/dsp standard audio", DSP_Init, 0
|
"dsp", "OSS /dev/dsp standard audio", DSP_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_OSS */
|
#endif /* SDL_AUDIO_DRIVER_OSS */
|
||||||
|
|
|
@ -45,22 +45,22 @@ DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
return buflen;
|
return buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl)
|
DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = DUMMYAUDIO_OpenDevice;
|
impl->OpenDevice = DUMMYAUDIO_OpenDevice;
|
||||||
impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice;
|
impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice;
|
||||||
|
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultCaptureDevice = 1;
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap DUMMYAUDIO_bootstrap = {
|
AudioBootStrap DUMMYAUDIO_bootstrap = {
|
||||||
"dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, 1
|
"dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -344,30 +344,29 @@ EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
|
EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
int available;
|
SDL_bool available, capture_available;
|
||||||
int capture_available;
|
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice;
|
impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice;
|
||||||
impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice;
|
impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice;
|
||||||
|
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
|
|
||||||
/* no threads here */
|
/* no threads here */
|
||||||
impl->LockDevice = impl->UnlockDevice = EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock;
|
impl->LockDevice = impl->UnlockDevice = EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock;
|
||||||
impl->ProvidesOwnCallbackThread = 1;
|
impl->ProvidesOwnCallbackThread = SDL_TRUE;
|
||||||
|
|
||||||
/* check availability */
|
/* check availability */
|
||||||
available = EM_ASM_INT_V({
|
available = EM_ASM_INT_V({
|
||||||
if (typeof(AudioContext) !== 'undefined') {
|
if (typeof(AudioContext) !== 'undefined') {
|
||||||
return 1;
|
return SDL_TRUE;
|
||||||
} else if (typeof(webkitAudioContext) !== 'undefined') {
|
} else if (typeof(webkitAudioContext) !== 'undefined') {
|
||||||
return 1;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!available) {
|
if (!available) {
|
||||||
|
@ -376,11 +375,11 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
|
|
||||||
capture_available = available && EM_ASM_INT_V({
|
capture_available = available && EM_ASM_INT_V({
|
||||||
if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) {
|
if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) {
|
||||||
return 1;
|
return SDL_TRUE;
|
||||||
} else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') {
|
} else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') {
|
||||||
return 1;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
});
|
});
|
||||||
|
|
||||||
impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE;
|
impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE;
|
||||||
|
@ -390,7 +389,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap EMSCRIPTENAUDIO_bootstrap = {
|
AudioBootStrap EMSCRIPTENAUDIO_bootstrap = {
|
||||||
"emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, 0
|
"emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */
|
#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */
|
||||||
|
|
|
@ -293,11 +293,11 @@ ESD_Deinitialize(void)
|
||||||
UnloadESDLibrary();
|
UnloadESDLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
ESD_Init(SDL_AudioDriverImpl * impl)
|
ESD_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (LoadESDLibrary() < 0) {
|
if (LoadESDLibrary() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
} else {
|
} else {
|
||||||
int connection = 0;
|
int connection = 0;
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ ESD_Init(SDL_AudioDriverImpl * impl)
|
||||||
if (connection < 0) {
|
if (connection < 0) {
|
||||||
UnloadESDLibrary();
|
UnloadESDLibrary();
|
||||||
SDL_SetError("ESD: esd_open_sound failed (no audio server?)");
|
SDL_SetError("ESD: esd_open_sound failed (no audio server?)");
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
SDL_NAME(esd_close) (connection);
|
SDL_NAME(esd_close) (connection);
|
||||||
}
|
}
|
||||||
|
@ -320,14 +320,14 @@ ESD_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->GetDeviceBuf = ESD_GetDeviceBuf;
|
impl->GetDeviceBuf = ESD_GetDeviceBuf;
|
||||||
impl->CloseDevice = ESD_CloseDevice;
|
impl->CloseDevice = ESD_CloseDevice;
|
||||||
impl->Deinitialize = ESD_Deinitialize;
|
impl->Deinitialize = ESD_Deinitialize;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioBootStrap ESD_bootstrap = {
|
AudioBootStrap ESD_bootstrap = {
|
||||||
"esd", "Enlightened Sound Daemon", ESD_Init, 0
|
"esd", "Enlightened Sound Daemon", ESD_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_ESD */
|
#endif /* SDL_AUDIO_DRIVER_ESD */
|
||||||
|
|
|
@ -288,11 +288,11 @@ SDL_FS_Deinitialize(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
SDL_FS_Init(SDL_AudioDriverImpl * impl)
|
SDL_FS_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (LoadFusionSoundLibrary() < 0) {
|
if (LoadFusionSoundLibrary() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
} else {
|
} else {
|
||||||
DirectResult ret;
|
DirectResult ret;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl)
|
||||||
SDL_SetError
|
SDL_SetError
|
||||||
("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)",
|
("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)",
|
||||||
ret);
|
ret);
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,14 +313,14 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->GetDeviceBuf = SDL_FS_GetDeviceBuf;
|
impl->GetDeviceBuf = SDL_FS_GetDeviceBuf;
|
||||||
impl->CloseDevice = SDL_FS_CloseDevice;
|
impl->CloseDevice = SDL_FS_CloseDevice;
|
||||||
impl->Deinitialize = SDL_FS_Deinitialize;
|
impl->Deinitialize = SDL_FS_Deinitialize;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioBootStrap FUSIONSOUND_bootstrap = {
|
AudioBootStrap FUSIONSOUND_bootstrap = {
|
||||||
"fusionsound", "FusionSound", SDL_FS_Init, 0
|
"fusionsound", "FusionSound", SDL_FS_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */
|
#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */
|
||||||
|
|
|
@ -216,22 +216,22 @@ HAIKUAUDIO_Deinitialize(void)
|
||||||
SDL_QuitBeApp();
|
SDL_QuitBeApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl)
|
HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Initialize the Be Application, if it's not already started */
|
/* Initialize the Be Application, if it's not already started */
|
||||||
if (SDL_InitBeApp() < 0) {
|
if (SDL_InitBeApp() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = HAIKUAUDIO_OpenDevice;
|
impl->OpenDevice = HAIKUAUDIO_OpenDevice;
|
||||||
impl->CloseDevice = HAIKUAUDIO_CloseDevice;
|
impl->CloseDevice = HAIKUAUDIO_CloseDevice;
|
||||||
impl->Deinitialize = HAIKUAUDIO_Deinitialize;
|
impl->Deinitialize = HAIKUAUDIO_Deinitialize;
|
||||||
impl->ProvidesOwnCallbackThread = 1;
|
impl->ProvidesOwnCallbackThread = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -239,7 +239,7 @@ extern "C"
|
||||||
extern AudioBootStrap HAIKUAUDIO_bootstrap;
|
extern AudioBootStrap HAIKUAUDIO_bootstrap;
|
||||||
}
|
}
|
||||||
AudioBootStrap HAIKUAUDIO_bootstrap = {
|
AudioBootStrap HAIKUAUDIO_bootstrap = {
|
||||||
"haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, 0
|
"haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_HAIKU */
|
#endif /* SDL_AUDIO_DRIVER_HAIKU */
|
||||||
|
|
|
@ -405,18 +405,18 @@ JACK_Deinitialize(void)
|
||||||
UnloadJackLibrary();
|
UnloadJackLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
JACK_Init(SDL_AudioDriverImpl * impl)
|
JACK_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (LoadJackLibrary() < 0) {
|
if (LoadJackLibrary() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* Make sure a JACK server is running and available. */
|
/* Make sure a JACK server is running and available. */
|
||||||
jack_status_t status;
|
jack_status_t status;
|
||||||
jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL);
|
jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL);
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
UnloadJackLibrary();
|
UnloadJackLibrary();
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
JACK_jack_client_close(client);
|
JACK_jack_client_close(client);
|
||||||
}
|
}
|
||||||
|
@ -433,11 +433,11 @@ JACK_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap JACK_bootstrap = {
|
AudioBootStrap JACK_bootstrap = {
|
||||||
"jack", "JACK Audio Connection Kit", JACK_Init, 0
|
"jack", "JACK Audio Connection Kit", JACK_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_JACK */
|
#endif /* SDL_AUDIO_DRIVER_JACK */
|
||||||
|
|
|
@ -133,18 +133,18 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
|
NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (PSGetInstanceId() == 0) {
|
if (PSGetInstanceId() == 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = NACLAUDIO_OpenDevice;
|
impl->OpenDevice = NACLAUDIO_OpenDevice;
|
||||||
impl->CloseDevice = NACLAUDIO_CloseDevice;
|
impl->CloseDevice = NACLAUDIO_CloseDevice;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
impl->ProvidesOwnCallbackThread = 1;
|
impl->ProvidesOwnCallbackThread = SDL_TRUE;
|
||||||
/*
|
/*
|
||||||
* impl->WaitDevice = NACLAUDIO_WaitDevice;
|
* impl->WaitDevice = NACLAUDIO_WaitDevice;
|
||||||
* impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf;
|
* impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf;
|
||||||
|
@ -152,12 +152,12 @@ NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
* impl->Deinitialize = NACLAUDIO_Deinitialize;
|
* impl->Deinitialize = NACLAUDIO_Deinitialize;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 1;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap NACLAUDIO_bootstrap = {
|
AudioBootStrap NACLAUDIO_bootstrap = {
|
||||||
NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver",
|
NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver",
|
||||||
NACLAUDIO_Init, 0
|
NACLAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_NACL */
|
#endif /* SDL_AUDIO_DRIVER_NACL */
|
||||||
|
|
|
@ -423,16 +423,16 @@ NAS_Deinitialize(void)
|
||||||
UnloadNASLibrary();
|
UnloadNASLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
NAS_Init(SDL_AudioDriverImpl * impl)
|
NAS_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (LoadNASLibrary() < 0) {
|
if (LoadNASLibrary() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
} else {
|
} else {
|
||||||
AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
|
AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
|
||||||
if (aud == NULL) {
|
if (aud == NULL) {
|
||||||
SDL_SetError("NAS: AuOpenServer() failed (no audio server?)");
|
SDL_SetError("NAS: AuOpenServer() failed (no audio server?)");
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
NAS_AuCloseServer(aud);
|
NAS_AuCloseServer(aud);
|
||||||
}
|
}
|
||||||
|
@ -447,15 +447,15 @@ NAS_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->CloseDevice = NAS_CloseDevice;
|
impl->CloseDevice = NAS_CloseDevice;
|
||||||
impl->Deinitialize = NAS_Deinitialize;
|
impl->Deinitialize = NAS_Deinitialize;
|
||||||
|
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultCaptureDevice = 1;
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap NAS_bootstrap = {
|
AudioBootStrap NAS_bootstrap = {
|
||||||
"nas", "Network Audio System", NAS_Init, 0
|
"nas", "Network Audio System", NAS_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_NAS */
|
#endif /* SDL_AUDIO_DRIVER_NAS */
|
||||||
|
|
|
@ -326,7 +326,7 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl)
|
NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -339,14 +339,14 @@ NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->FlushCapture = NETBSDAUDIO_FlushCapture;
|
impl->FlushCapture = NETBSDAUDIO_FlushCapture;
|
||||||
|
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
impl->AllowsArbitraryDeviceNames = 1;
|
impl->AllowsArbitraryDeviceNames = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioBootStrap NETBSDAUDIO_bootstrap = {
|
AudioBootStrap NETBSDAUDIO_bootstrap = {
|
||||||
"netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0
|
"netbsd", "NetBSD audio", NETBSDAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_NETBSD */
|
#endif /* SDL_AUDIO_DRIVER_NETBSD */
|
||||||
|
|
|
@ -714,13 +714,13 @@ openslES_CloseDevice(_THIS)
|
||||||
SDL_free(this->hidden);
|
SDL_free(this->hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
openslES_Init(SDL_AudioDriverImpl * impl)
|
openslES_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
LOGI("openslES_Init() called");
|
LOGI("openslES_Init() called");
|
||||||
|
|
||||||
if (!openslES_CreateEngine()) {
|
if (!openslES_CreateEngine()) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGI("openslES_Init() - set pointers");
|
LOGI("openslES_Init() - set pointers");
|
||||||
|
@ -736,18 +736,18 @@ openslES_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->Deinitialize = openslES_DestroyEngine;
|
impl->Deinitialize = openslES_DestroyEngine;
|
||||||
|
|
||||||
/* and the capabilities */
|
/* and the capabilities */
|
||||||
impl->HasCaptureSupport = 1;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultCaptureDevice = 1;
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||||
|
|
||||||
LOGI("openslES_Init() - success");
|
LOGI("openslES_Init() - success");
|
||||||
|
|
||||||
/* this audio target is available. */
|
/* this audio target is available. */
|
||||||
return 1;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap openslES_bootstrap = {
|
AudioBootStrap openslES_bootstrap = {
|
||||||
"openslES", "opensl ES audio driver", openslES_Init, 0
|
"openslES", "opensl ES audio driver", openslES_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
void openslES_ResumeDevices(void)
|
void openslES_ResumeDevices(void)
|
||||||
|
|
|
@ -423,7 +423,7 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int OS2_Init(SDL_AudioDriverImpl * impl)
|
static SDL_bool OS2_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->DetectDevices = OS2_DetectDevices;
|
impl->DetectDevices = OS2_DetectDevices;
|
||||||
|
@ -438,12 +438,12 @@ static int OS2_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->FlushCapture = ;
|
impl->FlushCapture = ;
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
*/
|
*/
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioBootStrap OS2AUDIO_bootstrap = {
|
AudioBootStrap OS2AUDIO_bootstrap = {
|
||||||
"DART", "OS/2 DART", OS2_Init, 0
|
"DART", "OS/2 DART", OS2_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_OS2 */
|
#endif /* SDL_AUDIO_DRIVER_OS2 */
|
||||||
|
|
|
@ -485,14 +485,14 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
PAUDIO_Init(SDL_AudioDriverImpl * impl)
|
PAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* !!! FIXME: not right for device enum? */
|
/* !!! FIXME: not right for device enum? */
|
||||||
int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
|
int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
SDL_SetError("PAUDIO: Couldn't open audio device");
|
SDL_SetError("PAUDIO: Couldn't open audio device");
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
@ -502,13 +502,13 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->PlayDevice = PAUDIO_WaitDevice;
|
impl->PlayDevice = PAUDIO_WaitDevice;
|
||||||
impl->GetDeviceBuf = PAUDIO_GetDeviceBuf;
|
impl->GetDeviceBuf = PAUDIO_GetDeviceBuf;
|
||||||
impl->CloseDevice = PAUDIO_CloseDevice;
|
impl->CloseDevice = PAUDIO_CloseDevice;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE; /* !!! FIXME: add device enum! */
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap PAUDIO_bootstrap = {
|
AudioBootStrap PAUDIO_bootstrap = {
|
||||||
"paud", "AIX Paudio", PAUDIO_Init, 0
|
"paud", "AIX Paudio", PAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_PAUDIO */
|
#endif /* SDL_AUDIO_DRIVER_PAUDIO */
|
||||||
|
|
|
@ -1223,19 +1223,19 @@ PIPEWIRE_Deinitialize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
PIPEWIRE_Init(SDL_AudioDriverImpl *impl)
|
PIPEWIRE_Init(SDL_AudioDriverImpl *impl)
|
||||||
{
|
{
|
||||||
if (!pipewire_initialized) {
|
if (!pipewire_initialized) {
|
||||||
if (init_pipewire_library() < 0) {
|
if (init_pipewire_library() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pipewire_initialized = SDL_TRUE;
|
pipewire_initialized = SDL_TRUE;
|
||||||
|
|
||||||
if (hotplug_loop_init() < 0) {
|
if (hotplug_loop_init() < 0) {
|
||||||
PIPEWIRE_Deinitialize();
|
PIPEWIRE_Deinitialize();
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,13 +1245,13 @@ PIPEWIRE_Init(SDL_AudioDriverImpl *impl)
|
||||||
impl->CloseDevice = PIPEWIRE_CloseDevice;
|
impl->CloseDevice = PIPEWIRE_CloseDevice;
|
||||||
impl->Deinitialize = PIPEWIRE_Deinitialize;
|
impl->Deinitialize = PIPEWIRE_Deinitialize;
|
||||||
|
|
||||||
impl->HasCaptureSupport = 1;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
impl->ProvidesOwnCallbackThread = 1;
|
impl->ProvidesOwnCallbackThread = SDL_TRUE;
|
||||||
|
|
||||||
return 1;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap PIPEWIRE_bootstrap = { "pipewire", "Pipewire", PIPEWIRE_Init, 0 };
|
AudioBootStrap PIPEWIRE_bootstrap = { "pipewire", "Pipewire", PIPEWIRE_Init, SDL_FALSE };
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_PIPEWIRE */
|
#endif /* SDL_AUDIO_DRIVER_PIPEWIRE */
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ static void PSPAUDIO_ThreadInit(_THIS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
PSPAUDIO_Init(SDL_AudioDriverImpl * impl)
|
PSPAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -170,16 +170,16 @@ PSPAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->ThreadInit = PSPAUDIO_ThreadInit;
|
impl->ThreadInit = PSPAUDIO_ThreadInit;
|
||||||
|
|
||||||
/* PSP audio device */
|
/* PSP audio device */
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
/*
|
/*
|
||||||
impl->HasCaptureSupport = 1;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultCaptureDevice = 1;
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||||
*/
|
*/
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap PSPAUDIO_bootstrap = {
|
AudioBootStrap PSPAUDIO_bootstrap = {
|
||||||
"psp", "PSP audio driver", PSPAUDIO_Init, 0
|
"psp", "PSP audio driver", PSPAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_PSP */
|
#endif /* SDL_AUDIO_DRIVER_PSP */
|
||||||
|
|
|
@ -832,16 +832,16 @@ PULSEAUDIO_Deinitialize(void)
|
||||||
UnloadPulseAudioLibrary();
|
UnloadPulseAudioLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
|
PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (LoadPulseAudioLibrary() < 0) {
|
if (LoadPulseAudioLibrary() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConnectToPulseServer(&hotplug_mainloop, &hotplug_context) < 0) {
|
if (ConnectToPulseServer(&hotplug_mainloop, &hotplug_context) < 0) {
|
||||||
UnloadPulseAudioLibrary();
|
UnloadPulseAudioLibrary();
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
include_monitors = SDL_GetHintBoolean(SDL_HINT_AUDIO_INCLUDE_MONITORS, SDL_FALSE);
|
include_monitors = SDL_GetHintBoolean(SDL_HINT_AUDIO_INCLUDE_MONITORS, SDL_FALSE);
|
||||||
|
@ -859,11 +859,11 @@ PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
|
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap PULSEAUDIO_bootstrap = {
|
AudioBootStrap PULSEAUDIO_bootstrap = {
|
||||||
"pulseaudio", "PulseAudio", PULSEAUDIO_Init, 0
|
"pulseaudio", "PulseAudio", PULSEAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_PULSEAUDIO */
|
#endif /* SDL_AUDIO_DRIVER_PULSEAUDIO */
|
||||||
|
|
|
@ -635,7 +635,7 @@ QSA_Deinitialize(void)
|
||||||
qsa_capture_devices = 0;
|
qsa_capture_devices = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
QSA_Init(SDL_AudioDriverImpl * impl)
|
QSA_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Clear devices array */
|
/* Clear devices array */
|
||||||
|
@ -655,19 +655,14 @@ QSA_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->GetDeviceBuf = QSA_GetDeviceBuf;
|
impl->GetDeviceBuf = QSA_GetDeviceBuf;
|
||||||
impl->CloseDevice = QSA_CloseDevice;
|
impl->CloseDevice = QSA_CloseDevice;
|
||||||
impl->Deinitialize = QSA_Deinitialize;
|
impl->Deinitialize = QSA_Deinitialize;
|
||||||
impl->LockDevice = NULL;
|
|
||||||
impl->UnlockDevice = NULL;
|
|
||||||
|
|
||||||
impl->ProvidesOwnCallbackThread = 0;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
impl->HasCaptureSupport = 1;
|
|
||||||
impl->OnlyHasDefaultOutputDevice = 0;
|
|
||||||
impl->OnlyHasDefaultCaptureDevice = 0;
|
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap QSAAUDIO_bootstrap = {
|
AudioBootStrap QSAAUDIO_bootstrap = {
|
||||||
"qsa", "QNX QSA Audio", QSA_Init, 0
|
"qsa", "QNX QSA Audio", QSA_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_QSA */
|
#endif /* SDL_AUDIO_DRIVER_QSA */
|
||||||
|
|
|
@ -357,11 +357,11 @@ SNDIO_DetectDevices(void)
|
||||||
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2);
|
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
SNDIO_Init(SDL_AudioDriverImpl * impl)
|
SNDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (LoadSNDIOLibrary() < 0) {
|
if (LoadSNDIOLibrary() < 0) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -375,14 +375,14 @@ SNDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->Deinitialize = SNDIO_Deinitialize;
|
impl->Deinitialize = SNDIO_Deinitialize;
|
||||||
impl->DetectDevices = SNDIO_DetectDevices;
|
impl->DetectDevices = SNDIO_DetectDevices;
|
||||||
|
|
||||||
impl->AllowsArbitraryDeviceNames = 1;
|
impl->AllowsArbitraryDeviceNames = SDL_TRUE;
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap SNDIO_bootstrap = {
|
AudioBootStrap SNDIO_bootstrap = {
|
||||||
"sndio", "OpenBSD sndio", SNDIO_Init, 0
|
"sndio", "OpenBSD sndio", SNDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_SNDIO */
|
#endif /* SDL_AUDIO_DRIVER_SNDIO */
|
||||||
|
|
|
@ -394,7 +394,7 @@ snd2au(int sample)
|
||||||
return (mask & sample);
|
return (mask & sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
SUNAUDIO_Init(SDL_AudioDriverImpl * impl)
|
SUNAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -405,13 +405,13 @@ SUNAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->GetDeviceBuf = SUNAUDIO_GetDeviceBuf;
|
impl->GetDeviceBuf = SUNAUDIO_GetDeviceBuf;
|
||||||
impl->CloseDevice = SUNAUDIO_CloseDevice;
|
impl->CloseDevice = SUNAUDIO_CloseDevice;
|
||||||
|
|
||||||
impl->AllowsArbitraryDeviceNames = 1;
|
impl->AllowsArbitraryDeviceNames = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap SUNAUDIO_bootstrap = {
|
AudioBootStrap SUNAUDIO_bootstrap = {
|
||||||
"audio", "UNIX /dev/audio interface", SUNAUDIO_Init, 0
|
"audio", "UNIX /dev/audio interface", SUNAUDIO_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_SUNAUDIO */
|
#endif /* SDL_AUDIO_DRIVER_SUNAUDIO */
|
||||||
|
|
|
@ -154,7 +154,7 @@ static void VITAAUD_ThreadInit(_THIS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
VITAAUD_Init(SDL_AudioDriverImpl * impl)
|
VITAAUD_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -166,16 +166,16 @@ VITAAUD_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->ThreadInit = VITAAUD_ThreadInit;
|
impl->ThreadInit = VITAAUD_ThreadInit;
|
||||||
|
|
||||||
/* VITA audio device */
|
/* VITA audio device */
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||||
/*
|
/*
|
||||||
impl->HasCaptureSupport = 1;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
impl->OnlyHasDefaultInputDevice = 1;
|
impl->OnlyHasDefaultInputDevice = SDL_TRUE;
|
||||||
*/
|
*/
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap VITAAUD_bootstrap = {
|
AudioBootStrap VITAAUD_bootstrap = {
|
||||||
"vita", "VITA audio driver", VITAAUD_Init, 0
|
"vita", "VITA audio driver", VITAAUD_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_VITA */
|
#endif /* SDL_AUDIO_DRIVER_VITA */
|
||||||
|
|
|
@ -713,14 +713,14 @@ WASAPI_Deinitialize(void)
|
||||||
deviceid_list = NULL;
|
deviceid_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
WASAPI_Init(SDL_AudioDriverImpl * impl)
|
WASAPI_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1);
|
SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1);
|
||||||
SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1);
|
SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1);
|
||||||
|
|
||||||
if (WASAPI_PlatformInit() == -1) {
|
if (WASAPI_PlatformInit() == -1) {
|
||||||
return 0;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -736,13 +736,13 @@ WASAPI_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->FlushCapture = WASAPI_FlushCapture;
|
impl->FlushCapture = WASAPI_FlushCapture;
|
||||||
impl->CloseDevice = WASAPI_CloseDevice;
|
impl->CloseDevice = WASAPI_CloseDevice;
|
||||||
impl->Deinitialize = WASAPI_Deinitialize;
|
impl->Deinitialize = WASAPI_Deinitialize;
|
||||||
impl->HasCaptureSupport = 1;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap WASAPI_bootstrap = {
|
AudioBootStrap WASAPI_bootstrap = {
|
||||||
"wasapi", "WASAPI", WASAPI_Init, 0
|
"wasapi", "WASAPI", WASAPI_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_WASAPI */
|
#endif /* SDL_AUDIO_DRIVER_WASAPI */
|
||||||
|
|
|
@ -434,7 +434,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
return 0; /* Ready to go! */
|
return 0; /* Ready to go! */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static SDL_bool
|
||||||
WINMM_Init(SDL_AudioDriverImpl * impl)
|
WINMM_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -449,11 +449,11 @@ WINMM_Init(SDL_AudioDriverImpl * impl)
|
||||||
|
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
|
||||||
return 1; /* this audio target is available. */
|
return SDL_TRUE; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap WINMM_bootstrap = {
|
AudioBootStrap WINMM_bootstrap = {
|
||||||
"winmm", "Windows Waveform Audio", WINMM_Init, 0
|
"winmm", "Windows Waveform Audio", WINMM_Init, SDL_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_WINMM */
|
#endif /* SDL_AUDIO_DRIVER_WINMM */
|
||||||
|
|
Loading…
Reference in New Issue