SDL: Added SDL prefix AUDIO_* constants

From 079ae065f1d6c7cc1f2e54f2e595972e7845c353 Mon Sep 17 00:00:00 2001
From: Brick <[EMAIL REDACTED]>
Date: Tue, 2 May 2023 13:00:28 +0100
Subject: [PATCH] Added SDL prefix AUDIO_* constants

---
 build-scripts/SDL_migration.cocci          | 56 ++++++++++++++++++++++
 docs/README-migration.md                   | 18 ++++++-
 include/SDL3/SDL_audio.h                   | 36 +++++++-------
 include/SDL3/SDL_oldnames.h                | 28 +++++++++++
 src/audio/SDL_audio.c                      | 24 +++++-----
 src/audio/SDL_audiocvt.c                   | 48 +++++++++----------
 src/audio/SDL_audiotypecvt.c               | 36 +++++++-------
 src/audio/SDL_mixer.c                      | 16 +++----
 src/audio/SDL_wave.c                       | 10 ++--
 src/audio/aaudio/SDL_aaudio.c              |  8 ++--
 src/audio/alsa/SDL_alsa_audio.c            | 16 +++----
 src/audio/android/SDL_androidaudio.c       |  6 +--
 src/audio/coreaudio/SDL_coreaudio.m        | 16 +++----
 src/audio/directsound/SDL_directsound.c    |  8 ++--
 src/audio/dsp/SDL_dspaudio.c               |  8 ++--
 src/audio/emscripten/SDL_emscriptenaudio.c |  2 +-
 src/audio/haiku/SDL_haikuaudio.cc          | 16 +++----
 src/audio/jack/SDL_jackaudio.c             |  2 +-
 src/audio/n3ds/SDL_n3dsaudio.c             |  4 +-
 src/audio/netbsd/SDL_netbsdaudio.c         | 12 ++---
 src/audio/openslES/SDL_openslES.c          |  6 +--
 src/audio/pipewire/SDL_pipewire.c          | 18 +++----
 src/audio/ps2/SDL_ps2audio.c               |  4 +-
 src/audio/psp/SDL_pspaudio.c               |  2 +-
 src/audio/pulseaudio/SDL_pulseaudio.c      | 28 +++++------
 src/audio/qnx/SDL_qsa_audio.c              | 16 +++----
 src/audio/sndio/SDL_sndioaudio.c           | 12 ++---
 src/audio/vita/SDL_vitaaudio.c             |  2 +-
 src/audio/wasapi/SDL_wasapi_winrt.cpp      | 12 ++---
 src/core/android/SDL_android.c             | 12 ++---
 src/core/windows/SDL_immdevice.c           | 12 ++---
 src/test/SDL_test_common.c                 | 12 ++---
 test/testaudiocapture.c                    |  2 +-
 test/testautomation_audio.c                | 44 ++++++++---------
 test/testsurround.c                        |  2 +-
 35 files changed, 327 insertions(+), 227 deletions(-)

diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index da0987b1d5eb..22d9892f7854 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -2608,3 +2608,59 @@ typedef SDL_cond, SDL_Condition;
 @@
 - SDL_cond
 + SDL_Condition
+@@
+@@
+- 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_S8
++ SDL_AUDIO_S8
+@@
+@@
+- AUDIO_U8
++ SDL_AUDIO_U8
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 3a23c37622fa..e701068c7eda 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -85,7 +85,7 @@ should be changed to:
 
 AUDIO_U16, AUDIO_U16LSB, AUDIO_U16MSB, and AUDIO_U16SYS have been removed. They were not heavily used, and one could not memset a buffer in this format to silence with a single byte value. Use a different audio format.
 
