Commits to SDL revision control. Unmonitored, automated account; try @icculus
or https://github.com/libsdl-org/SDL !


The patch
From 9625fb28326655fe2d18fe583b835779c2492d95 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 27 Dec 2022 05:28:18 -0800
Subject: [PATCH] Documentation cleanup

---
 WhatsNew.txt             | 6 +++---
 docs/README-migration.md | 8 +++-----
 include/SDL3/SDL_audio.h | 2 --
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/WhatsNew.txt b/WhatsNew.txt
index 2fce93b9c290..81e5ab30bf9f 100644
--- a/WhatsNew.txt
+++ b/WhatsNew.txt
@@ -15,11 +15,11 @@ General:
     * RW_SEEK_CUR -> SDL_RW_SEEK_CUR
     * RW_SEEK_END -> SDL_RW_SEEK_END
     * RW_SEEK_SET -> SDL_RW_SEEK_SET
+* SDL_FreeWAV has been removed and calls can be replaced with SDL_free
 * The following functions have been renamed:
-    * SDL_FreeWAV => SDL_free
 * Removed the following functions from the API, see docs/README-migration.md for details:
-    * SDL_AudioInit
-    * SDL_AudioQuit
+    * SDL_AudioInit()
+    * SDL_AudioQuit()
     * SDL_CalculateGammaRamp()
     * SDL_CreateRGBSurface()
     * SDL_CreateRGBSurfaceFrom()
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 7d5cde19000e..4399ef67d6c7 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -42,15 +42,13 @@ The vi format comments have been removed from source code. Vim users can use the
 
 ## SDL_audio.h
 
-- SDL_AudioInit() and SDL_AudioQuit() have been removed. Instead you can call SDL_InitSubSytem() and SDL_QuitSubSytem() with SDL_INIT_AUDIO, which will properly refcount the subsystems.
-  Also the hint SDL_AUDIO_DRIVER can help to choose a specific driver.
+SDL_AudioInit() and SDL_AudioQuit() have been removed. Instead you can call SDL_InitSubSytem() and SDL_QuitSubSytem() with SDL_INIT_AUDIO, which will properly refcount the subsystems. You can choose a specific audio driver using SDL_AUDIO_DRIVER hint.
 
-The following functions have been renamed:
-* SDL_FreeWAV => SDL_free
+SDL_FreeWAV has been removed and calls can be replaced with SDL_free.
 
 ## SDL_cpuinfo.h
 
-- SDL_Has3DNow() has been removed; there is no replacement.
+SDL_Has3DNow() has been removed; there is no replacement.
 
 The following headers are no longer automatically included, and will need to be included manually:
 - immintrin.h
diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h
index 5ec2f2c8907f..32addc33db01 100644
--- a/include/SDL3/SDL_audio.h
+++ b/include/SDL3/SDL_audio.h
@@ -311,8 +311,6 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
  *          initialized.
  *
  * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_INIT_AUDIO
  */
 extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
 



https://github.com/libsdl-org/SDL/commit/47170d288ef56c0dbb19591c59e22e7052f3e434

