foxygit / doom Log in
commit fd0c97758ff9aa5fc835fe03ea9f58583a10b988
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Thu Mar 14 11:42:22 2019 +0100
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Thu Mar 14 11:51:18 2019 +0100

    sound: support SDL2_Mixer versions where MIX_INIT_MID is undefined

    Between the 2.0.1 and 2.0.2 releases, SDL2_Mixer changed to a plugin
    interface which could use any number of decode libraries to support a
    given sound format [1]. Thus, the flags passed over to Mix_Init() were
    changed from per-library (e.g. MIX_INIT_FLUIDSYNTH) to per-format
    (e.g. MIX_INIT_MID). Since there was no way to specifically request
    support for native MIDI (or, actually, any MIDI at all) before (i.e.
    there was only MIX_INIT_FLUIDSYNTH), we pass zero as a flag over to
    Mix_Init(), which in turn turns it into a noop. Seems harmless, as it
    turned out it wasn't even required to call Mix_Init() for SDL2_Mixer
    version 2.0.1.

    This also fixes building under Travis CI which runs an Ubuntu release
    that still has an older SDL2_Mixer library (xenial: 2.0.1+dfsg1-1).

    [1] https://hg.libsdl.org/SDL_mixer/rev/92882ef2ab81
---
 src/i_sdlmusic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c
index 1ece7e2c..575856a7 100644
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -195,6 +195,9 @@ static boolean I_SDL_InitMusic(void)
     }

     // Initialize SDL_Mixer for MIDI music playback
+#ifndef MIX_INIT_MID
+#define MIX_INIT_MID 0
+#endif
     Mix_Init(MIX_INIT_MID);

     // Once initialization is complete, the temporary Timidity config