Move to SDL3
Make the move from SDL2 to SDL3 along with fixes and improvements made along the way. (long-term draft PR)
All existing features should be in working order now, though only limited testing was done to confirm that. Additional tweaks are likely. The main exception is setting of gamma, which has been removed from SDL3. This will need to be handled by shaders instead.
Look for TODO: SDL3 comments in the code for any notable issue or change that may need to be addressed in the future.
This PR will also see bigger refactors to make use of SDL3's new audio and filesystem code. Proper gamepad support and working multi voice chat are also likely. Those changes should be self-contained feature commits which may eventually be split into separate PRs or just dropped entirely.
WARNING: This PR will be rebased, squashed, and reordered many times before it's done. So if you follow it locally then please plan accordingly.
Regarding audio changes, the SDL3 audio system will be used everywhere. OpenAL is still used for sound effects, but only for mixing, with the result being fed to SDL3 for actual playback. That feature requires the loopback device extension from openal-soft and will fall back to regular physical device access if it's not available. Aside from the init changes there is no real change necessary to normal OpenAL code. That allows further work to the OpenAL code to be done without having to really know about the SDL3 stuff. And since sound effects are the only bit of code using OpenAL, it's now possible to use all of MAX_CHANNELS for sound effects instead of having to reserve channels for other sections of code.
Note that flags and config info are unchanged to preserve max compatibility with older builds. Choosing a specific playback/recording device in settings or via the launcher will work like it always has, yet will have no effect with this new code.
The physical device fallback code could be removed if we start requiring openal-soft as opposed to it being optional. openal-soft is distributed with all official builds and our prebuilt version is already required for Windows and Mac builds. It's only optional for Linux builds, however nearly all distros distribute openal-soft as their only openal version.
There are two main benefits to this new setup: 1) the SDL3 audio code is much simpler, and 2) when the default audio device changes it will switch automatically.
The first allows for much cleaner and easier to understand code if no special mixing is required. Movies, audio streaming, and audio capture do not require 2D/3D positioning effects, so using OpenAL for them is overkill.
The second means that if you are playing FSO and audio is coming out of your computer speakers, but then you turn on/plug in some headphones, the audio will switch to the new device automatically. This also means that selecting a specific device to use generally isn't required as SDL3 will automatically switch to whatever device is considered default at the OS level. It should all just work in other words, without any special configuration or interaction by the user.
At the moment EFX/EAX effects via the play-sound-from-file sexp do not work. That sexp uses audiostr, which no longer uses OpenAL, so the effects don't work (though the sound will still play without EFX). An easy workaround for that is not available, but a refactoring of the code is possible should the desire from modders for that capability warrant it.
Voice capture is also not complete. The code has been rewritten to use SDL3 instead of OpenAL, however it remains unusable as there is no compression codec in place to allow it to work with multi. Once that issue has been sorted out the changes will be submitted.
The commit got squashed down at some point, but this does partially address #4748. Specifically, it only enables textinput when a retail ui inputbox has focus, and disables textinput when it loses focus, which is proper usage. ImGui also uses it appropriately.
We still need to verify that rocketui enables it only while an input field has focus, and that the input fields lose focus when the debug console becomes active. Confirming that, or making changes to that affect, should fully resolve the issue.