The patch
From 47170d288ef56c0dbb19591c59e22e7052f3e434 Mon Sep 17 00:00:00 2001
From: Sylvain Becker <[EMAIL REDACTED]>
Date: Tue, 27 Dec 2022 14:22:22 +0100
Subject: [PATCH] Don't export SDL_AudioInit/Quit, use SDL_InitSubsystem
 instead (#6912)

* Don't export SDL_AudioInit/Quit, use SDL_InitSubsystem instead

* Update README

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
---
 WhatsNew.txt                      |  2 ++
 docs/README-migration.md          |  3 +++
 include/SDL3/SDL_audio.h          | 43 +------------------------------
 src/SDL.c                         |  1 +
 src/audio/SDL_audio_c.h           | 22 ++++++++++++++++
 src/dynapi/SDL_dynapi.sym         |  2 --
 src/dynapi/SDL_dynapi_overrides.h |  2 --
 src/dynapi/SDL_dynapi_procs.h     |  2 --
 src/test/SDL_test_common.c        |  5 ++--
 test/testautomation_audio.c       | 34 +++++++++++++-----------
 10 files changed, 51 insertions(+), 65 deletions(-)

diff --git a/WhatsNew.txt b/WhatsNew.txt
index bd4511c820ed..2fce93b9c290 100644
--- a/WhatsNew.txt
+++ b/WhatsNew.txt
@@ -18,6 +18,8 @@ General:
 * The following functions have been renamed:
     * SDL_FreeWAV => SDL_free
 * Removed the following functions from the API, see docs/README-migration.md for details:
+    * SDL_AudioInit
+    * SDL_AudioQuit
     * SDL_CalculateGammaRamp()
     * SDL_CreateRGBSurface()
     * SDL_CreateRGBSurfaceFrom()
diff --git a/docs/README-migration.md b/docs/README-migration.md
index e782a673433e..7d5cde19000e 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -42,6 +42,9 @@ The vi format comments have been removed from source code. Vim users can use the
 
 ## SDL_audio.h
 
+- SDL_AudioInit() and SDL_AudioQuit() have been removed. Instead you can call SDL_InitSubSytem() and SDL_QuitSubSytem() with SDL_INIT_AUDIO, which will properly refcount the subsystems.
+  Also the hint SDL_AUDIO_DRIVER can help to choose a specific driver.
+
 The following functions have been renamed:
 * SDL_FreeWAV => SDL_free
 
diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h
index 6c436f4e1fa1..5ec2f2c8907f 100644
--- a/include/SDL3/SDL_audio.h
+++ b/include/SDL3/SDL_audio.h
@@ -298,47 +298,6 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
 extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
 /* @} */
 
-/**
- *  \name Initialization and cleanup
- *
- *  \internal These functions are used internally, and should not be used unless
- *            you have a specific need to specify the audio driver you want to
- *            use.  You should normally use SDL_Init() or SDL_InitSubSystem().
- */
-/* @{ */
-
-/**
- * Use this function to initialize a particular audio driver.
- *
- * This function is used internally, and should not be used unless you have a
- * specific need to designate the audio driver you want to use. You should
- * normally use SDL_Init() or SDL_InitSubSystem().
- *
- * \param driver_name the name of the desired audio driver
- * \returns 0 on success or a negative error code on failure; call
- *          SDL_GetError() for more information.
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_AudioQuit
- */
-extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
-
-/**
- * Use this function to shut down audio if you initialized it with
- * SDL_AudioInit().
- *
- * This function is used internally, and should not be used unless you have a
- * specific need to specify the audio driver you want to use. You should
- * normally use SDL_Quit() or SDL_QuitSubSystem().
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_AudioInit
- */
-extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
-/* @} */
-
 /**
  * Get the name of the current audio driver.
  *
@@ -353,7 +312,7 @@ extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
  *
  * \since This function is available since SDL 3.0.0.
  *
- * \sa SDL_AudioInit
+ * \sa SDL_INIT_AUDIO
  */
 extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
 
diff --git a/src/SDL.c b/src/SDL.c
index 9bc358d6e3a2..bf427dc5d01c 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -37,6 +37,7 @@
 
 #include "SDL_assert_c.h"
 #include "SDL_log_c.h"
+#include "audio/SDL_audio_c.h"
 #include "events/SDL_events_c.h"
 #include "haptic/SDL_haptic_c.h"
 #include "joystick/SDL_joystick_c.h"
diff --git a/src/audio/SDL_audio_c.h b/src/audio/SDL_audio_c.h
index 371b3756466a..2af78384ef13 100644
--- a/src/audio/SDL_audio_c.h
+++ b/src/audio/SDL_audio_c.h
@@ -71,4 +71,26 @@ extern SDL_AudioFilter SDL_Convert_F32_to_S16;
 extern SDL_AudioFilter SDL_Convert_F32_to_U16;
 extern SDL_AudioFilter SDL_Convert_F32_to_S32;
 
+/**
+ * Use this function to initialize a particular audio driver.
+ *
+ * This function is used internally, and should not be used unless you have a
+ * specific need to designate the audio driver you want to use. You should
+ * normally use SDL_Init() or SDL_InitSubSystem().
+ *
+ * \param driver_name the name of the desired audio driver
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
+ */
+extern int SDL_AudioInit(const char *driver_name);
+
+/**
+ * Use this function to shut down audio if you initialized it with SDL_AudioInit().
+ *
+ * This function is used internally, and should not be used unless you have a
+ * specific need to specify the audio driver you want to use. You should
+ * normally use SDL_Quit() or SDL_QuitSubSystem().
+ */
+extern void SDL_AudioQuit(void);
+
 #endif /* SDL_audio_c_h_ */
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 6b5d565c2295..9bde88e93e25 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -34,8 +34,6 @@ SDL3_0.0.0 {
     SDL_WriteBE64;
     SDL_GetNumAudioDrivers;
     SDL_GetAudioDriver;
-    SDL_AudioInit;
-    SDL_AudioQuit;
     SDL_GetCurrentAudioDriver;
     SDL_OpenAudio;
     SDL_GetNumAudioDevices;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 35a0a662cd3a..32db5b0afb84 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -70,8 +70,6 @@
 #define SDL_AtomicGetPtr SDL_AtomicGetPtr_REAL
 #define SDL_GetNumAudioDrivers SDL_GetNumAudioDrivers_REAL
 #define SDL_GetAudioDriver SDL_GetAudioDriver_REAL
-#define SDL_AudioInit SDL_AudioInit_REAL
-#define SDL_AudioQuit SDL_AudioQuit_REAL
 #define SDL_GetCurrentAudioDriver SDL_GetCurrentAudioDriver_REAL
 #define SDL_OpenAudio SDL_OpenAudio_REAL
 #define SDL_GetNumAudioDevices SDL_GetNumAudioDevices_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index ce81e7f833d8..7ea26c30471d 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -97,8 +97,6 @@ SDL_DYNAPI_PROC(void*,SDL_AtomicSetPtr,(void **a, void *b),(a,b),return)
 SDL_DYNAPI_PROC(void*,SDL_AtomicGetPtr,(void **a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GetNumAudioDrivers,(void),(),return)
 SDL_DYNAPI_PROC(const char*,SDL_GetAudioDriver,(int a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_AudioInit,(const char *a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_AudioQuit,(void),(),)
 SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return)
 SDL_DYNAPI_PROC(int,SDL_OpenAudio,(SDL_AudioSpec *a, SDL_AudioSpec *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_GetNumAudioDevices,(int a),(a),return)
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 8b1b3ce60d2e..2e6490c1bc78 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -1346,7 +1346,8 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
                 SDL_Log("%s\n", text);
             }
         }
-        if (SDL_AudioInit(state->audiodriver) < 0) {
+        SDL_SetHint("SDL_AUDIO_DRIVER", state->audiodriver);
+        if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
             SDL_Log("Couldn't initialize audio driver: %s\n",
                     SDL_GetError());
             return SDL_FALSE;
@@ -2163,7 +2164,7 @@ void SDLTest_CommonQuit(SDLTest_CommonState *state)
         SDL_VideoQuit();
     }
     if (state->flags & SDL_INIT_AUDIO) {
-        SDL_AudioQuit();
+        SDL_QuitSubSystem(SDL_INIT_AUDIO);
     }
     SDL_free(state);
     SDL_Quit();
diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c
index 57647dcc6293..c84ababcaba0 100644
--- a/test/testautomation_audio.c
+++ b/test/testautomation_audio.c
@@ -97,26 +97,28 @@ int audio_initQuitAudio()
         SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */
 
         /* Call Init */
-        result = SDL_AudioInit(audioDriver);
-        SDLTest_AssertPass("Call to SDL_AudioInit('%s')", audioDriver);
+        SDL_SetHint("SDL_AUDIO_DRIVER", audioDriver);
+        result = SDL_InitSubSystem(SDL_INIT_AUDIO);
+        SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_AUDIO) with driver='%s'", audioDriver);
         SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0 got: %d", result);
 
         /* Call Quit */
-        SDL_AudioQuit();
-        SDLTest_AssertPass("Call to SDL_AudioQuit()");
+        SDL_QuitSubSystem(SDL_INIT_AUDIO);
+        SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)");
     }
 
     /* NULL driver specification */
     audioDriver = NULL;
 
     /* Call Init */
