If a specific audio driver was requested for testing, don't loop over all drivers in the init, open/close, and pause/unpause tests.
Additionally, drivers can fail if attempting to open an audio device when no underlying output is present, which is a valid case if the system has no audio hardware available. Check for the presence of audio output devices before attempting to open them.
Fixes automated tests with various drivers on Windows and Linux.
AUDIO_F32 is an alias for AUDIO_F32LSB, 32-bit floating point with least
significant byte first, resulting in audio_resampleLoss() failing on
big-endian machines. This particular test generates a buffer with
native-endianness float values, so it ought to be using AUDIO_F32SYS,
which is 32-bit floating point in the native endianness.
Already fixed by commit 47bcb078 "Fixed some incorrect SDL_AUDIO_F32 uses"
on the SDL 3 branch.
Resolves: https://github.com/libsdl-org/SDL/issues/8818
Signed-off-by: Simon McVittie <smcv@collabora.com>
If testautomation is running with only a specific audio driver enabled, we shouldn't try to open other ones, as they might fail.
Fixes https://github.com/libsdl-org/SDL/issues/8797
- Avoids precision loss caused by large floating point numbers.
- Adds unit test to test the signal-to-noise ratio and maximum error of resampler.
- Code cleanup
(cherry-picked from commit 20e17559e545c5d3cfe86c1c4772365e70090779)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.
In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.
The script I ran for the src directory is added as build-scripts/clang-format-src.sh
This fixes:
#6592#6593#6594
(cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
* Add braces after if conditions
* More add braces after if conditions
* Add braces after while() conditions
* Fix compilation because of macro being modified
* Add braces to for loop
* Add braces after if/goto
* Move comments up
* Remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements after merge
* Fix inconsistent patterns are xxx == NULL vs !xxx
* More "{}" for "if() break;" and "if() continue;"
* More "{}" after if() short statement
* More "{}" after "if () return;" statement
* More fix inconsistent patterns are xxx == NULL vs !xxx
* Revert some modificaion on SDL_RLEaccel.c
* SDL_RLEaccel: no short statement
* Cleanup 'if' where the bracket is in a new line
* Cleanup 'while' where the bracket is in a new line
* Cleanup 'for' where the bracket is in a new line
* Cleanup 'else' where the bracket is in a new line
(cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().