Closed l-t-m-f closed 2 months ago
I guess the proper patch to use current SDL3 apis should be like the following. CC: @slouken
diff --git a/examples/playmus.c b/examples/playmus.c
index 97a67b4..4812b99 100644
--- a/examples/playmus.c
+++ b/examples/playmus.c
@@ -205,7 +205,7 @@ int main(int argc, char *argv[])
Mix_VolumeMusic(audio_volume);
/* Set the external music player, if any */
- Mix_SetMusicCMD(SDL_getenv("MUSIC_CMD"));
+ Mix_SetMusicCMD(SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "MUSIC_CMD"));
while (argv[i]) {
next_track = 0;
diff --git a/src/codecs/music_timidity.c b/src/codecs/music_timidity.c
index 726a7f9..cdbc8a0 100644
--- a/src/codecs/music_timidity.c
+++ b/src/codecs/music_timidity.c
@@ -59,7 +59,7 @@ static int TIMIDITY_Open(const SDL_AudioSpec *spec)
(void) spec;
- cfg = SDL_getenv("TIMIDITY_CFG");
+ cfg = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "TIMIDITY_CFG");
if(!cfg) cfg = Mix_GetTimidityCfg();
if (cfg) {
return Timidity_Init(cfg); /* env or user override: no other tries */
diff --git a/src/effects_internal.c b/src/effects_internal.c
index a1d81f7..f110867 100644
--- a/src/effects_internal.c
+++ b/src/effects_internal.c
@@ -37,7 +37,7 @@ int _Mix_effects_max_speed = 0;
void _Mix_InitEffects(void)
{
- _Mix_effects_max_speed = (SDL_getenv(MIX_EFFECTSMAXSPEED) != NULL);
+ _Mix_effects_max_speed = (SDL_GetEnvironmentVariable(SDL_GetEnvironment(), MIX_EFFECTSMAXSPEED) != NULL);
}
void _Mix_DeinitEffects(void)
diff --git a/src/music.c b/src/music.c
index ed42ea0..1efd381 100644
--- a/src/music.c
+++ b/src/music.c
@@ -1495,7 +1495,7 @@ SDL_bool Mix_SetSoundFonts(const char *paths)
const char* Mix_GetSoundFonts(void)
{
- const char *env_paths = SDL_getenv("SDL_SOUNDFONTS");
+ const char *env_paths = SDL_GetEnvironmentVariable(SDL_GetEnvironment(), "SDL_SOUNDFONTS");
SDL_bool force_env_paths = SDL_GetHintBoolean("SDL_FORCE_SOUNDFONTS", SDL_FALSE);
if (force_env_paths && (!env_paths || !*env_paths)) {
force_env_paths = SDL_FALSE;
I guess the proper patch to use current SDL3 apis should be like the following. CC: @slouken
Yep, this looks good.
I guess the proper patch to use current SDL3 apis should be like the following. CC: @slouken
Yep, this looks good.
OK, I'll be updating SDL_mixer and SDL_image. Leaving sdl2-compat to you.
Thank you sezero I understand how to new call should be used.
OK, main (SDL3) branches of SDL_mixer and SDL_image are patched now.
This is a fix since
SDL_getenv
has been removed with the arrival of a new thread-safe API. For now I have thus replaced usages of the old name in the SDL_mixer extension by the new nameSDL_getenv_unsafe
.I am too unfamiliar with the library to implement the new multi-threaded API for now. I am slowly getting by bearings with this library.
Thank you,