-    result = SDL_AudioInit(audioDriver);
+    SDL_SetHint("SDL_AUDIO_DRIVER", audioDriver);
+    result = SDL_InitSubSystem(SDL_INIT_AUDIO);
     SDLTest_AssertPass("Call to SDL_AudioInit(NULL)");
     SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0 got: %d", result);
 
     /* Call Quit */
-    SDL_AudioQuit();
-    SDLTest_AssertPass("Call to SDL_AudioQuit()");
+    SDL_QuitSubSystem(SDL_INIT_AUDIO);
+    SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)");
 
     /* Restart audio again */
     _audioSetUp(NULL);
@@ -157,8 +159,9 @@ int audio_initOpenCloseQuitAudio()
         for (j = 0; j < 2; j++) {
 
             /* Call Init */
-            result = SDL_AudioInit(audioDriver);
-            SDLTest_AssertPass("Call to SDL_AudioInit('%s')", audioDriver);
+            SDL_SetHint("SDL_AUDIO_DRIVER", audioDriver);
+            result = SDL_InitSubSystem(SDL_INIT_AUDIO);
+            SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_AUDIO) with driver='%s'", audioDriver);
             SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0 got: %d", result);
 
             /* Set spec */
@@ -200,8 +203,8 @@ int audio_initOpenCloseQuitAudio()
 
             /* Call Quit (maybe multiple times) */
             for (k = 0; k <= j; k++) {
-                SDL_AudioQuit();
-                SDLTest_AssertPass("Call to SDL_AudioQuit(), call %d", k + 1);
+                SDL_QuitSubSystem(SDL_INIT_AUDIO);
+                SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO), call %d", k + 1);
             }
 
         } /* spec loop */
