SDL: Audio types have the same naming convention as other SDL endian types, e.g. [S|U][BITS][LE|BE]

From 233789b0d1789adef4f9bd2d9fff72c11f710a28 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 4 Sep 2023 09:17:29 -0700
Subject: [PATCH] Audio types have the same naming convention as other SDL
 endian types, e.g. [S|U][BITS][LE|BE]

Native endian types have no LE/BE suffix
---
 build-scripts/SDL_migration.cocci     | 24 +++++------
 docs/README-migration.md              | 24 +++++------
 include/SDL3/SDL_audio.h              | 43 +++++++++----------
 include/SDL3/SDL_oldnames.h           | 48 ++++++++++-----------
 src/audio/SDL_audio.c                 | 46 ++++++++++----------
 src/audio/SDL_audiocvt.c              | 26 +++++------
 src/audio/SDL_mixer.c                 | 12 +++---
 src/audio/SDL_wave.c                  |  8 ++--
 src/audio/aaudio/SDL_aaudio.c         | 10 ++---
 src/audio/alsa/SDL_alsa_audio.c       | 12 +++---
 src/audio/coreaudio/SDL_coreaudio.m   | 12 +++---
 src/audio/dsp/SDL_dspaudio.c          |  4 +-
 src/audio/haiku/SDL_haikuaudio.cc     | 12 +++---
 src/audio/jack/SDL_jackaudio.c        |  2 +-
 src/audio/netbsd/SDL_netbsdaudio.c    |  8 ++--
 src/audio/openslES/SDL_openslES.c     |  6 +--
 src/audio/pipewire/SDL_pipewire.c     | 12 +++---
 src/audio/psp/SDL_pspaudio.c          |  2 +-
 src/audio/pulseaudio/SDL_pulseaudio.c | 24 +++++------
 src/audio/qnx/SDL_qsa_audio.c         |  2 +-
 src/audio/sndio/SDL_sndioaudio.c      |  8 ++--
 src/audio/vita/SDL_vitaaudio.c        |  2 +-
 src/core/windows/SDL_windows.c        | 12 +++---
 src/test/SDL_test_common.c            | 33 +++++++++++---
 test/testaudio.c                      | 14 +++---
 test/testaudiostreamdynamicresample.c | 12 +++---
 test/testautomation_audio.c           | 62 +++++++++++++++++----------
 test/testsurround.c                   |  2 +-
 28 files changed, 258 insertions(+), 224 deletions(-)

diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index a2243cff3bb9..1ade7e891f8f 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -2591,51 +2591,51 @@ typedef SDL_cond, SDL_Condition;
 @@
 @@
 - AUDIO_F32
-+ SDL_AUDIO_F32
++ SDL_AUDIO_F32LE
 @@
 @@
 - AUDIO_F32LSB
-+ SDL_AUDIO_F32LSB
++ SDL_AUDIO_F32LE
 @@
 @@
 - AUDIO_F32MSB
-+ SDL_AUDIO_F32MSB
++ SDL_AUDIO_F32BE
 @@
 @@
 - AUDIO_F32SYS
-+ SDL_AUDIO_F32SYS
++ SDL_AUDIO_F32
 @@
 @@
 - AUDIO_S16
-+ SDL_AUDIO_S16
++ SDL_AUDIO_S16LE
 @@
 @@
 - AUDIO_S16LSB
-+ SDL_AUDIO_S16LSB
++ SDL_AUDIO_S16LE
 @@
 @@
 - AUDIO_S16MSB
-+ SDL_AUDIO_S16MSB
++ SDL_AUDIO_S16BE
 @@
 @@
 - AUDIO_S16SYS
-+ SDL_AUDIO_S16SYS
++ SDL_AUDIO_S16
 @@
 @@
 - AUDIO_S32
-+ SDL_AUDIO_S32
++ SDL_AUDIO_S32LE
 @@
 @@
 - AUDIO_S32LSB
-+ SDL_AUDIO_S32LSB
++ SDL_AUDIO_S32LE
 @@
 @@
 - AUDIO_S32MSB
-+ SDL_AUDIO_S32MSB
++ SDL_AUDIO_S32BE
 @@
 @@
 - AUDIO_S32SYS
-+ SDL_AUDIO_S32SYS
++ SDL_AUDIO_S32
 @@
 @@
 - AUDIO_S8
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 2f00a5d704a0..5347eca8e35b 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -255,18 +255,18 @@ The following functions have been removed:
 * SDL_GetQueuedAudioSize()
 
 The following symbols have been renamed:
-* AUDIO_F32 => SDL_AUDIO_F32
-* AUDIO_F32LSB => SDL_AUDIO_F32LSB
-* AUDIO_F32MSB => SDL_AUDIO_F32MSB
-* AUDIO_F32SYS => SDL_AUDIO_F32SYS
-* AUDIO_S16 => SDL_AUDIO_S16
-* AUDIO_S16LSB => SDL_AUDIO_S16LSB
-* AUDIO_S16MSB => SDL_AUDIO_S16MSB
-* AUDIO_S16SYS => SDL_AUDIO_S16SYS
-* AUDIO_S32 => SDL_AUDIO_S32
-* AUDIO_S32LSB => SDL_AUDIO_S32LSB
-* AUDIO_S32MSB => SDL_AUDIO_S32MSB
-* AUDIO_S32SYS => SDL_AUDIO_S32SYS
+* AUDIO_F32 => SDL_AUDIO_F32LE
+* AUDIO_F32LSB => SDL_AUDIO_F32LE
+* AUDIO_F32MSB => SDL_AUDIO_F32BE
+* AUDIO_F32SYS => SDL_AUDIO_F32
+* AUDIO_S16 => SDL_AUDIO_S16LE
+* AUDIO_S16LSB => SDL_AUDIO_S16LE
+* AUDIO_S16MSB => SDL_AUDIO_S16BE
+* AUDIO_S16SYS => SDL_AUDIO_S16
+* AUDIO_S32 => SDL_AUDIO_S32LE
+* AUDIO_S32LSB => SDL_AUDIO_S32LE
+* AUDIO_S32MSB => SDL_AUDIO_S32BE
+* AUDIO_S32SYS => SDL_AUDIO_S32
 * AUDIO_S8 => SDL_AUDIO_S8
 * AUDIO_U8 => SDL_AUDIO_U8
 
diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h
index a8270a0aff48..e88934f0b371 100644
--- a/include/SDL3/SDL_audio.h
+++ b/include/SDL3/SDL_audio.h
@@ -80,15 +80,17 @@ typedef Uint16 SDL_AudioFormat;
 /* @{ */
 
 #define SDL_AUDIO_MASK_BITSIZE       (0xFF)
-#define SDL_AUDIO_MASK_DATATYPE      (1<<8)
-#define SDL_AUDIO_MASK_ENDIAN        (1<<12)
+#define SDL_AUDIO_MASK_FLOAT         (1<<8)
+#define SDL_AUDIO_MASK_LIL_ENDIAN    (1<<12)
+#define SDL_AUDIO_MASK_BIG_ENDIAN    (1<<13)
+#define SDL_AUDIO_MASK_ENDIAN        (SDL_AUDIO_MASK_BIG_ENDIAN|SDL_AUDIO_MASK_LIL_ENDIAN)
 #define SDL_AUDIO_MASK_SIGNED        (1<<15)
-#define SDL_AUDIO_BITSIZE(x)         (x & SDL_AUDIO_MASK_BITSIZE)
-#define SDL_AUDIO_ISFLOAT(x)         (x & SDL_AUDIO_MASK_DATATYPE)
-#define SDL_AUDIO_ISBIGENDIAN(x)     (x & SDL_AUDIO_MASK_ENDIAN)
-#define SDL_AUDIO_ISSIGNED(x)        (x & SDL_AUDIO_MASK_SIGNED)
+#define SDL_AUDIO_BITSIZE(x)         ((x) & SDL_AUDIO_MASK_BITSIZE)
+#define SDL_AUDIO_ISFLOAT(x)         ((x) & SDL_AUDIO_MASK_FLOAT)
+#define SDL_AUDIO_ISBIGENDIAN(x)     (((x) & SDL_AUDIO_MASK_ENDIAN) == SDL_AUDIO_MASK_BIG_ENDIAN)
+#define SDL_AUDIO_ISLITTLEENDIAN(x)  (((x) & SDL_AUDIO_MASK_ENDIAN) == SDL_AUDIO_MASK_LIL_ENDIAN)
+#define SDL_AUDIO_ISSIGNED(x)        ((x) & SDL_AUDIO_MASK_SIGNED)
 #define SDL_AUDIO_ISINT(x)           (!SDL_AUDIO_ISFLOAT(x))
-#define SDL_AUDIO_ISLITTLEENDIAN(x)  (!SDL_AUDIO_ISBIGENDIAN(x))
 #define SDL_AUDIO_ISUNSIGNED(x)      (!SDL_AUDIO_ISSIGNED(x))
 
 /**
@@ -99,27 +101,24 @@ typedef Uint16 SDL_AudioFormat;
 /* @{ */
 #define SDL_AUDIO_U8        0x0008  /**< Unsigned 8-bit samples */
 #define SDL_AUDIO_S8        0x8008  /**< Signed 8-bit samples */
-#define SDL_AUDIO_S16LSB    0x8010  /**< Signed 16-bit samples */
-#define SDL_AUDIO_S16MSB    0x9010  /**< As above, but big-endian byte order */
-#define SDL_AUDIO_S16       SDL_AUDIO_S16LSB
+#define SDL_AUDIO_S16LE     0x9010  /**< Signed 16-bit samples */
+#define SDL_AUDIO_S16BE     0xA010  /**< As above, but big-endian byte order */
 /* @} */
 
 /**
  *  \name int32 support
  */
 /* @{ */
