From 98a8c3334acfc30d29fb04536e49e7a629d58125 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 24 Jul 2025 12:44:24 -0400
Subject: [PATCH] api: Changed version macros/functions to match other
satellite libraries.
Fixes #709.
---
.wikiheaders-options | 2 +-
docs/README-migration.md | 19 +++++++++++++------
include/SDL3_mixer/SDL_mixer.h | 18 +++++++++---------
src/SDL_mixer.c | 4 ++--
4 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/.wikiheaders-options b/.wikiheaders-options
index 077a3d3d..692e4a9f 100644
--- a/.wikiheaders-options
+++ b/.wikiheaders-options
@@ -2,7 +2,7 @@ projectfullname = SDL_mixer
projectshortname = SDL_mixer
incsubdir = include/SDL3_mixer
wikisubdir = SDL3_mixer
-apiprefixregex = MIX_
+apiprefixregex = (MIX_|SDL_MIXER_)
apipropertyregex = \A\s*\#\s*define\s+MIX_PROP_
mainincludefname = SDL3_mixer/SDL_mixer.h
versionfname = include/SDL3_mixer/SDL_mixer.h
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 8ad32373..c6620146 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -62,6 +62,12 @@ In SDL2_mixer, all functions started with `Mix_` and macros started with
`MIX_`. In SDL3_mixer, everything starts with `MIX_`.
+## Versioning
+
+Versions are now bits packed into a single int instead of a struct, using
+SDL3's usual magic for unpacking these.
+
+
## Initialization
Previously you had to tell SDL_mixer what file formats you expected to use
@@ -281,12 +287,13 @@ Some of these are listed as "no equivalent in SDL3_mixer" but could possibly
be added if there is a need. If you're stuck, please file an issue and we
can discuss it!
-- SDL_MIXER_MAJOR_VERSION => MIX_MAJOR_VERSION
-- SDL_MIXER_MINOR_VERSION => MIX_MINOR_VERSION
-- SDL_MIXER_MICRO_VERSION => MIX_MICRO_VERSION
-- SDL_MIXER_VERSION => MIX_VERSION
-- SDL_MIXER_VERSION_ATLEAST => `(MIX_VERSION >= SDL_VERSIONNUM(X, Y, Z))`
-- Mix_Version => MIX_GetVersion
+- MIX_MAJOR_VERSION => SDL_MIXER_MAJOR_VERSION
+- MIX_MINOR_VERSION => SDL_MIXER_MAJOR_VERSION
+- MIX_PATCHLEVEL => SDL_MIXER_MICRO_VERSION
+- MIX_VERSION => SDL_MIXER_VERSION
+- MIX_Linked_Version => MIX_Version
+- Mix_Version => MIX_Version
+- SDL_MIXER_COMPILEDVERSION => SDL_MIXER_VERSION
- MIX_InitFlags => not needed in SDL3_mixer.
- Mix_Init => MIX_Init (no initflags needed)
- Mix_Quit => MIX_Quit
diff --git a/include/SDL3_mixer/SDL_mixer.h b/include/SDL3_mixer/SDL_mixer.h
index 3e08621e..acc249ea 100644
--- a/include/SDL3_mixer/SDL_mixer.h
+++ b/include/SDL3_mixer/SDL_mixer.h
@@ -199,7 +199,7 @@ typedef struct MIX_Group MIX_Group;
*
* \since This macro is available since SDL_mixer 3.0.0.
*/
-#define MIX_MAJOR_VERSION 3
+#define SDL_MIXER_MAJOR_VERSION 3
/**
* The current minor version of the SDL_mixer headers.
@@ -208,7 +208,7 @@ typedef struct MIX_Group MIX_Group;
*
* \since This macro is available since SDL_mixer 3.0.0.
*/
-#define MIX_MINOR_VERSION 0
+#define SDL_MIXER_MINOR_VERSION 0
/**
* The current micro (or patchlevel) version of the SDL_mixer headers.
@@ -217,23 +217,23 @@ typedef struct MIX_Group MIX_Group;
*
* \since This macro is available since SDL_mixer 3.0.0.
*/
-#define MIX_MICRO_VERSION 0
+#define SDL_MIXER_MICRO_VERSION 0
/**
- * This is the version number macro for the current SDL_mixer version.
+ * This is the current version number macro of the SDL_mixer headers.
*
* \since This macro is available since SDL_mixer 3.0.0.
*
- * \sa MIX_GetVersion
+ * \sa MIX_Version
*/
-#define MIX_VERSION SDL_VERSIONNUM(MIX_MAJOR_VERSION, MIX_MINOR_VERSION, MIX_MICRO_VERSION)
+#define SDL_MIXER_VERSION SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_MICRO_VERSION)
/**
* Get the version of SDL_mixer that is linked against your program.
*
* If you are linking to SDL_mixer dynamically, then it is possible that the
* current version will be different than the version you compiled against.
- * This function returns the current version, while MIX_VERSION is the version
+ * This function returns the current version, while SDL_MIXER_VERSION is the version
* you compiled with.
*
* This function may be called safely at any time, even before MIX_Init().
@@ -242,9 +242,9 @@ typedef struct MIX_Group MIX_Group;
*
* \since This function is available since SDL_mixer 3.0.0.
*
- * \sa MIX_VERSION
+ * \sa SDL_MIXER_VERSION
*/
-extern SDL_DECLSPEC int SDLCALL MIX_GetVersion(void);
+extern SDL_DECLSPEC int SDLCALL MIX_Version(void);
/**
* Initialize the SDL_mixer library.
diff --git a/src/SDL_mixer.c b/src/SDL_mixer.c
index 755bfaa1..2500b111 100644
--- a/src/SDL_mixer.c
+++ b/src/SDL_mixer.c
@@ -654,9 +654,9 @@ static void QuitDecoders(void)
num_available_decoders = 0;
}
-int MIX_GetVersion(void)
+int MIX_Version(void)
{
- return MIX_VERSION;
+ return SDL_MIXER_VERSION;
}
bool MIX_Init(void)