@@ -246,8 +249,9 @@ int audio_pauseUnpauseAudio()
         for (j = 0; j < 2; j++) {
 
             /* Call Init */
-            result = SDL_AudioInit(audioDriver);
-            SDLTest_AssertPass("Call to SDL_AudioInit('%s')", audioDriver);
+            SDL_SetHint("SDL_AUDIO_DRIVER", audioDriver);
+            result = SDL_InitSubSystem(SDL_INIT_AUDIO);
+            SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_AUDIO) with driver='%s'", audioDriver);
             SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0 got: %d", result);
 
             /* Set spec */
@@ -320,8 +324,8 @@ int audio_pauseUnpauseAudio()
             SDLTest_AssertPass("Call to SDL_CloseAudio()");
 
             /* Call Quit */
-            SDL_AudioQuit();
-            SDLTest_AssertPass("Call to SDL_AudioQuit()");
+            SDL_QuitSubSystem(SDL_INIT_AUDIO);
+            SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)");
 
         } /* spec loop */
     }     /* driver loop */



https://github.com/libsdl-org/SDL/commit/3fb0c8b54a0af705d1450af292355bccff4e5b3a

The patch
From 3fb0c8b54a0af705d1450af292355bccff4e5b3a Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Tue, 27 Dec 2022 13:22:43 +0100
Subject: [PATCH] Remove/Rename SDL_FreeWAV() to SDL_free()

---
 WhatsNew.txt                      |  1 +
 docs/README-migration.md          |  5 +++++
 include/SDL3/SDL_audio.h          | 23 +++--------------------
 include/SDL3/SDL_oldnames.h       |  6 ++++++
 src/audio/SDL_wave.c              |  8 --------
 src/dynapi/SDL_dynapi.sym         |  1 -
 src/dynapi/SDL_dynapi_overrides.h |  1 -
 src/dynapi/SDL_dynapi_procs.h     |  1 -
 test/loopwave.c                   |  4 ++--
 test/loopwavequeue.c              |  4 ++--
 test/testaudiohotplug.c           |  2 +-
 test/testmultiaudio.c             |  4 ++--
 test/testresample.c               | 12 ++++++------
 13 files changed, 28 insertions(+), 44 deletions(-)