-#define SDL_AUDIO_S32LSB    0x8020  /**< 32-bit integer samples */
-#define SDL_AUDIO_S32MSB    0x9020  /**< As above, but big-endian byte order */
-#define SDL_AUDIO_S32       SDL_AUDIO_S32LSB
+#define SDL_AUDIO_S32LE     0x9020  /**< 32-bit integer samples */
+#define SDL_AUDIO_S32BE     0xA020  /**< As above, but big-endian byte order */
 /* @} */
 
 /**
  *  \name float32 support
  */
 /* @{ */
-#define SDL_AUDIO_F32LSB    0x8120  /**< 32-bit floating point samples */
-#define SDL_AUDIO_F32MSB    0x9120  /**< As above, but big-endian byte order */
-#define SDL_AUDIO_F32       SDL_AUDIO_F32LSB
+#define SDL_AUDIO_F32LE     0x9120  /**< 32-bit floating point samples */
+#define SDL_AUDIO_F32BE     0xA120  /**< As above, but big-endian byte order */
 /* @} */
 
 /**
@@ -127,13 +126,13 @@ typedef Uint16 SDL_AudioFormat;
  */
 /* @{ */
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define SDL_AUDIO_S16SYS    SDL_AUDIO_S16LSB
-#define SDL_AUDIO_S32SYS    SDL_AUDIO_S32LSB
-#define SDL_AUDIO_F32SYS    SDL_AUDIO_F32LSB
+#define SDL_AUDIO_S16    SDL_AUDIO_S16LE
+#define SDL_AUDIO_S32    SDL_AUDIO_S32LE
+#define SDL_AUDIO_F32    SDL_AUDIO_F32LE
 #else
-#define SDL_AUDIO_S16SYS    SDL_AUDIO_S16MSB
-#define SDL_AUDIO_S32SYS    SDL_AUDIO_S32MSB
-#define SDL_AUDIO_F32SYS    SDL_AUDIO_F32MSB
+#define SDL_AUDIO_S16    SDL_AUDIO_S16BE
+#define SDL_AUDIO_S32    SDL_AUDIO_S32BE
+#define SDL_AUDIO_F32    SDL_AUDIO_F32BE
 #endif
 /* @} */
 
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index e58ec3a444f4..0ecea4073e6b 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -43,18 +43,18 @@
 #define SDL_atomic_t SDL_AtomicInt
 
 /* ##SDL_audio.h */
-#define AUDIO_F32 SDL_AUDIO_F32
-#define AUDIO_F32LSB SDL_AUDIO_F32LSB
-#define AUDIO_F32MSB SDL_AUDIO_F32MSB
-#define AUDIO_F32SYS SDL_AUDIO_F32SYS
-#define AUDIO_S16 SDL_AUDIO_S16
-#define AUDIO_S16LSB SDL_AUDIO_S16LSB
-#define AUDIO_S16MSB SDL_AUDIO_S16MSB
-#define AUDIO_S16SYS SDL_AUDIO_S16SYS
-#define AUDIO_S32 SDL_AUDIO_S32
-#define AUDIO_S32LSB SDL_AUDIO_S32LSB
-#define AUDIO_S32MSB SDL_AUDIO_S32MSB
-#define AUDIO_S32SYS SDL_AUDIO_S32SYS
+#define AUDIO_F32 SDL_AUDIO_F32LE
+#define AUDIO_F32LSB SDL_AUDIO_F32LE
+#define AUDIO_F32MSB SDL_AUDIO_F32BE
+#define AUDIO_F32SYS SDL_AUDIO_F32
+#define AUDIO_S16 SDL_AUDIO_S16LE
+#define AUDIO_S16LSB SDL_AUDIO_S16LE
+#define AUDIO_S16MSB SDL_AUDIO_S16BE
+#define AUDIO_S16SYS SDL_AUDIO_S16
+#define AUDIO_S32 SDL_AUDIO_S32LE
+#define AUDIO_S32LSB SDL_AUDIO_S32LE
+#define AUDIO_S32MSB SDL_AUDIO_S32BE
+#define AUDIO_S32SYS SDL_AUDIO_S32
 #define AUDIO_S8 SDL_AUDIO_S8
 #define AUDIO_U8 SDL_AUDIO_U8
 #define SDL_AudioStreamAvailable SDL_GetAudioStreamAvailable
@@ -494,18 +494,18 @@
 #elif !defined(SDL_DISABLE_OLD_NAMES)
 
 /* ##SDL_audio.h */
