Skip to content

Commit 98a8c33

Browse files
committed
api: Changed version macros/functions to match other satellite libraries.
Fixes #709.
1 parent 7370a32 commit 98a8c33

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

.wikiheaders-options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ projectfullname = SDL_mixer
22
projectshortname = SDL_mixer
33
incsubdir = include/SDL3_mixer
44
wikisubdir = SDL3_mixer
5-
apiprefixregex = MIX_
5+
apiprefixregex = (MIX_|SDL_MIXER_)
66
apipropertyregex = \A\s*\#\s*define\s+MIX_PROP_
77
mainincludefname = SDL3_mixer/SDL_mixer.h
88
versionfname = include/SDL3_mixer/SDL_mixer.h

docs/README-migration.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ In SDL2_mixer, all functions started with `Mix_` and macros started with
6262
`MIX_`. In SDL3_mixer, everything starts with `MIX_`.
6363

6464

65+
## Versioning
66+
67+
Versions are now bits packed into a single int instead of a struct, using
68+
SDL3's usual magic for unpacking these.
69+
70+
6571
## Initialization
6672

6773
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
281287
be added if there is a need. If you're stuck, please file an issue and we
282288
can discuss it!
283289
284-
- SDL_MIXER_MAJOR_VERSION => MIX_MAJOR_VERSION
285-
- SDL_MIXER_MINOR_VERSION => MIX_MINOR_VERSION
286-
- SDL_MIXER_MICRO_VERSION => MIX_MICRO_VERSION
287-
- SDL_MIXER_VERSION => MIX_VERSION
288-
- SDL_MIXER_VERSION_ATLEAST => `(MIX_VERSION >= SDL_VERSIONNUM(X, Y, Z))`
289-
- Mix_Version => MIX_GetVersion
290+
- MIX_MAJOR_VERSION => SDL_MIXER_MAJOR_VERSION
291+
- MIX_MINOR_VERSION => SDL_MIXER_MAJOR_VERSION
292+
- MIX_PATCHLEVEL => SDL_MIXER_MICRO_VERSION
293+
- MIX_VERSION => SDL_MIXER_VERSION
294+
- MIX_Linked_Version => MIX_Version
295+
- Mix_Version => MIX_Version
296+
- SDL_MIXER_COMPILEDVERSION => SDL_MIXER_VERSION
290297
- MIX_InitFlags => not needed in SDL3_mixer.
291298
- Mix_Init => MIX_Init (no initflags needed)
292299
- Mix_Quit => MIX_Quit

include/SDL3_mixer/SDL_mixer.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ typedef struct MIX_Group MIX_Group;
199199
*
200200
* \since This macro is available since SDL_mixer 3.0.0.
201201
*/
202-
#define MIX_MAJOR_VERSION 3
202+
#define SDL_MIXER_MAJOR_VERSION 3
203203

204204
/**
205205
* The current minor version of the SDL_mixer headers.
@@ -208,7 +208,7 @@ typedef struct MIX_Group MIX_Group;
208208
*
209209
* \since This macro is available since SDL_mixer 3.0.0.
210210
*/
211-
#define MIX_MINOR_VERSION 0
211+
#define SDL_MIXER_MINOR_VERSION 0
212212

213213
/**
214214
* The current micro (or patchlevel) version of the SDL_mixer headers.
@@ -217,23 +217,23 @@ typedef struct MIX_Group MIX_Group;
217217
*
218218
* \since This macro is available since SDL_mixer 3.0.0.
219219
*/
220-
#define MIX_MICRO_VERSION 0
220+
#define SDL_MIXER_MICRO_VERSION 0
221221

222222
/**
223-
* This is the version number macro for the current SDL_mixer version.
223+
* This is the current version number macro of the SDL_mixer headers.
224224
*
225225
* \since This macro is available since SDL_mixer 3.0.0.
226226
*
227-
* \sa MIX_GetVersion
227+
* \sa MIX_Version
228228
*/
229-
#define MIX_VERSION SDL_VERSIONNUM(MIX_MAJOR_VERSION, MIX_MINOR_VERSION, MIX_MICRO_VERSION)
229+
#define SDL_MIXER_VERSION SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_MICRO_VERSION)
230230

231231
/**
232232
* Get the version of SDL_mixer that is linked against your program.
233233
*
234234
* If you are linking to SDL_mixer dynamically, then it is possible that the
235235
* current version will be different than the version you compiled against.
236-
* This function returns the current version, while MIX_VERSION is the version
236+
* This function returns the current version, while SDL_MIXER_VERSION is the version
237237
* you compiled with.
238238
*
239239
* This function may be called safely at any time, even before MIX_Init().
@@ -242,9 +242,9 @@ typedef struct MIX_Group MIX_Group;
242242
*
243243
* \since This function is available since SDL_mixer 3.0.0.
244244
*
245-
* \sa MIX_VERSION
245+
* \sa SDL_MIXER_VERSION
246246
*/
247-
extern SDL_DECLSPEC int SDLCALL MIX_GetVersion(void);
247+
extern SDL_DECLSPEC int SDLCALL MIX_Version(void);
248248

249249
/**
250250
* Initialize the SDL_mixer library.

src/SDL_mixer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,9 @@ static void QuitDecoders(void)
654654
num_available_decoders = 0;
655655
}
656656

657-
int MIX_GetVersion(void)
657+
int MIX_Version(void)
658658
{
659-
return MIX_VERSION;
659+
return SDL_MIXER_VERSION;
660660
}
661661

662662
bool MIX_Init(void)

0 commit comments

Comments
 (0)