diff --git a/WhatsNew.txt b/WhatsNew.txt
index 2d0a1d7b76a8..bd4511c820ed 100644
--- a/WhatsNew.txt
+++ b/WhatsNew.txt
@@ -16,6 +16,7 @@ General:
     * RW_SEEK_END -> SDL_RW_SEEK_END
     * RW_SEEK_SET -> SDL_RW_SEEK_SET
 * The following functions have been renamed:
+    * SDL_FreeWAV => SDL_free
 * Removed the following functions from the API, see docs/README-migration.md for details:
     * SDL_CalculateGammaRamp()
     * SDL_CreateRGBSurface()
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 6f1ca3e5053c..e782a673433e 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -40,6 +40,11 @@ begin_code.h and close_code.h in the public headers have been renamed to SDL_beg
 
 The vi format comments have been removed from source code. Vim users can use the [editorconfig plugin](https://github.com/editorconfig/editorconfig-vim) to automatically set tab spacing for the SDL coding style.
 
+## SDL_audio.h
+
+The following functions have been renamed:
+* SDL_FreeWAV => SDL_free
+
 ## SDL_cpuinfo.h
 
 - SDL_Has3DNow() has been removed; there is no replacement.
diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h
index 51c83440d4c0..6c436f4e1fa1 100644
--- a/include/SDL3/SDL_audio.h
+++ b/include/SDL3/SDL_audio.h
@@ -808,7 +808,7 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
  * data in the buffer. The `samples` member is set to a sane default and all
  * others are set to zero.
  *
- * It's necessary to use SDL_FreeWAV() to free the audio data returned in
+ * It's necessary to use SDL_free() to free the audio data returned in
  * `audio_buf` when it is no longer used.
  *
  * Because of the underspecification of the .WAV format, there are many
@@ -860,11 +860,11 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
  *          more information.
  *
  *          When the application is done with the data returned in
- *          `audio_buf`, it should call SDL_FreeWAV() to dispose of it.
+ *          `audio_buf`, it should call SDL_free() to dispose of it.
  *
  * \since This function is available since SDL 3.0.0.
  *
- * \sa SDL_FreeWAV
+ * \sa SDL_free
  * \sa SDL_LoadWAV
  */
 extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
@@ -880,23 +880,6 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
 #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
     SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
 
-/**
- * Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW().
- *
- * After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW()
- * its data can eventually be freed with SDL_FreeWAV(). It is safe to call
- * this function with a NULL pointer.
- *
- * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or
- *                  SDL_LoadWAV_RW()
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_LoadWAV
- * \sa SDL_LoadWAV_RW
- */
-extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
-
 /**
  * Initialize an SDL_AudioCVT structure for conversion.
  *
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index 24f36f69525c..4ffcffec007d 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -39,6 +39,9 @@
  */
 #ifdef SDL_ENABLE_OLD_NAMES
 
+/* ##SDL_audio.h */
+#define SDL_FreeWAV SDL_free
+
 /* ##SDL_keycode.h */
 #define KMOD_ALT SDL_KMOD_ALT
 #define KMOD_CAPS SDL_KMOD_CAPS
@@ -74,6 +77,9 @@
 
 #else /* !SDL_ENABLE_OLD_NAMES */
 
+/* ##SDL_audio.h */
+#define SDL_FreeWAV SDL_FreeWAV_renamed_SDL_free
+
 /* ##SDL_keycode.h */
 #define KMOD_ALT KMOD_ALT_renamed_SDL_KMOD_ALT
 #define KMOD_CAPS KMOD_CAPS_renamed_SDL_KMOD_CAPS
diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
index c28a31a45d63..04c4f6455aab 100644
--- a/src/audio/SDL_wave.c
+++ b/src/audio/SDL_wave.c
@@ -2124,11 +2124,3 @@ SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_b
 
     return spec;
 }