-#define AUDIO_F32 AUDIO_F32_renamed_SDL_AUDIO_F32
-#define AUDIO_F32LSB AUDIO_F32LSB_renamed_SDL_AUDIO_F32LSB
-#define AUDIO_F32MSB AUDIO_F32MSB_renamed_SDL_AUDIO_F32MSB
-#define AUDIO_F32SYS AUDIO_F32SYS_renamed_SDL_AUDIO_F32SYS
-#define AUDIO_S16 AUDIO_S16_renamed_SDL_AUDIO_S16
-#define AUDIO_S16LSB AUDIO_S16LSB_renamed_SDL_AUDIO_S16LSB
-#define AUDIO_S16MSB AUDIO_S16MSB_renamed_SDL_AUDIO_S16MSB
-#define AUDIO_S16SYS AUDIO_S16SYS_renamed_SDL_AUDIO_S16SYS
-#define AUDIO_S32 AUDIO_S32_renamed_SDL_AUDIO_S32
-#define AUDIO_S32LSB AUDIO_S32LSB_renamed_SDL_AUDIO_S32LSB
-#define AUDIO_S32MSB AUDIO_S32MSB_renamed_SDL_AUDIO_S32MSB
-#define AUDIO_S32SYS AUDIO_S32SYS_renamed_SDL_AUDIO_S32SYS
+#define AUDIO_F32 AUDIO_F32_renamed_SDL_AUDIO_F32LE
+#define AUDIO_F32LSB AUDIO_F32LSB_renamed_SDL_AUDIO_F32LE
+#define AUDIO_F32MSB AUDIO_F32MSB_renamed_SDL_AUDIO_F32BE
+#define AUDIO_F32SYS AUDIO_F32SYS_renamed_SDL_AUDIO_F32
+#define AUDIO_S16 AUDIO_S16_renamed_SDL_AUDIO_S16LE
+#define AUDIO_S16LSB AUDIO_S16LSB_renamed_SDL_AUDIO_S16LE
+#define AUDIO_S16MSB AUDIO_S16MSB_renamed_SDL_AUDIO_S16BE
+#define AUDIO_S16SYS AUDIO_S16SYS_renamed_SDL_AUDIO_S16
+#define AUDIO_S32 AUDIO_S32_renamed_SDL_AUDIO_S32LE
+#define AUDIO_S32LSB AUDIO_S32LSB_renamed_SDL_AUDIO_S32LE
+#define AUDIO_S32MSB AUDIO_S32MSB_renamed_SDL_AUDIO_S32BE
+#define AUDIO_S32SYS AUDIO_S32SYS_renamed_SDL_AUDIO_S32
 #define AUDIO_S8 AUDIO_S8_renamed_SDL_AUDIO_S8
 #define AUDIO_U8 AUDIO_U8_renamed_SDL_AUDIO_U8
 #define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_renamed_SDL_GetAudioStreamAvailable
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index de2e3a4f9ce6..5171d326d37d 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -765,17 +765,17 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
 
             case MIXSTRATEGY_MIX: {
                 //SDL_Log("MIX STRATEGY: MIX");
-                float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32SYS) ? device_buffer : device->mix_buffer);
+                float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32) ? device_buffer : device->mix_buffer);
                 const int needed_samples = buffer_size / (SDL_AUDIO_BITSIZE(device->spec.format) / 8);
                 const int work_buffer_size = needed_samples * sizeof (float);
                 SDL_AudioSpec outspec;
 
                 SDL_assert(work_buffer_size <= device->work_buffer_size);
 
-                outspec.format = SDL_AUDIO_F32SYS;
+                outspec.format = SDL_AUDIO_F32;
                 outspec.channels = device->spec.channels;
                 outspec.freq = device->spec.freq;
-                outspec.format = SDL_AUDIO_F32SYS;
+                outspec.format = SDL_AUDIO_F32;
 
                 SDL_memset(mix_buffer, '\0', buffer_size);  // start with silence.
 
