From 0dda8a7f4cdbcdccc78979ec808777b027645ac6 Mon Sep 17 00:00:00 2001
From: pionere <[EMAIL REDACTED]>
Date: Mon, 17 Jan 2022 11:21:01 +0100
Subject: [PATCH] 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)
---
src/audio/SDL_audio.c | 11 +++++------
src/audio/SDL_sysaudio.h | 15 +++++++-------
src/audio/aaudio/SDL_aaudio.c | 14 ++++++-------
src/audio/alsa/SDL_alsa_audio.c | 8 ++++----
src/audio/android/SDL_androidaudio.c | 10 +++++-----
src/audio/arts/SDL_artsaudio.c | 12 +++++------
src/audio/coreaudio/SDL_coreaudio.m | 14 ++++++-------
src/audio/directsound/SDL_directsound.c | 8 ++++----
src/audio/disk/SDL_diskaudio.c | 8 ++++----
src/audio/dsp/SDL_dspaudio.c | 10 +++++-----
src/audio/dummy/SDL_dummyaudio.c | 10 +++++-----
src/audio/emscripten/SDL_emscriptenaudio.c | 23 +++++++++++-----------
src/audio/esd/SDL_esdaudio.c | 12 +++++------
src/audio/fusionsound/SDL_fsaudio.c | 12 +++++------
src/audio/haiku/SDL_haikuaudio.cc | 12 +++++------
src/audio/jack/SDL_jackaudio.c | 10 +++++-----
src/audio/nacl/SDL_naclaudio.c | 12 +++++------
src/audio/nas/SDL_nasaudio.c | 14 ++++++-------
src/audio/netbsd/SDL_netbsdaudio.c | 8 ++++----
src/audio/openslES/SDL_openslES.c | 14 ++++++-------
src/audio/os2/SDL_os2audio.c | 6 +++---
src/audio/paudio/SDL_paudio.c | 10 +++++-----
src/audio/pipewire/SDL_pipewire.c | 14 ++++++-------
src/audio/psp/SDL_pspaudio.c | 12 +++++------
src/audio/pulseaudio/SDL_pulseaudio.c | 10 +++++-----
src/audio/qsa/SDL_qsa_audio.c | 13 ++++--------
src/audio/sndio/SDL_sndioaudio.c | 10 +++++-----
src/audio/sun/SDL_sunaudio.c | 8 ++++----
src/audio/vita/SDL_vitaaudio.c | 12 +++++------
src/audio/wasapi/SDL_wasapi.c | 10 +++++-----
src/audio/winmm/SDL_winmm.c | 6 +++---
31 files changed, 170 insertions(+), 178 deletions(-)
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 3514ca3b741..38e1f25f4a4 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -943,15 +943,14 @@ SDL_GetAudioDriver(int index)
int
SDL_AudioInit(const char *driver_name)
{
- int i = 0;
- int initialized = 0;
- int tried_to_init = 0;
+ int i;
+ SDL_bool initialized = SDL_FALSE, tried_to_init = SDL_FALSE;
if (SDL_GetCurrentAudioDriver()) {
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);
/* Select the proper audio driver */
@@ -977,7 +976,7 @@ SDL_AudioInit(const char *driver_name)
for (i = 0; bootstrap[i]; ++i) {
if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
(SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
- tried_to_init = 1;
+ tried_to_init = SDL_TRUE;
SDL_zero(current_audio);
current_audio.name = bootstrap[i]->name;
current_audio.desc = bootstrap[i]->desc;
@@ -994,7 +993,7 @@ SDL_AudioInit(const char *driver_name)
continue;
}
- tried_to_init = 1;
+ tried_to_init = SDL_TRUE;
SDL_zero(current_audio);
current_audio.name = bootstrap[i]->name;
current_audio.desc = bootstrap[i]->desc;
diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h
index 7d90a87ef04..7c9be10ab0a 100644
--- a/src/audio/SDL_sysaudio.h
+++ b/src/audio/SDL_sysaudio.h
@@ -84,12 +84,11 @@ typedef struct SDL_AudioDriverImpl
/* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */
/* Some flags to push duplicate code into the core and reduce #ifdefs. */
- /* !!! FIXME: these should be SDL_bool */
- int ProvidesOwnCallbackThread;
- int HasCaptureSupport;
- int OnlyHasDefaultOutputDevice;
- int OnlyHasDefaultCaptureDevice;
- int AllowsArbitraryDeviceNames;
+ SDL_bool ProvidesOwnCallbackThread;
+ SDL_bool HasCaptureSupport;
+ SDL_bool OnlyHasDefaultOutputDevice;
+ SDL_bool OnlyHasDefaultCaptureDevice;
+ SDL_bool AllowsArbitraryDeviceNames;
} SDL_AudioDriverImpl;
@@ -177,8 +176,8 @@ typedef struct AudioBootStrap
{
const char *name;
const char *desc;
- int (*init) (SDL_AudioDriverImpl * impl);
- int demand_only; /* 1==request explicitly, or it won't be available. */
+ SDL_bool (*init) (SDL_AudioDriverImpl * impl);
+ SDL_bool demand_only; /* 1==request explicitly, or it won't be available. */
} AudioBootStrap;
/* Not all of these are available in a given build. Use #ifdefs, etc. */
diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c
index 4e728b5c171..0412e0d5581 100644
--- a/src/audio/aaudio/SDL_aaudio.c
+++ b/src/audio/aaudio/SDL_aaudio.c
@@ -268,7 +268,7 @@ aaudio_Deinitialize(void)
LOGI("End AAUDIO %s", SDL_GetError());
}
-static int
+static SDL_bool
aaudio_Init(SDL_AudioDriverImpl *impl)
{
aaudio_result_t res;
@@ -280,7 +280,7 @@ aaudio_Init(SDL_AudioDriverImpl *impl)
* See https://github.com/google/oboe/issues/40 for more information.
*/
if (SDL_GetAndroidSDKVersion() < 27) {
- return 0;
+ return SDL_FALSE;
}
SDL_zero(ctx);
@@ -315,12 +315,12 @@ aaudio_Init(SDL_AudioDriverImpl *impl)
/* and the capabilities */
impl->HasCaptureSupport = SDL_TRUE;
- impl->OnlyHasDefaultOutputDevice = 1;
- impl->OnlyHasDefaultCaptureDevice = 1;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
+ impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
/* this audio target is available. */
LOGI("SDL aaudio_Init OK");
- return 1;
+ return SDL_TRUE;
failure:
if (ctx.handle) {
@@ -331,11 +331,11 @@ aaudio_Init(SDL_AudioDriverImpl *impl)
}
ctx.handle = NULL;
ctx.builder = NULL;
- return 0;
+ return SDL_FALSE;
}
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 */
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index 78a491eda06..83649c24b73 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -997,11 +997,11 @@ ALSA_Deinitialize(void)
UnloadALSALibrary();
}
-static int
+static SDL_bool
ALSA_Init(SDL_AudioDriverImpl * impl)
{
if (LoadALSALibrary() < 0) {
- return 0;
+ return SDL_FALSE;
}
/* Set the function pointers */
@@ -1017,12 +1017,12 @@ ALSA_Init(SDL_AudioDriverImpl * impl)
impl->HasCaptureSupport = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap ALSA_bootstrap = {
- "alsa", "ALSA PCM audio", ALSA_Init, 0
+ "alsa", "ALSA PCM audio", ALSA_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_ALSA */
diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c
index 3efa2d63089..31f256a60de 100644
--- a/src/audio/android/SDL_androidaudio.c
+++ b/src/audio/android/SDL_androidaudio.c
@@ -120,7 +120,7 @@ ANDROIDAUDIO_CloseDevice(_THIS)
SDL_free(this->hidden);
}
-static int
+static SDL_bool
ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
@@ -133,14 +133,14 @@ ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
/* and the capabilities */
impl->HasCaptureSupport = SDL_TRUE;
- impl->OnlyHasDefaultOutputDevice = 1;
- impl->OnlyHasDefaultCaptureDevice = 1;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
+ impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
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 */
diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c
index 040d9366922..c85cc0b6533 100644
--- a/src/audio/arts/SDL_artsaudio.c
+++ b/src/audio/arts/SDL_artsaudio.c
@@ -320,16 +320,16 @@ ARTS_Deinitialize(void)
}
-static int
+static SDL_bool
ARTS_Init(SDL_AudioDriverImpl * impl)
{
if (LoadARTSLibrary() < 0) {
- return 0;
+ return SDL_FALSE;
} else {
if (SDL_NAME(arts_init) () != 0) {
UnloadARTSLibrary();
SDL_SetError("ARTS: arts_init failed (no audio server?)");
- return 0;
+ return SDL_FALSE;
}
/* Play a stream so aRts doesn't crash */
@@ -350,14 +350,14 @@ ARTS_Init(SDL_AudioDriverImpl * impl)
impl->GetDeviceBuf = ARTS_GetDeviceBuf;
impl->CloseDevice = ARTS_CloseDevice;
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 = {
- "arts", "Analog RealTime Synthesizer", ARTS_Init, 0
+ "arts", "Analog RealTime Synthesizer", ARTS_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_ARTS */
diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m
index 67d838fdd19..cd886615c19 100644
--- a/src/audio/coreaudio/SDL_coreaudio.m
+++ b/src/audio/coreaudio/SDL_coreaudio.m
@@ -1152,7 +1152,7 @@ output device (in which case we'll try again). */
#endif
}
-static int
+static SDL_bool
COREAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
@@ -1164,18 +1164,18 @@ output device (in which case we'll try again). */
impl->DetectDevices = COREAUDIO_DetectDevices;
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
#else
- impl->OnlyHasDefaultOutputDevice = 1;
- impl->OnlyHasDefaultCaptureDevice = 1;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
+ impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
#endif
- impl->ProvidesOwnCallbackThread = 1;
- impl->HasCaptureSupport = 1;
+ impl->ProvidesOwnCallbackThread = SDL_TRUE;
+ impl->HasCaptureSupport = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap COREAUDIO_bootstrap = {
- "coreaudio", "CoreAudio", COREAUDIO_Init, 0
+ "coreaudio", "CoreAudio", COREAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_COREAUDIO */
diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c
index b4e8ce252db..65b33a2b9f9 100644
--- a/src/audio/directsound/SDL_directsound.c
+++ b/src/audio/directsound/SDL_directsound.c
@@ -575,11 +575,11 @@ DSOUND_Deinitialize(void)
}
-static int
+static SDL_bool
DSOUND_Init(SDL_AudioDriverImpl * impl)
{
if (!DSOUND_Load()) {
- return 0;
+ return SDL_FALSE;
}
/* Set the function pointers */
@@ -596,11 +596,11 @@ DSOUND_Init(SDL_AudioDriverImpl * impl)
impl->HasCaptureSupport = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap DSOUND_bootstrap = {
- "directsound", "DirectSound", DSOUND_Init, 0
+ "directsound", "DirectSound", DSOUND_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_DSOUND */
diff --git a/src/audio/disk/SDL_diskaudio.c b/src/audio/disk/SDL_diskaudio.c
index 56dfca5036c..5368df1e40b 100644
--- a/src/audio/disk/SDL_diskaudio.c
+++ b/src/audio/disk/SDL_diskaudio.c
@@ -177,7 +177,7 @@ DISKAUDIO_DetectDevices(void)
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2);
}
-static int
+static SDL_bool
DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
@@ -191,14 +191,14 @@ DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->CloseDevice = DISKAUDIO_CloseDevice;
impl->DetectDevices = DISKAUDIO_DetectDevices;
- impl->AllowsArbitraryDeviceNames = 1;
+ impl->AllowsArbitraryDeviceNames = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
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 */
diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c
index 3c4b6aaf22f..b0ca0f6594c 100644
--- a/src/audio/dsp/SDL_dspaudio.c
+++ b/src/audio/dsp/SDL_dspaudio.c
@@ -301,13 +301,13 @@ look_for_devices_test(int fd)
return 0;
}
-static int
+static SDL_bool
DSP_Init(SDL_AudioDriverImpl * impl)
{
InitTimeDevicesExist = SDL_FALSE;
SDL_EnumUnixAudioDevices(0, look_for_devices_test);
if (!InitTimeDevicesExist) {
- return 0; /* maybe try a different backend. */
+ return SDL_FALSE; /* maybe try a different backend. */
}
/* Set the function pointers */
@@ -319,15 +319,15 @@ DSP_Init(SDL_AudioDriverImpl * impl)
impl->CaptureFromDevice = DSP_CaptureFromDevice;
impl->FlushCapture = DSP_FlushCapture;
- impl->AllowsArbitraryDeviceNames = 1;
+ impl->AllowsArbitraryDeviceNames = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
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 */
diff --git a/src/audio/dummy/SDL_dummyaudio.c b/src/audio/dummy/SDL_dummyaudio.c
index e8b557a255b..4383243e897 100644
--- a/src/audio/dummy/SDL_dummyaudio.c
+++ b/src/audio/dummy/SDL_dummyaudio.c
@@ -45,22 +45,22 @@ DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
return buflen;
}
-static int
+static SDL_bool
DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
impl->OpenDevice = DUMMYAUDIO_OpenDevice;
impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice;
- impl->OnlyHasDefaultOutputDevice = 1;
- impl->OnlyHasDefaultCaptureDevice = 1;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
+ impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
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: */
diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c
index 0849ff86a56..0652c414272 100644
--- a/src/audio/emscripten/SDL_emscriptenaudio.c
+++ b/src/audio/emscripten/SDL_emscriptenaudio.c
@@ -344,30 +344,29 @@ EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device)
{
}
-static int
+static SDL_bool
EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
{
- int available;
- int capture_available;
+ SDL_bool available, capture_available;
/* Set the function pointers */
impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice;
impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice;
- impl->OnlyHasDefaultOutputDevice = 1;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
/* no threads here */
impl->LockDevice = impl->UnlockDevice = EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock;
- impl->ProvidesOwnCallbackThread = 1;
+ impl->ProvidesOwnCallbackThread = SDL_TRUE;
/* check availability */
available = EM_ASM_INT_V({
if (typeof(AudioContext) !== 'undefined') {
- return 1;
+ return SDL_TRUE;
} else if (typeof(webkitAudioContext) !== 'undefined') {
- return 1;
+ return SDL_TRUE;
}
- return 0;
+ return SDL_FALSE;
});
if (!available) {
@@ -376,11 +375,11 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
capture_available = available && EM_ASM_INT_V({
if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) {
- return 1;
+ return SDL_TRUE;
} else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') {
- return 1;
+ return SDL_TRUE;
}
- return 0;
+ return SDL_FALSE;
});
impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE;
@@ -390,7 +389,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
}
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 */
diff --git a/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c
index b0b794d7b30..14035bdc3ce 100644
--- a/src/audio/esd/SDL_esdaudio.c
+++ b/src/audio/esd/SDL_esdaudio.c
@@ -293,11 +293,11 @@ ESD_Deinitialize(void)
UnloadESDLibrary();
}
-static int
+static SDL_bool
ESD_Init(SDL_AudioDriverImpl * impl)
{
if (LoadESDLibrary() < 0) {
- return 0;
+ return SDL_FALSE;
} else {
int connection = 0;
@@ -308,7 +308,7 @@ ESD_Init(SDL_AudioDriverImpl * impl)
if (connection < 0) {
UnloadESDLibrary();
SDL_SetError("ESD: esd_open_sound failed (no audio server?)");
- return 0;
+ return SDL_FALSE;
}
SDL_NAME(esd_close) (connection);
}
@@ -320,14 +320,14 @@ ESD_Init(SDL_AudioDriverImpl * impl)
impl->GetDeviceBuf = ESD_GetDeviceBuf;
impl->CloseDevice = ESD_CloseDevice;
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 = {
- "esd", "Enlightened Sound Daemon", ESD_Init, 0
+ "esd", "Enlightened Sound Daemon", ESD_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_ESD */
diff --git a/src/audio/fusionsound/SDL_fsaudio.c b/src/audio/fusionsound/SDL_fsaudio.c
index 5f24cf440b8..af376a92a3b 100644
--- a/src/audio/fusionsound/SDL_fsaudio.c
+++ b/src/audio/fusionsound/SDL_fsaudio.c
@@ -288,11 +288,11 @@ SDL_FS_Deinitialize(void)
}
-static int
+static SDL_bool
SDL_FS_Init(SDL_AudioDriverImpl * impl)
{
if (LoadFusionSoundLibrary() < 0) {
- return 0;
+ return SDL_FALSE;
} else {
DirectResult ret;
@@ -302,7 +302,7 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl)
SDL_SetError
("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)",
ret);
- return 0;
+ return SDL_FALSE;
}
}
@@ -313,14 +313,14 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl)
impl->GetDeviceBuf = SDL_FS_GetDeviceBuf;
impl->CloseDevice = SDL_FS_CloseDevice;
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 = {
- "fusionsound", "FusionSound", SDL_FS_Init, 0
+ "fusionsound", "FusionSound", SDL_FS_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */
diff --git a/src/audio/haiku/SDL_haikuaudio.cc b/src/audio/haiku/SDL_haikuaudio.cc
index 82da47827a3..fe07b6994ec 100644
--- a/src/audio/haiku/SDL_haikuaudio.cc
+++ b/src/audio/haiku/SDL_haikuaudio.cc
@@ -216,22 +216,22 @@ HAIKUAUDIO_Deinitialize(void)
SDL_QuitBeApp();
}
-static int
+static SDL_bool
HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Initialize the Be Application, if it's not already started */
if (SDL_InitBeApp() < 0) {
- return 0;
+ return SDL_FALSE;
}
/* Set the function pointers */
impl->OpenDevice = HAIKUAUDIO_OpenDevice;
impl->CloseDevice = HAIKUAUDIO_CloseDevice;
impl->Deinitialize = HAIKUAUDIO_Deinitialize;
- impl->ProvidesOwnCallbackThread = 1;
- impl->OnlyHasDefaultOutputDevice = 1;
+ impl->ProvidesOwnCallbackThread = SDL_TRUE;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
extern "C"
@@ -239,7 +239,7 @@ extern "C"
extern AudioBootStrap HAIKUAUDIO_bootstrap;
}
AudioBootStrap HAIKUAUDIO_bootstrap = {
- "haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, 0
+ "haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_HAIKU */
diff --git a/src/audio/jack/SDL_jackaudio.c b/src/audio/jack/SDL_jackaudio.c
index 1c8aa0ba70f..9f68a31dff1 100644
--- a/src/audio/jack/SDL_jackaudio.c
+++ b/src/audio/jack/SDL_jackaudio.c
@@ -405,18 +405,18 @@ JACK_Deinitialize(void)
UnloadJackLibrary();
}
-static int
+static SDL_bool
JACK_Init(SDL_AudioDriverImpl * impl)
{
if (LoadJackLibrary() < 0) {
- return 0;
+ return SDL_FALSE;
} else {
/* Make sure a JACK server is running and available. */
jack_status_t status;
jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL);
if (client == NULL) {
UnloadJackLibrary();
- return 0;
+ return SDL_FALSE;
}
JACK_jack_client_close(client);
}
@@ -433,11 +433,11 @@ JACK_Init(SDL_AudioDriverImpl * impl)
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
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 */
diff --git a/src/audio/nacl/SDL_naclaudio.c b/src/audio/nacl/SDL_naclaudio.c
index c651cfc6c62..9d698adc694 100644
--- a/src/audio/nacl/SDL_naclaudio.c
+++ b/src/audio/nacl/SDL_naclaudio.c
@@ -133,18 +133,18 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) {
return 0;
}
-static int
+static SDL_bool
NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
{
if (PSGetInstanceId() == 0) {
- return 0;
+ return SDL_FALSE;
}
/* Set the function pointers */
impl->OpenDevice = NACLAUDIO_OpenDevice;
impl->CloseDevice = NACLAUDIO_CloseDevice;
- impl->OnlyHasDefaultOutputDevice = 1;
- impl->ProvidesOwnCallbackThread = 1;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
+ impl->ProvidesOwnCallbackThread = SDL_TRUE;
/*
* impl->WaitDevice = NACLAUDIO_WaitDevice;
* impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf;
@@ -152,12 +152,12 @@ NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
* impl->Deinitialize = NACLAUDIO_Deinitialize;
*/
- return 1;
+ return SDL_TRUE;
}
AudioBootStrap NACLAUDIO_bootstrap = {
NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver",
- NACLAUDIO_Init, 0
+ NACLAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_NACL */
diff --git a/src/audio/nas/SDL_nasaudio.c b/src/audio/nas/SDL_nasaudio.c
index 87cda5e8804..d19c150e6ee 100644
--- a/src/audio/nas/SDL_nasaudio.c
+++ b/src/audio/nas/SDL_nasaudio.c
@@ -423,16 +423,16 @@ NAS_Deinitialize(void)
UnloadNASLibrary();
}
-static int
+static SDL_bool
NAS_Init(SDL_AudioDriverImpl * impl)
{
if (LoadNASLibrary() < 0) {
- return 0;
+ return SDL_FALSE;
} else {
AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
if (aud == NULL) {
SDL_SetError("NAS: AuOpenServer() failed (no audio server?)");
- return 0;
+ return SDL_FALSE;
}
NAS_AuCloseServer(aud);
}
@@ -447,15 +447,15 @@ NAS_Init(SDL_AudioDriverImpl * impl)
impl->CloseDevice = NAS_CloseDevice;
impl->Deinitialize = NAS_Deinitialize;
- impl->OnlyHasDefaultOutputDevice = 1;
- impl->OnlyHasDefaultCaptureDevice = 1;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
+ impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap NAS_bootstrap = {
- "nas", "Network Audio System", NAS_Init, 0
+ "nas", "Network Audio System", NAS_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_NAS */
diff --git a/src/audio/netbsd/SDL_netbsdaudio.c b/src/audio/netbsd/SDL_netbsdaudio.c
index b061ce7f102..2a62f943d82 100644
--- a/src/audio/netbsd/SDL_netbsdaudio.c
+++ b/src/audio/netbsd/SDL_netbsdaudio.c
@@ -326,7 +326,7 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
return 0;
}
-static int
+static SDL_bool
NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
@@ -339,14 +339,14 @@ NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->FlushCapture = NETBSDAUDIO_FlushCapture;
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 = {
- "netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0
+ "netbsd", "NetBSD audio", NETBSDAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_NETBSD */
diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c
index ad0209037d1..e7743a5f7a4 100644
--- a/src/audio/openslES/SDL_openslES.c
+++ b/src/audio/openslES/SDL_openslES.c
@@ -714,13 +714,13 @@ openslES_CloseDevice(_THIS)
SDL_free(this->hidden);
}
-static int
+static SDL_bool
openslES_Init(SDL_AudioDriverImpl * impl)
{
LOGI("openslES_Init() called");
if (!openslES_CreateEngine()) {
- return 0;
+ return SDL_FALSE;
}
LOGI("openslES_Init() - set pointers");
@@ -736,18 +736,18 @@ openslES_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = openslES_DestroyEngine;
/* and the capabilities */
- impl->HasCaptureSupport = 1;
- impl->OnlyHasDefaultOutputDevice = 1;
- impl->OnlyHasDefaultCaptureDevice = 1;
+ impl->HasCaptureSupport = SDL_TRUE;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
+ impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
LOGI("openslES_Init() - success");
/* this audio target is available. */
- return 1;
+ return SDL_TRUE;
}
AudioBootStrap openslES_bootstrap = {
- "openslES", "opensl ES audio driver", openslES_Init, 0
+ "openslES", "opensl ES audio driver", openslES_Init, SDL_FALSE
};
void openslES_ResumeDevices(void)
diff --git a/src/audio/os2/SDL_os2audio.c b/src/audio/os2/SDL_os2audio.c
index 5fa1ad4ede5..e8f431e33f8 100644
--- a/src/audio/os2/SDL_os2audio.c
+++ b/src/audio/os2/SDL_os2audio.c
@@ -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 */
impl->DetectDevices = OS2_DetectDevices;
@@ -438,12 +438,12 @@ static int OS2_Init(SDL_AudioDriverImpl * impl)
impl->FlushCapture = ;
impl->HasCaptureSupport = SDL_TRUE;
*/
- return 1; /* this audio target is available. */
+ return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap OS2AUDIO_bootstrap = {
- "DART", "OS/2 DART", OS2_Init, 0
+ "DART", "OS/2 DART", OS2_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_OS2 */
diff --git a/src/audio/paudio/SDL_paudio.c b/src/audio/paudio/SDL_paudio.c
index c4f40b35d75..b630ae9704b 100644
--- a/src/audio/paudio/SDL_paudio.c
+++ b/src/audio/paudio/SDL_paudio.c
@@ -485,14 +485,14 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
return 0;
}
-static int
+static SDL_bool
PAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* !!! FIXME: not right for device enum? */
int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
if (fd < 0) {
SDL_SetError("PAUDIO: Couldn't open audio device");
- return 0;
+ return SDL_FALSE;
}
close(fd);
@@ -502,13 +502,13 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->PlayDevice = PAUDIO_WaitDevice;
impl->GetDeviceBuf = PAUDIO_GetDeviceBuf;
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 = {
- "paud", "AIX Paudio", PAUDIO_Init, 0
+ "paud", "AIX Paudio", PAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_PAUDIO */
diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c
index 6d436f9925c..893d0c4ee02 100644
--- a/src/audio/pipewire/SDL_pipewire.c
+++ b/src/audio/pipewire/SDL_pipewire.c
@@ -1223,19 +1223,19 @@ PIPEWIRE_Deinitialize()
}
}
-static int
+static SDL_bool
PIPEWIRE_Init(SDL_AudioDriverImpl *impl)
{
if (!pipewire_initialized) {
if (init_pipewire_library() < 0) {
- return 0;
+ return SDL_FALSE;
}
pipewire_initialized = SDL_TRUE;
if (hotplug_loop_init() < 0) {
PIPEWIRE_Deinitialize();
- return 0;
+ return SDL_FALSE;
}
}
@@ -1245,13 +1245,13 @@ PIPEWIRE_Init(SDL_AudioDriverImpl *impl)
impl->CloseDevice = PIPEWIRE_CloseDevice;
impl->Deinitialize = PIPEWIRE_Deinitialize;
- impl->HasCaptureSupport = 1;
- impl->ProvidesOwnCallbackThread = 1;
+ impl->HasCaptureSupport = SDL_TRUE;
+ 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 */
diff --git a/src/audio/psp/SDL_pspaudio.c b/src/audio/psp/SDL_pspaudio.c
index 1966cafdf87..cbceaf40ca4 100644
--- a/src/audio/psp/SDL_pspaudio.c
+++ b/src/audio/psp/SDL_pspaudio.c
@@ -158,7 +158,7 @@
(Patch may be truncated, please check the link at the top of this post.)