-
-/* Since the WAV memory is allocated in the shared library, it must also
-   be freed here.  (Necessary under Win32, VC++)
- */
-void SDL_FreeWAV(Uint8 *audio_buf)
-{
-    SDL_free(audio_buf);
-}
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 1a3e2d69c865..6b5d565c2295 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -48,7 +48,6 @@ SDL3_0.0.0 {
     SDL_PauseAudio;
     SDL_PauseAudioDevice;
     SDL_LoadWAV_RW;
-    SDL_FreeWAV;
     SDL_BuildAudioCVT;
     SDL_ConvertAudio;
     SDL_NewAudioStream;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index dec3fab441bb..35a0a662cd3a 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -82,7 +82,6 @@
 #define SDL_PauseAudio SDL_PauseAudio_REAL
 #define SDL_PauseAudioDevice SDL_PauseAudioDevice_REAL
 #define SDL_LoadWAV_RW SDL_LoadWAV_RW_REAL
-#define SDL_FreeWAV SDL_FreeWAV_REAL
 #define SDL_BuildAudioCVT SDL_BuildAudioCVT_REAL
 #define SDL_ConvertAudio SDL_ConvertAudio_REAL
 #define SDL_MixAudio SDL_MixAudio_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 7a80f80de69d..ce81e7f833d8 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -109,7 +109,6 @@ SDL_DYNAPI_PROC(SDL_AudioStatus,SDL_GetAudioDeviceStatus,(SDL_AudioDeviceID a),(
 SDL_DYNAPI_PROC(void,SDL_PauseAudio,(int a),(a),)
 SDL_DYNAPI_PROC(void,SDL_PauseAudioDevice,(SDL_AudioDeviceID a, int b),(a,b),)
 SDL_DYNAPI_PROC(SDL_AudioSpec*,SDL_LoadWAV_RW,(SDL_RWops *a, int b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return)
-SDL_DYNAPI_PROC(void,SDL_FreeWAV,(Uint8 *a),(a),)
 SDL_DYNAPI_PROC(int,SDL_BuildAudioCVT,(SDL_AudioCVT *a, SDL_AudioFormat b, Uint8 c, int d, SDL_AudioFormat e, Uint8 f, int g),(a,b,c,d,e,f,g),return)
 SDL_DYNAPI_PROC(int,SDL_ConvertAudio,(SDL_AudioCVT *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_MixAudio,(Uint8 *a, const Uint8 *b, Uint32 c, int d),(a,b,c,d),)
diff --git a/test/loopwave.c b/test/loopwave.c
index eccee138b7d4..a4d05e04dbd0 100644
--- a/test/loopwave.c
+++ b/test/loopwave.c
@@ -59,7 +59,7 @@ open_audio()
     device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0);
     if (!device) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
-        SDL_FreeWAV(wave.sound);
+        SDL_free(wave.sound);
         quit(2);
     }
 
@@ -171,7 +171,7 @@ int main(int argc, char *argv[])
 
     /* Clean up on signal */
     close_audio();
-    SDL_FreeWAV(wave.sound);
+    SDL_free(wave.sound);
     SDL_free(filename);
     SDL_Quit();
     return 0;
diff --git a/test/loopwavequeue.c b/test/loopwavequeue.c
index 3acd92fba6c7..25fce1ec5002 100644
--- a/test/loopwavequeue.c
+++ b/test/loopwavequeue.c
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
     /* Initialize fillerup() variables */
     if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
-        SDL_FreeWAV(wave.sound);
+        SDL_free(wave.sound);
         quit(2);
     }
 
@@ -139,7 +139,7 @@ int main(int argc, char *argv[])
 
     /* Clean up on signal */
     SDL_CloseAudio();
-    SDL_FreeWAV(wave.sound);
+    SDL_free(wave.sound);
     SDL_free(filename);
     SDL_Quit();
     return 0;