@@ -795,7 +795,7 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
                             retval = SDL_FALSE;
                             break;
                         } else if (br > 0) {  // it's okay if we get less than requested, we mix what we have.
-                            if (SDL_MixAudioFormat((Uint8 *) mix_buffer, device->work_buffer, SDL_AUDIO_F32SYS, br, SDL_MIX_MAXVOLUME) < 0) {  // !!! FIXME: allow streams to specify gain?
+                            if (SDL_MixAudioFormat((Uint8 *) mix_buffer, device->work_buffer, SDL_AUDIO_F32, br, SDL_MIX_MAXVOLUME) < 0) {  // !!! FIXME: allow streams to specify gain?
                                 SDL_assert(!"This shouldn't happen.");
                                 retval = SDL_FALSE;  // uh...?
                                 break;
@@ -806,8 +806,8 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
 
                 if (((Uint8 *) mix_buffer) != device_buffer) {
                     // !!! FIXME: we can't promise the device buf is aligned/padded for SIMD.
-                    //ConvertAudio(needed_samples * device->spec.channels, mix_buffer, SDL_AUDIO_F32SYS, device->spec.channels, device_buffer, device->spec.format, device->spec.channels, device->work_buffer);
-                    ConvertAudio(needed_samples / device->spec.channels, mix_buffer, SDL_AUDIO_F32SYS, device->spec.channels, device->work_buffer, device->spec.format, device->spec.channels, NULL);
+                    //ConvertAudio(needed_samples * device->spec.channels, mix_buffer, SDL_AUDIO_F32, device->spec.channels, device_buffer, device->spec.format, device->spec.channels, device->work_buffer);
+                    ConvertAudio(needed_samples / device->spec.channels, mix_buffer, SDL_AUDIO_F32, device->spec.channels, device->work_buffer, device->spec.format, device->spec.channels, NULL);
                     SDL_memcpy(device_buffer, device->work_buffer, buffer_size);
                 }
                 break;
@@ -1208,16 +1208,14 @@ static SDL_AudioFormat ParseAudioFormatString(const char *string)
         #define CHECK_FMT_STRING(x) if (SDL_strcmp(string, #x) == 0) { return SDL_AUDIO_##x; }
         CHECK_FMT_STRING(U8);
         CHECK_FMT_STRING(S8);
-        CHECK_FMT_STRING(S16LSB);
-        CHECK_FMT_STRING(S16MSB);
+        CHECK_FMT_STRING(S16LE);
+        CHECK_FMT_STRING(S16BE);
         CHECK_FMT_STRING(S16);
-        CHECK_FMT_STRING(S32LSB);
-        CHECK_FMT_STRING(S32MSB);
-        CHECK_FMT_STRING(S32SYS);
+        CHECK_FMT_STRING(S32LE);
+        CHECK_FMT_STRING(S32BE);
         CHECK_FMT_STRING(S32);
-        CHECK_FMT_STRING(F32LSB);
-        CHECK_FMT_STRING(F32MSB);
-        CHECK_FMT_STRING(F32SYS);
+        CHECK_FMT_STRING(F32LE);
+        CHECK_FMT_STRING(F32BE);
         CHECK_FMT_STRING(F32);
         #undef CHECK_FMT_STRING
     }
@@ -1315,7 +1313,7 @@ static int OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
         return SDL_OutOfMemory();
     }
 
-    if (device->spec.format != SDL_AUDIO_F32SYS) {
+    if (device->spec.format != SDL_AUDIO_F32) {
         device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
         if (device->mix_buffer == NULL) {
             ClosePhysicalAudioDevice(device);
@@ -1660,14 +1658,14 @@ SDL_AudioStream *SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const SDL_Au
 
 #define NUM_FORMATS 8
 static const SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS + 1] = {
-    { SDL_AUDIO_U8, SDL_AUDIO_S8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, 0 },
-    { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, 0 },
-    { SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
-    { SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
-    { SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
-    { SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
-    { SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
-    { SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
+    { SDL_AUDIO_U8, SDL_AUDIO_S8, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, 0 },
+    { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, 0 },
+    { SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
+    { SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
+    { SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
+    { SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
+    { SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
+    { SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
 };
 
 const SDL_AudioFormat *SDL_ClosestAudioFormats(SDL_AudioFormat format)
@@ -1826,7 +1824,7 @@ int SDL_AudioDeviceFormatChangedAlreadyLocked(SDL_AudioDevice *device, const SDL
 
             SDL_aligned_free(device->mix_buffer);
             device->mix_buffer = NULL;
-            if (device->spec.format != SDL_AUDIO_F32SYS) {
+            if (device->spec.format != SDL_AUDIO_F32) {
                 device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
                 if (!device->mix_buffer) {
                     kill_device = SDL_TRUE;
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 7d9120e94167..5f9be7da8760 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -860,8 +860,8 @@ static void AudioConvertToFloat(float *dst, const void *src, int num_samples, SD
     switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
         case SDL_AUDIO_S8: SDL_Convert_S8_to_F32(dst, (const Sint8 *) src, num_samples); break;
         case SDL_AUDIO_U8: SDL_Convert_U8_to_F32(dst, (const Uint8 *) src, num_samples); break;
-        case SDL_AUDIO_S16: SDL_Convert_S16_to_F32(dst, (const Sint16 *) src, num_samples); break;
-        case SDL_AUDIO_S32: SDL_Convert_S32_to_F32(dst, (const Sint32 *) src, num_samples); break;
+        case (SDL_AUDIO_S16 & ~SDL_AUDIO_MASK_ENDIAN): SDL_Convert_S16_to_F32(dst, (const Sint16 *) src, num_samples); break;
+        case (SDL_AUDIO_S32 & ~SDL_AUDIO_MASK_ENDIAN): SDL_Convert_S32_to_F32(dst, (const Sint32 *) src, num_samples); break;
         default: SDL_assert(!"Unexpected audio format!"); break;
     }
 }
@@ -872,8 +872,8 @@ static void AudioConvertFromFloat(void *dst, const float *src, int num_samples,
     switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
         case SDL_AUDIO_S8: SDL_Convert_F32_to_S8((Sint8 *) dst, src, num_samples); break;
         case SDL_AUDIO_U8: SDL_Convert_F32_to_U8((Uint8 *) dst, src, num_samples); break;
-        case SDL_AUDIO_S16: SDL_Convert_F32_to_S16((Sint16 *) dst, src, num_samples); break;
-        case SDL_AUDIO_S32: SDL_Convert_F32_to_S32((Sint32 *) dst, src, num_samples); break;
+        case (SDL_AUDIO_S16 & ~SDL_AUDIO_MASK_ENDIAN): SDL_Convert_F32_to_S16((Sint16 *) dst, src, num_samples); break;
+        case (SDL_AUDIO_S32 & ~SDL_AUDIO_MASK_ENDIAN): SDL_Convert_F32_to_S32((Sint32 *) dst, src, num_samples); break;
         default: SDL_assert(!"Unexpected audio format!"); break;
     }
 }
@@ -883,12 +883,12 @@ static SDL_bool SDL_IsSupportedAudioFormat(const SDL_AudioFormat fmt)
     switch (fmt) {
     case SDL_AUDIO_U8:
     case SDL_AUDIO_S8:
-    case SDL_AUDIO_S16LSB:
-    case SDL_AUDIO_S16MSB:
-    case SDL_AUDIO_S32LSB:
-    case SDL_AUDIO_S32MSB:
-    case SDL_AUDIO_F32LSB:
-    case SDL_AUDIO_F32MSB:
+    case SDL_AUDIO_S16LE:
+    case SDL_AUDIO_S16BE:
+    case SDL_AUDIO_S32LE:
+    case SDL_AUDIO_S32BE:
+    case SDL_AUDIO_F32LE:
+    case SDL_AUDIO_F32BE:
         return SDL_TRUE;  // supported.
 
     default:
@@ -1540,7 +1540,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int ou
     // Check if we can resample directly into the output buffer.
     // Note, this is just to avoid extra copies.
     // Some other formats may fit directly into the output buffer, but i'd rather process data in a SIMD-aligned buffer.
-    if ((dst_format != SDL_AUDIO_F32SYS) || (dst_channels != resample_channels)) {
+    if ((dst_format != SDL_AUDIO_F32) || (dst_channels != resample_channels)) {
         // Allocate space for converting the resampled output to the destination format
         int resample_convert_bytes = output_frames * max_frame_size;
         work_buffer_capacity = SDL_max(work_buffer_capacity, resample_convert_bytes);
@@ -1597,7 +1597,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int ou
     SDL_assert(work_buffer_frames == input_frames + (resampler_padding_frames * 2));
 
     // Resampling! get the work buffer to float32 format, etc, in-place.
-    ConvertAudio(work_buffer_frames, work_buffer, src_format, src_channels, work_buffer, SDL_AUDIO_F32SYS, resample_channels, NULL);
+    ConvertAudio(work_buffer_frames, work_buffer, src_format, src_channels, work_buffer, SDL_AUDIO_F32, resample_channels, NULL);
 
     // Update the work_buffer pointers based on the new frame size
     input_buffer = work_buffer + ((input_buffer - work_buffer) / src_frame_size * resample_frame_size);
@@ -1614,7 +1614,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int ou
 
     // Convert to the final format, if necessary
     if (buf != resample_buffer) {
-        ConvertAudio(output_frames, resample_buffer, SDL_AUDIO_F32SYS, resample_channels, buf, dst_format, dst_channels, work_buffer);
+        ConvertAudio(output_frames, resample_buffer, SDL_AUDIO_F32, resample_channels, buf, dst_format, dst_channels, work_buffer);
     }
 
     return 0;
diff --git a/src/audio/SDL_mixer.c b/src/audio/SDL_mixer.c
index c4630ef02be8..0a4992d8295b 100644
--- a/src/audio/SDL_mixer.c
+++ b/src/audio/SDL_mixer.c
@@ -131,7 +131,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case SDL_AUDIO_S16LSB:
+    case SDL_AUDIO_S16LE:
     {
         Sint16 src1, src2;
         int dst_sample;
@@ -155,7 +155,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case SDL_AUDIO_S16MSB:
+    case SDL_AUDIO_S16BE:
     {
         Sint16 src1, src2;
         int dst_sample;
@@ -179,7 +179,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case SDL_AUDIO_S32LSB:
+    case SDL_AUDIO_S32LE:
     {
         const Uint32 *src32 = (Uint32 *)src;
         Uint32 *dst32 = (Uint32 *)dst;
@@ -204,7 +204,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case SDL_AUDIO_S32MSB:
+    case SDL_AUDIO_S32BE:
     {
         const Uint32 *src32 = (Uint32 *)src;
         Uint32 *dst32 = (Uint32 *)dst;
@@ -229,7 +229,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case SDL_AUDIO_F32LSB:
+    case SDL_AUDIO_F32LE:
     {
         const float fmaxvolume = 1.0f / ((float)SDL_MIX_MAXVOLUME);
         const float fvolume = (float)volume;
@@ -257,7 +257,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case SDL_AUDIO_F32MSB:
+    case SDL_AUDIO_F32BE:
     {
         const float fmaxvolume = 1.0f / ((float)SDL_MIX_MAXVOLUME);
         const float fvolume = (float)volume;
diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
index 27d540c46761..2afb70bd2cd9 100644
--- a/src/audio/SDL_wave.c
+++ b/src/audio/SDL_wave.c
@@ -2039,10 +2039,10 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
     case ALAW_CODE:
     case MULAW_CODE:
         /* These can be easily stored in the byte order of the system. */
-        spec->format = SDL_AUDIO_S16SYS;
+        spec->format = SDL_AUDIO_S16;
         break;
     case IEEE_FLOAT_CODE:
-        spec->format = SDL_AUDIO_F32LSB;
+        spec->format = SDL_AUDIO_F32LE;
         break;
     case PCM_CODE:
         switch (format->bitspersample) {
@@ -2050,11 +2050,11 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
             spec->format = SDL_AUDIO_U8;
             break;
         case 16:
-            spec->format = SDL_AUDIO_S16LSB;
+            spec->format = SDL_AUDIO_S16LE;
             break;
         case 24: /* Has been shifted to 32 bits. */
         case 32:
-            spec->format = SDL_AUDIO_S32LSB;
+            spec->format = SDL_AUDIO_S32LE;
             break;
         default:
             /* Just in case something unexpected happened in the checks. */
diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c
index 5b12d6f522cc..7692f4e2e24d 100644
--- a/src/audio/aaudio/SDL_aaudio.c
+++ b/src/audio/aaudio/SDL_aaudio.c
@@ -198,9 +198,9 @@ static int AAUDIO_OpenDevice(SDL_AudioDevice *device)
     const aaudio_direction_t direction = (iscapture ? AAUDIO_DIRECTION_INPUT : AAUDIO_DIRECTION_OUTPUT);
     ctx.AAudioStreamBuilder_setDirection(builder, direction);
     aaudio_format_t format;
-    if ((device->spec.format == SDL_AUDIO_S32SYS) && (SDL_GetAndroidSDKVersion() >= 31)) {
+    if ((device->spec.format == SDL_AUDIO_S32) && (SDL_GetAndroidSDKVersion() >= 31)) {
         format = AAUDIO_FORMAT_PCM_I32;
-    } else if (device->spec.format == SDL_AUDIO_F32SYS) {
+    } else if (device->spec.format == SDL_AUDIO_F32) {
         format = AAUDIO_FORMAT_PCM_FLOAT;
     } else {
         format = AAUDIO_FORMAT_PCM_I16;  // sint16 is a safe bet for everything else.
@@ -245,11 +245,11 @@ static int AAUDIO_OpenDevice(SDL_AudioDevice *device)
 
     format = ctx.AAudioStream_getFormat(hidden->stream);
     if (format == AAUDIO_FORMAT_PCM_I16) {
-        device->spec.format = SDL_AUDIO_S16SYS;
+        device->spec.format = SDL_AUDIO_S16;
     } else if (format == AAUDIO_FORMAT_PCM_I32) {
-        device->spec.format = SDL_AUDIO_S32SYS;
+        device->spec.format = SDL_AUDIO_S32;
     } else if (format == AAUDIO_FORMAT_PCM_FLOAT) {
-        device->spec.format = SDL_AUDIO_F32SYS;
+        device->spec.format = SDL_AUDIO_F32;
     } else {
         return SDL_SetError("Got unexpected audio format %d from AAudioStream_getFormat", (int) format);
     }
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index 816a0c21749c..73181761c6e2 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -565,22 +565,22 @@ static int ALSA_OpenDevice(SDL_AudioDevice *device)
         case SDL_AUDIO_S8:
             format = SND_PCM_FORMAT_S8;
             break;
-        case SDL_AUDIO_S16LSB:
+        case SDL_AUDIO_S16LE:
             format = SND_PCM_FORMAT_S16_LE;
             break;
-        case SDL_AUDIO_S16MSB:
+        case SDL_AUDIO_S16BE:
             format = SND_PCM_FORMAT_S16_BE;
             break;
-        case SDL_AUDIO_S32LSB:
+        case SDL_AUDIO_S32LE:
             format = SND_PCM_FORMAT_S32_LE;
             break;
-        case SDL_AUDIO_S32MSB:
+        case SDL_AUDIO_S32BE:
             format = SND_PCM_FORMAT_S32_BE;
             break;
-        case SDL_AUDIO_F32LSB:
+        case SDL_AUDIO_F32LE:
             format = SND_PCM_FORMAT_FLOAT_LE;
             break;
-        case SDL_AUDIO_F32MSB:
+        case SDL_AUDIO_F32BE:
             format = SND_PCM_FORMAT_FLOAT_BE;
             break;
         default:
diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m
index 31be6db0832f..61e5d9ce91c6 100644
--- a/src/audio/coreaudio/SDL_coreaudio.m
+++ b/src/audio/coreaudio/SDL_coreaudio.m
@@ -876,12 +876,12 @@ static int COREAUDIO_OpenDevice(SDL_AudioDevice *device)
         switch (test_format) {
         case SDL_AUDIO_U8:
         case SDL_AUDIO_S8:
-        case SDL_AUDIO_S16LSB:
-        case SDL_AUDIO_S16MSB:
-        case SDL_AUDIO_S32LSB:
-        case SDL_AUDIO_S32MSB:
-        case SDL_AUDIO_F32LSB:
-        case SDL_AUDIO_F32MSB:
+        case SDL_AUDIO_S16LE:
+        case SDL_AUDIO_S16BE:
+        case SDL_AUDIO_S32LE:
+        case SDL_AUDIO_S32BE:
+        case SDL_AUDIO_F32LE:
+        case SDL_AUDIO_F32BE:
             break;
 
         default:
diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c
index a6550bf3b715..05572d22fa02 100644
--- a/src/audio/dsp/SDL_dspaudio.c
+++ b/src/audio/dsp/SDL_dspaudio.c
@@ -111,12 +111,12 @@ static int DSP_OpenDevice(SDL_AudioDevice *device)
                 format = AFMT_U8;
             }
             break;
-        case SDL_AUDIO_S16LSB:
+        case SDL_AUDIO_S16LE:
             if (value & AFMT_S16_LE) {
                 format = AFMT_S16_LE;
             }
             break;
-        case SDL_AUDIO_S16MSB:
+        case SDL_AUDIO_S16BE:
             if (value & AFMT_S16_BE) {
                 format = AFMT_S16_BE;
             }
diff --git a/src/audio/haiku/SDL_haikuaudio.cc b/src/audio/haiku/SDL_haikuaudio.cc
index 9ccaf3c43f9a..15204362d6be 100644
--- a/src/audio/haiku/SDL_haikuaudio.cc
+++ b/src/audio/haiku/SDL_haikuaudio.cc
@@ -131,29 +131,29 @@ static int HAIKUAUDIO_OpenDevice(SDL_AudioDevice *device)
             format.format = media_raw_audio_format::B_AUDIO_UCHAR;
             break;
 
-        case SDL_AUDIO_S16LSB:
+        case SDL_AUDIO_S16LE:
             format.format = media_raw_audio_format::B_AUDIO_SHORT;
             break;
 
-        case SDL_AUDIO_S16MSB:
+        case SDL_AUDIO_S16BE:
             format.format = media_raw_audio_format::B_AUDIO_SHORT;
             format.byte_order = B_MEDIA_BIG_ENDIAN;
             break;
 
-        case SDL_AUDIO_S32LSB:
+        case SDL_AUDIO_S32LE:
             format.format = media_raw_audio_format::B_AUDIO_INT;
             break;
 
-        case SDL_AUDIO_S32MSB:
+        case SDL_AUDIO_S32BE:
             format.format = media_raw_audio_format::B_AUDIO_INT;
             format.byte_order = B_MEDIA_BIG_ENDIAN;
             break;
 
-        case SDL_AUDIO_F32LSB:
+        case SDL_AUDIO_F32LE:
             format.format = media_raw_audio_format::B_AUDIO_FLOAT;
             break;
 
-        case SDL_AUDIO_F32MSB:
+        case SDL_AUDIO_F32BE:
             format.format = media_raw_audio_format::B_AUDIO_FLOAT;
             format.byte_order = B_MEDIA_BIG_ENDIAN;
             break;
diff --git a/src/audio/jack/SDL_jackaudio.c b/src/audio/jack/SDL_jackaudio.c
index e6567d4c705f..ce2fde14c7f9 100644
--- a/src/audio/jack/SDL_jackaudio.c
+++ b/src/audio/jack/SDL_jackaudio.c
@@ -309,7 +309,7 @@ static int JACK_OpenDevice(SDL_AudioDevice *device)
     /* !!! FIXME: docs say about buffer size: "This size may change, clients that depend on it must register a bufsize_callback so they will be noti

(Patch may be truncated, please check the link at the top of this post.)