-If you need to convert U16 audio data to a still-supported format at runtime, the fastest, lossless conversion is to AUDIO_S16:
+If you need to convert U16 audio data to a still-supported format at runtime, the fastest, lossless conversion is to SDL_AUDIO_S16:
 
 ```c
     /* this converts the buffer in-place. The buffer size does not change. */
@@ -130,6 +130,22 @@ The following functions have been removed:
 
 Use the SDL_AudioDevice functions instead.
 
+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_S8 => SDL_AUDIO_S8
+* AUDIO_U8 => SDL_AUDIO_U8
+
 ## SDL_cpuinfo.h
 
 The intrinsics headers (mmintrin.h, etc.) have been moved to `<SDL3/SDL_intrin.h>` and are no longer automatically included in SDL.h.
diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h
index a8f3631deb41..36ed3556ede4 100644
--- a/include/SDL3/SDL_audio.h
+++ b/include/SDL3/SDL_audio.h
@@ -88,29 +88,29 @@ typedef Uint16 SDL_AudioFormat;
  *  Defaults to LSB byte order.
  */
 /* @{ */
-#define AUDIO_U8        0x0008  /**< Unsigned 8-bit samples */
-#define AUDIO_S8        0x8008  /**< Signed 8-bit samples */
-#define AUDIO_S16LSB    0x8010  /**< Signed 16-bit samples */
-#define AUDIO_S16MSB    0x9010  /**< As above, but big-endian byte order */
-#define AUDIO_S16       AUDIO_S16LSB
+#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
 /* @} */
 
 /**
  *  \name int32 support
  */
 /* @{ */
-#define AUDIO_S32LSB    0x8020  /**< 32-bit integer samples */
-#define AUDIO_S32MSB    0x9020  /**< As above, but big-endian byte order */
-#define AUDIO_S32       AUDIO_S32LSB
+#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
 /* @} */
 
 /**
  *  \name float32 support
  */
 /* @{ */
-#define AUDIO_F32LSB    0x8120  /**< 32-bit floating point samples */
-#define AUDIO_F32MSB    0x9120  /**< As above, but big-endian byte order */
-#define AUDIO_F32       AUDIO_F32LSB
+#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
 /* @} */
 
 /**
@@ -118,13 +118,13 @@ typedef Uint16 SDL_AudioFormat;
  */
 /* @{ */
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define AUDIO_S16SYS    AUDIO_S16LSB
-#define AUDIO_S32SYS    AUDIO_S32LSB
-#define AUDIO_F32SYS    AUDIO_F32LSB
+#define SDL_AUDIO_S16SYS    SDL_AUDIO_S16LSB
+#define SDL_AUDIO_S32SYS    SDL_AUDIO_S32LSB
+#define SDL_AUDIO_F32SYS    SDL_AUDIO_F32LSB
 #else
-#define AUDIO_S16SYS    AUDIO_S16MSB
-#define AUDIO_S32SYS    AUDIO_S32MSB
-#define AUDIO_F32SYS    AUDIO_F32MSB
+#define SDL_AUDIO_S16SYS    SDL_AUDIO_S16MSB
+#define SDL_AUDIO_S32SYS    SDL_AUDIO_S32MSB
+#define SDL_AUDIO_F32SYS    SDL_AUDIO_F32MSB
 #endif
 /* @} */
 
@@ -425,7 +425,7 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
  * When filling in the desired audio spec structure:
  *
  * - `desired->freq` should be the frequency in sample-frames-per-second (Hz).
- * - `desired->format` should be the audio format (`AUDIO_S16SYS`, etc).
+ * - `desired->format` should be the audio format (`SDL_AUDIO_S16SYS`, etc).
  * - `desired->samples` is the desired size of the audio buffer, in _sample
  *   frames_ (with stereo output, two samples--left and right--would make a
  *   single sample frame). This number should be a power of two, and may be
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index 3d2b55b3b8ed..d9487a0fb5f5 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -43,6 +43,20 @@
 #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_S8 SDL_AUDIO_S8
+#define AUDIO_U8 SDL_AUDIO_U8
 #define SDL_AudioStreamAvailable SDL_GetAudioStreamAvailable
 #define SDL_AudioStreamClear SDL_ClearAudioStream
 #define SDL_AudioStreamFlush SDL_FlushAudioStream
@@ -457,6 +471,20 @@
 #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_S8 AUDIO_S8_renamed_SDL_AUDIO_S8
+#define AUDIO_U8 AUDIO_U8_renamed_SDL_AUDIO_U8
 #define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_renamed_SDL_GetAudioStreamAvailable
 #define SDL_AudioStreamClear SDL_AudioStreamClear_renamed_SDL_ClearAudioStream
 #define SDL_AudioStreamFlush SDL_AudioStreamFlush_renamed_SDL_FlushAudioStream
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index e38c4cea8263..238ea911f497 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -770,7 +770,7 @@ static SDL_AudioFormat SDL_ParseAudioFormat(const char *string)
 {
 #define CHECK_FMT_STRING(x)          \
     if (SDL_strcmp(string, #x) == 0) \
-    return AUDIO_##x
+    return SDL_AUDIO_##x
     CHECK_FMT_STRING(U8);
     CHECK_FMT_STRING(S8);
     CHECK_FMT_STRING(S16LSB);
@@ -1113,9 +1113,9 @@ static int prepare_audiospec(const SDL_AudioSpec *orig, SDL_AudioSpec *prepared)
         const char *env = SDL_getenv("SDL_AUDIO_FORMAT");
         if (env != NULL) {
             const SDL_AudioFormat format = SDL_ParseAudioFormat(env);
-            prepared->format = format != 0 ? format : AUDIO_S16;
+            prepared->format = format != 0 ? format : SDL_AUDIO_S16;
         } else {
-            prepared->format = AUDIO_S16;
+            prepared->format = SDL_AUDIO_S16;
         }
     }
 
@@ -1523,14 +1523,14 @@ void SDL_QuitAudio(void)
 static int format_idx;  /* !!! FIXME: whoa, why are there globals in use here?! */
 static int format_idx_sub;
 static SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS] = {
-    { AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB },
-    { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB },
-    { AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_U8, AUDIO_S8 },
-    { AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_U8, AUDIO_S8 },
-    { AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U8, AUDIO_S8 },
-    { AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U8, AUDIO_S8 },
-    { AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U8, AUDIO_S8 },
-    { AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U8, AUDIO_S8 },
+    { SDL_AUDIO_U8, SDL_AUDIO_S8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB },
+    { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB },
+    { SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_U8, SDL_AUDIO_S8 },
+    { SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_U8, SDL_AUDIO_S8 },
+    { SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_U8, SDL_AUDIO_S8 },
+    { SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_U8, SDL_AUDIO_S8 },
+    { SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_U8, SDL_AUDIO_S8 },
+    { SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_U8, SDL_AUDIO_S8 },
 };
 
 SDL_AudioFormat
@@ -1556,7 +1556,7 @@ SDL_GetNextAudioFormat(void)
 
 Uint8 SDL_GetSilenceValueForFormat(const SDL_AudioFormat format)
 {
-    return (format == AUDIO_U8) ? 0x80 : 0x00;
+    return (format == SDL_AUDIO_U8) ? 0x80 : 0x00;
 }
 
 void SDL_CalculateAudioSpec(SDL_AudioSpec *spec)
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 28f3b203882e..ac77896f1721 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -261,11 +261,11 @@ static void AudioConvertToFloat(float *dst, const void *src, int num_samples, SD
     SDL_assert( (SDL_AUDIO_BITSIZE(src_fmt) <= 8) || ((SDL_AUDIO_ISBIGENDIAN(src_fmt) == 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) );  /* This only deals with native byte order. */
 
     switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
-        case AUDIO_S8: SDL_Convert_S8_to_F32(dst, (const Sint8 *) src, num_samples); break;
-        case AUDIO_U8: SDL_Convert_U8_to_F32(dst, (const Uint8 *) src, num_samples); break;
-        case AUDIO_S16: SDL_Convert_S16_to_F32(dst, (const Sint16 *) src, num_samples); break;
-        case AUDIO_S32: SDL_Convert_S32_to_F32(dst, (const Sint32 *) src, num_samples); break;
-        case AUDIO_F32: if (dst != src) { SDL_memcpy(dst, src, num_samples * sizeof (float)); } break;  /* oh well, just pass it through. */
+        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_F32: if (dst != src) { SDL_memcpy(dst, src, num_samples * sizeof (float)); } break;  /* oh well, just pass it through. */
         default: SDL_assert(!"Unexpected audio format!"); break;
     }
 }
@@ -275,11 +275,11 @@ static void AudioConvertFromFloat(void *dst, const float *src, int num_samples,
     SDL_assert( (SDL_AUDIO_BITSIZE(dst_fmt) <= 8) || ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) == 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) );  /* This only deals with native byte order. */
 
     switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
-        case AUDIO_S8: SDL_Convert_F32_to_S8((Sint8 *) dst, src, num_samples); break;
-        case AUDIO_U8: SDL_Convert_F32_to_U8((Uint8 *) dst, src, num_samples); break;
-        case AUDIO_S16: SDL_Convert_F32_to_S16((Sint16 *) dst, src, num_samples); break;
-        case AUDIO_S32: SDL_Convert_F32_to_S32((Sint32 *) dst, src, num_samples); break;
-        case AUDIO_F32: if (dst != src) { SDL_memcpy(dst, src, num_samples * sizeof (float)); } break;  /* oh well, just pass it through. */
+        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_F32: if (dst != src) { SDL_memcpy(dst, src, num_samples * sizeof (float)); } break;  /* oh well, just pass it through. */
         default: SDL_assert(!"Unexpected audio format!"); break;
     }
 }
@@ -287,14 +287,14 @@ static void AudioConvertFromFloat(void *dst, const float *src, int num_samples,
 static SDL_bool SDL_IsSupportedAudioFormat(const SDL_AudioFormat fmt)
 {
     switch (fmt) {
-    case AUDIO_U8:
-    case AUDIO_S8:
-    case AUDIO_S16LSB:
-    case AUDIO_S16MSB:
-    case AUDIO_S32LSB:
-    case AUDIO_S32MSB:
-    case AUDIO_F32LSB:
-    case AUDIO_F32MSB:
+    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:
         return SDL_TRUE; /* supported. */
 
     default:
@@ -472,7 +472,7 @@ struct SDL_AudioStream
 
 static int GetMemsetSilenceValue(const SDL_AudioFormat fmt)
 {
-    return (fmt == AUDIO_U8) ? 0x80 : 0x00;
+    return (fmt == SDL_AUDIO_U8) ? 0x80 : 0x00;
 }
 
 /* this assumes you're holding the stream's lock (or are still creating the stream). */
@@ -931,8 +931,8 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int le
         const int resampler_padding_bytes = resampler_padding_frames * src_sample_frame_size;
         SDL_assert(src_rate != dst_rate);
         SDL_assert(history_buffer_bytes >= resampler_padding_bytes);
-        ConvertAudio(resampler_padding_frames, history_buffer + (history_buffer_bytes - resampler_padding_bytes), src_format, src_channels, stream->left_padding, AUDIO_F32, pre_resample_channels);
-        ConvertAudio(resampler_padding_frames, future_buffer, src_format, src_channels, stream->right_padding, AUDIO_F32, pre_resample_channels);
+        ConvertAudio(resampler_padding_frames, history_buffer + (history_buffer_bytes - resampler_padding_bytes), src_format, src_channels, stream->left_padding, SDL_AUDIO_F32, pre_resample_channels);
+        ConvertAudio(resampler_padding_frames, future_buffer, src_format, src_channels, stream->right_padding, SDL_AUDIO_F32, pre_resample_channels);
     }
 
     /* slide in new data to the history buffer, shuffling out the oldest, for the next run, since we've already updated left_padding with current data. */
@@ -956,9 +956,9 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int le
     }
 
     /* Resampling! get the work buffer to float32 format, etc, in-place. */
-    ConvertAudio(input_frames, workbuf, src_format, src_channels, workbuf, AUDIO_F32, pre_resample_channels);
+    ConvertAudio(input_frames, workbuf, src_format, src_channels, workbuf, SDL_AUDIO_F32, pre_resample_channels);
 
-    if ((dst_format == AUDIO_F32) && (dst_channels == pre_resample_channels)) {
+    if ((dst_format == SDL_AUDIO_F32) && (dst_channels == pre_resample_channels)) {
         resample_outbuf = (float *) buf;
     } else {
         const int input_bytes = input_frames * pre_resample_channels * sizeof (float);
@@ -971,7 +971,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int le
                   resample_outbuf, output_frames);
 
     /* Get us to the final format! */
-    ConvertAudio(output_frames, resample_outbuf, AUDIO_F32, src_channels, buf, dst_format, dst_channels);
+    ConvertAudio(output_frames, resample_outbuf, SDL_AUDIO_F32, src_channels, buf, dst_format, dst_channels);
     return (int) (output_frames * dst_sample_frame_size);
 }
 
diff --git a/src/audio/SDL_audiotypecvt.c b/src/audio/SDL_audiotypecvt.c
index 6946f76db68b..aeb556cd2d0c 100644
--- a/src/audio/SDL_audiotypecvt.c
+++ b/src/audio/SDL_audiotypecvt.c
@@ -49,7 +49,7 @@
 #define AUDIOCVT_TOFLOAT_SCALAR(from, fromtype, equation) \
     static void SDL_Convert_##from##_to_F32_Scalar(float *dst, const fromtype *src, int num_samples) { \
         int i; \
-        LOG_DEBUG_AUDIO_CONVERT("AUDIO_" #from, "AUDIO_F32"); \
+        LOG_DEBUG_AUDIO_CONVERT(#from, "F32"); \
         for (i = num_samples - 1; i >= 0; --i) { \
             dst[i] = equation; \
         } \
@@ -65,7 +65,7 @@ AUDIOCVT_TOFLOAT_SCALAR(S32, Sint32, ((float)(src[i] >> 8)) * DIVBY8388607)
 #define AUDIOCVT_FROMFLOAT_SCALAR(to, totype, clampmin, clampmax, equation) \
     static void SDL_Convert_F32_to_##to##_Scalar(totype *dst, const float *src, int num_samples) { \
         int i; \
-        LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_" #to); \
+        LOG_DEBUG_AUDIO_CONVERT("F32", #to); \
         for (i = 0; i < num_samples; i++) { \
             const float sample = src[i]; \
             if (sample >= 1.0f) { \
@@ -91,7 +91,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_S8_to_F32_SSE2(float *dst, const S
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)");
+    LOG_DEBUG_AUDIO_CONVERT("S8", "F32 (using SSE2)");
 
     src += num_samples - 1;
     dst += num_samples - 1;
@@ -151,7 +151,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_U8_to_F32_SSE2(float *dst, const U
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)");
+    LOG_DEBUG_AUDIO_CONVERT("U8", "F32 (using SSE2)");
 
     src += num_samples - 1;
     dst += num_samples - 1;
@@ -213,7 +213,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_S16_to_F32_SSE2(float *dst, const
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)");
+    LOG_DEBUG_AUDIO_CONVERT("S16", "F32 (using SSE2)");
 
     src += num_samples - 1;
     dst += num_samples - 1;
@@ -262,7 +262,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_S32_to_F32_SSE2(float *dst, const
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)");
+    LOG_DEBUG_AUDIO_CONVERT("S32", "F32 (using SSE2)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -299,7 +299,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S8_SSE2(Sint8 *dst, const f
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)");
+    LOG_DEBUG_AUDIO_CONVERT("F32", "S8 (using SSE2)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -355,7 +355,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_U8_SSE2(Uint8 *dst, const f
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
+    LOG_DEBUG_AUDIO_CONVERT("F32", "U8 (using SSE2)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -411,7 +411,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S16_SSE2(Sint16 *dst, const
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)");
+    LOG_DEBUG_AUDIO_CONVERT("F32", "S16 (using SSE2)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -465,7 +465,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S32_SSE2(Sint32 *dst, const
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)");
+    LOG_DEBUG_AUDIO_CONVERT("F32", "S32 (using SSE2)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -519,7 +519,7 @@ static void SDL_Convert_S8_to_F32_NEON(float *dst, const Sint8 *src, int num_sam
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_S8", "AUDIO_F32 (using NEON)");
+    LOG_DEBUG_AUDIO_CONVERT("S8", "F32 (using NEON)");
 
     src += num_samples - 1;
     dst += num_samples - 1;
@@ -571,7 +571,7 @@ static void SDL_Convert_U8_to_F32_NEON(float *dst, const Uint8 *src, int num_sam
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_U8", "AUDIO_F32 (using NEON)");
+    LOG_DEBUG_AUDIO_CONVERT("U8", "F32 (using NEON)");
 
     src += num_samples - 1;
     dst += num_samples - 1;
@@ -624,7 +624,7 @@ static void SDL_Convert_S16_to_F32_NEON(float *dst, const Sint16 *src, int num_s
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_S16", "AUDIO_F32 (using NEON)");
+    LOG_DEBUG_AUDIO_CONVERT("S16", "F32 (using NEON)");
 
     src += num_samples - 1;
     dst += num_samples - 1;
@@ -669,7 +669,7 @@ static void SDL_Convert_S32_to_F32_NEON(float *dst, const Sint32 *src, int num_s
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_S32", "AUDIO_F32 (using NEON)");
+    LOG_DEBUG_AUDIO_CONVERT("S32", "F32 (using NEON)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -706,7 +706,7 @@ static void SDL_Convert_F32_to_S8_NEON(Sint8 *dst, const float *src, int num_sam
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S8 (using NEON)");
+    LOG_DEBUG_AUDIO_CONVERT("F32", "S8 (using NEON)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -764,7 +764,7 @@ static void SDL_Convert_F32_to_U8_NEON(Uint8 *dst, const float *src, int num_sam
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_U8 (using NEON)");
+    LOG_DEBUG_AUDIO_CONVERT("F32", "U8 (using NEON)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -823,7 +823,7 @@ static void SDL_Convert_F32_to_S16_NEON(Sint16 *dst, const float *src, int num_s
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S16 (using NEON)");
+    LOG_DEBUG_AUDIO_CONVERT("F32", "S16 (using NEON)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
@@ -877,7 +877,7 @@ static void SDL_Convert_F32_to_S32_NEON(Sint32 *dst, const float *src, int num_s
 {
     int i;
 
-    LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S32 (using NEON)");
+    LOG_DEBUG_AUDIO_CONVERT("F32", "S32 (using NEON)");
 
     /* Get dst aligned to 16 bytes */
     for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) {
diff --git a/src/audio/SDL_mixer.c b/src/audio/SDL_mixer.c
index 5cfc9b6b187d..c4630ef02be8 100644
--- a/src/audio/SDL_mixer.c
+++ b/src/audio/SDL_mixer.c
@@ -93,7 +93,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
 
     switch (format) {
 
-    case AUDIO_U8:
+    case SDL_AUDIO_U8:
     {
         Uint8 src_sample;
 
@@ -106,7 +106,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case AUDIO_S8:
+    case SDL_AUDIO_S8:
     {
         Sint8 *dst8, *src8;
         Sint8 src_sample;
@@ -131,7 +131,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case AUDIO_S16LSB:
+    case SDL_AUDIO_S16LSB:
     {
         Sint16 src1, src2;
         int dst_sample;
@@ -155,7 +155,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case AUDIO_S16MSB:
+    case SDL_AUDIO_S16MSB:
     {
         Sint16 src1, src2;
         int dst_sample;
@@ -179,7 +179,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
         }
     } break;
 
-    case AUDIO_S32LSB:
+    case SDL_AUDIO_S32LSB:
     {
         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 AUDIO_S32MSB:
+    case SDL_AUDIO_S32MSB:
     {
         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 AUDIO_F32LSB:
+    case SDL_AUDIO_F32LSB:
     {
         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 AUDIO_F32MSB:
+    case SDL_AUDIO_F32MSB:
     {
         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 9b2e8b79ef85..dc5baed40ec4 100644
--- a/src/audio/SDL_wave.c
+++ b/src/audio/SDL_wave.c
@@ -2039,22 +2039,22 @@ 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 = AUDIO_S16SYS;
+        spec->format = SDL_AUDIO_S16SYS;
         break;
     case IEEE_FLOAT_CODE:
-        spec->format = AUDIO_F32LSB;
+        spec->format = SDL_AUDIO_F32LSB;
         break;
     case PCM_CODE:
         switch (format->bitspersample) {
         case 8:
-            spec->format = AUDIO_U8;
+            spec->format = SDL_AUDIO_U8;
             break;
         case 16:
-            spec->format = AUDIO_S16LSB;
+            spec->format = SDL_AUDIO_S16LSB;
             break;
         case 24: /* Has been shifted to 32 bits. */
         case 32:
-            spec->format = AUDIO_S32LSB;
+            spec->format = SDL_AUDIO_S32LSB;
             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 ee3d8752c6ec..ed8da7d6345a 100644
--- a/src/audio/aaudio/SDL_aaudio.c
+++ b/src/audio/aaudio/SDL_aaudio.c
@@ -98,9 +98,9 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
     }
     {
         aaudio_format_t format = AAUDIO_FORMAT_PCM_FLOAT;
-        if (this->spec.format == AUDIO_S16SYS) {
+        if (this->spec.format == SDL_AUDIO_S16SYS) {
             format = AAUDIO_FORMAT_PCM_I16;
-        } else if (this->spec.format == AUDIO_S16SYS) {
+        } else if (this->spec.format == SDL_AUDIO_S16SYS) {
             format = AAUDIO_FORMAT_PCM_FLOAT;
         }
         ctx.AAudioStreamBuilder_setFormat(ctx.builder, format);
@@ -123,9 +123,9 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
     {
         aaudio_format_t fmt = ctx.AAudioStream_getFormat(private->stream);
         if (fmt == AAUDIO_FORMAT_PCM_I16) {
-            this->spec.format = AUDIO_S16SYS;
+            this->spec.format = SDL_AUDIO_S16SYS;
         } else if (fmt == AAUDIO_FORMAT_PCM_FLOAT) {
-            this->spec.format = AUDIO_F32SYS;
+            this->spec.format = SDL_AUDIO_F32SYS;
         }
     }
 
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index f958786537a8..6916a20c6109 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -571,28 +571,28 @@ static int ALSA_OpenDevice(_THIS, const char *devname)
     /* Try for a closest match on audio format */
     for (test_format = SDL_GetFirstAudioFormat(this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) {
         switch (test_format) {
-        case AUDIO_U8:
+        case SDL_AUDIO_U8:
             format = SND_PCM_FORMAT_U8;
             break;
-        case AUDIO_S8:
+        case SDL_AUDIO_S8:
             format = SND_PCM_FORMAT_S8;
             break;
-        case AUDIO_S16LSB:
+        case SDL_AUDIO_S16LSB:
             format = SND_PCM_FORMAT_S16_LE;
             break;
-        case AUDIO_S16MSB:
+     

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