diff --git a/test/testaudiohotplug.c b/test/testaudiohotplug.c
index a5d3c73a007c..085dbb030014 100644
--- a/test/testaudiohotplug.c
+++ b/test/testaudiohotplug.c
@@ -194,7 +194,7 @@ int main(int argc, char *argv[])
     /* Clean up on signal */
     /* Quit audio first, then free WAV. This prevents access violations in the audio threads. */
     SDL_QuitSubSystem(SDL_INIT_AUDIO);
-    SDL_FreeWAV(sound);
+    SDL_free(sound);
     SDL_free(filename);
     SDL_Quit();
     return 0;
diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c
index 906cda3cf79c..1e6ad500f53f 100644
--- a/test/testmultiaudio.c
+++ b/test/testmultiaudio.c
@@ -62,7 +62,7 @@ void loop()
 #endif
         SDL_PauseAudioDevice(cbd[0].dev, 1);
         SDL_CloseAudioDevice(cbd[0].dev);
-        SDL_FreeWAV(sound);
+        SDL_free(sound);
         SDL_Quit();
     }
 }
@@ -190,7 +190,7 @@ int main(int argc, char **argv)
                          SDL_GetError());
         } else {
             test_multi_audio(devcount);
-            SDL_FreeWAV(sound);
+            SDL_free(sound);
         }
 
         SDL_free(file);
diff --git a/test/testresample.c b/test/testresample.c
index 7d40778f81a3..1487d3d22e20 100644
--- a/test/testresample.c
+++ b/test/testresample.c
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
     if (SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq,
                           spec.format, cvtchans, cvtfreq) == -1) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to build CVT: %s\n", SDL_GetError());
-        SDL_FreeWAV(data);
+        SDL_free(data);
         SDL_Quit();
         return 4;
     }
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
     cvt.buf = (Uint8 *)SDL_malloc((size_t)len * cvt.len_mult);
     if (cvt.buf == NULL) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory.\n");
-        SDL_FreeWAV(data);
+        SDL_free(data);
         SDL_Quit();
         return 5;
     }
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
     if (SDL_ConvertAudio(&cvt) == -1) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Conversion failed: %s\n", SDL_GetError());
         SDL_free(cvt.buf);
-        SDL_FreeWAV(data);
+        SDL_free(data);
         SDL_Quit();
         return 6;
     }
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
     if (io == NULL) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fopen('%s') failed: %s\n", argv[2], SDL_GetError());
         SDL_free(cvt.buf);
-        SDL_FreeWAV(data);
+        SDL_free(data);
         SDL_Quit();
         return 7;
     }
@@ -106,13 +106,13 @@ int main(int argc, char **argv)
     if (SDL_RWclose(io) == -1) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fclose('%s') failed: %s\n", argv[2], SDL_GetError());
         SDL_free(cvt.buf);
-        SDL_FreeWAV(data);
+        SDL_free(data);
         SDL_Quit();
         return 8;
     } /* if */
 
     SDL_free(cvt.buf);
-    SDL_FreeWAV(data);
+    SDL_free(data);
     SDL_Quit();
     return 0;
 } /* main */



The patch
From 9e1afdfa13485ae1a650672f7a2c2ffa2a1fa2b4 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 27 Dec 2022 06:51:28 +0300
Subject: [PATCH] mingw builds seem to require libgcc now (missing __udivdi3)

---
 src/Makefile.mingw | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile.mingw b/src/Makefile.mingw
index bd67b90..bd5b2f8 100644
--- a/src/Makefile.mingw
+++ b/src/Makefile.mingw
@@ -19,7 +19,7 @@ CFLAGS  = -O3 -Wall
 LDFLAGS = -nostdlib -shared -Wl,--no-undefined -Wl,--enable-auto-image-base -Wl,--out-implib,$(LIB)
 LDLIBS  = -lkernel32 -luser32
 # libgcc is needed for 32 bit (x86) builds:
-#LDLIBS += -static-libgcc -lgcc
+LDLIBS += -static-libgcc -lgcc
 
 LIB = libSDL2.dll.a
 DLL = SDL2.dll