update SDL3 to latest commit

This commit is contained in:
Sasha Szpakowski
2024-10-06 20:30:44 -03:00
parent 1b0fdc338b
commit 9e5eb1b018
1426 changed files with 242456 additions and 103496 deletions
+10 -16
View File
@@ -87,12 +87,12 @@ get_channel_name(int channel_index, int channel_count)
case 7:
return "Side Right";
}
SDLTest_AssertCheck(SDL_FALSE, "Invalid channel_index for channel_count: channel_count=%d channel_index=%d", channel_count, channel_index);
SDLTest_AssertCheck(false, "Invalid channel_index for channel_count: channel_count=%d channel_index=%d", channel_count, channel_index);
SDL_assert(0);
return NULL;
}
static SDL_bool is_lfe_channel(int channel_index, int channel_count)
static bool is_lfe_channel(int channel_index, int channel_count)
{
return (channel_count == 3 && channel_index == 2) || (channel_count >= 6 && channel_index == 3);
}
@@ -146,7 +146,7 @@ static void SDLCALL fill_buffer(void *userdata, SDL_AudioStream *stream, int len
int main(int argc, char *argv[])
{
SDL_AudioDeviceID *devices = NULL;
SDL_AudioDeviceID *devices;
SDLTest_CommonState *state;
int devcount = 0;
int i;
@@ -157,15 +157,12 @@ int main(int argc, char *argv[])
return 1;
}
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
SDLTest_CommonQuit(state);
return 1;
}
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
if (!SDL_Init(SDL_INIT_AUDIO)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
return 1;
}
@@ -178,10 +175,9 @@ int main(int argc, char *argv[])
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
devices = SDL_GetAudioOutputDevices(&devcount);
devices = SDL_GetAudioPlaybackDevices(&devcount);
if (!devices) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioOutputDevices() failed: %s\n", SDL_GetError());
devcount = 0;
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioPlaybackDevices() failed: %s\n", SDL_GetError());
}
SDL_Log("Available audio devices:");
@@ -191,14 +187,13 @@ int main(int argc, char *argv[])
for (i = 0; i < devcount; i++) {
SDL_AudioStream *stream = NULL;
char *devname = SDL_GetAudioDeviceName(devices[i]);
const char *devname = SDL_GetAudioDeviceName(devices[i]);
int j;
SDL_AudioSpec spec;
SDL_Log("Testing audio device: %s\n", devname);
SDL_free(devname);
if (SDL_GetAudioDeviceFormat(devices[i], &spec, NULL) != 0) {
if (!SDL_GetAudioDeviceFormat(devices[i], &spec, NULL)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioDeviceFormat() failed: %s\n", SDL_GetError());
continue;
}
@@ -217,7 +212,7 @@ int main(int argc, char *argv[])
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_OpenAudioDeviceStream() failed: %s\n", SDL_GetError());
continue;
}
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
SDL_ResumeAudioStreamDevice(stream);
for (j = 0; j < total_channels; j++) {
const int sine_freq = is_lfe_channel(j, total_channels) ? LFE_SINE_FREQ_HZ : SINE_FREQ_HZ;
@@ -225,7 +220,7 @@ int main(int argc, char *argv[])
SDL_Log("Playing %d Hz test tone on channel: %s\n", sine_freq, get_channel_name(j, total_channels));
/* fill_buffer() will increment the active channel */
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
if (SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_TESTS_QUICK") != NULL) {
SDL_Delay(QUICK_TEST_TIME_MSEC);
} else {
SDL_Delay(CHANNEL_TEST_TIME_SEC * 1000);
@@ -234,7 +229,6 @@ int main(int argc, char *argv[])
SDL_DestroyAudioStream(stream);
}
SDL_free(devices);
SDL_Quit();