shithub: choc

Download patch

ref: fd0c97758ff9aa5fc835fe03ea9f58583a10b988
parent: 54fd320a874cabeaf15115432bfdd172d88e0551
author: Fabian Greffrath <[email protected]>
date: Thu Mar 14 07:42:22 EDT 2019

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

--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -195,6 +195,9 @@
     }
 
     // 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