Skip to content

Commit 377259c

Browse files
committed
Set SDL_MIXER_DISABLE_NATIVEMIDI environment variable
"Never let SDL Mixer use native midi on Windows. Avoids SDL Mixer bug music volume affects global application volume." From Chocolate Doom. See chocolate-doom/chocolate-doom#1742.
1 parent 990c2a0 commit 377259c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/i_music.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,14 @@ bool I_InitMusic(void)
8787
int channels;
8888
uint16_t format;
8989

90-
// If SDL_mixer is not initialized, we have to initialize it and have the responsibility to shut it down later on.
90+
#if defined(_WIN32)
91+
// Never let SDL Mixer use native midi on Windows. Avoids SDL Mixer bug
92+
// where music volume affects global application volume.
93+
SDL_setenv("SDL_MIXER_DISABLE_NATIVEMIDI", "1", true);
94+
#endif
95+
96+
// If SDL_mixer is not initialized, we have to initialize it and have the
97+
// responsibility to shut it down later on.
9198
if (!Mix_QuerySpec(&freq, &format, &channels))
9299
if (Mix_OpenAudioDevice(SAMPLERATE, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS,
93100
CHUNKSIZE, DEFAULT_DEVICE, SDL_AUDIO_ALLOW_ANY_CHANGE) < 0)

0 commit comments

Comments
 (0)