summaryrefslogtreecommitdiff
blob: 46966269dcad1a29a3a6c2581cfd8ca2c2abe6c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From e227fc26ffff199a6a659dbe954ff7b764658d4d Mon Sep 17 00:00:00 2001
From: Richard Schaller <richard.schaller@gmx.de>
Date: Sat, 30 Mar 2019 18:07:28 +0100
Subject: [PATCH] Support for SDL_mixer 2.0.2 or higher: MIX_INIT_FLUIDSYNTH
 was renamed to MIX_INIT_MID

---
 src/FileClasses/music/DirectoryPlayer.cpp | 4 ++++
 src/FileClasses/music/XMIPlayer.cpp       | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/src/FileClasses/music/DirectoryPlayer.cpp b/src/FileClasses/music/DirectoryPlayer.cpp
index 531d971..05d800c 100644
--- a/src/FileClasses/music/DirectoryPlayer.cpp
+++ b/src/FileClasses/music/DirectoryPlayer.cpp
@@ -59,7 +59,11 @@ DirectoryPlayer::DirectoryPlayer() : MusicPlayer(settings.audio.playMusic, setti
 
     music = nullptr;
 
+#if SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) >= SDL_VERSIONNUM(2,0,2)
+    Mix_Init(MIX_INIT_MID | MIX_INIT_FLAC | MIX_INIT_MP3 | MIX_INIT_OGG);
+#else
     Mix_Init(MIX_INIT_FLUIDSYNTH | MIX_INIT_FLAC | MIX_INIT_MP3 | MIX_INIT_OGG);
+#endif
 }
 
 DirectoryPlayer::~DirectoryPlayer() {
diff --git a/src/FileClasses/music/XMIPlayer.cpp b/src/FileClasses/music/XMIPlayer.cpp
index a7e5150..0fcfa8f 100644
--- a/src/FileClasses/music/XMIPlayer.cpp
+++ b/src/FileClasses/music/XMIPlayer.cpp
@@ -30,9 +30,15 @@
 XMIPlayer::XMIPlayer() : MusicPlayer(settings.audio.playMusic, settings.audio.musicVolume) {
     music = nullptr;
 
+#if SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) >= SDL_VERSIONNUM(2,0,2)
+    if((Mix_Init(MIX_INIT_MID) & MIX_INIT_MID) == 0) {
+        SDL_Log("XMIPlayer: Failed to init required midi support: %s", SDL_GetError());
+    }
+#else
     if((Mix_Init(MIX_INIT_FLUIDSYNTH) & MIX_INIT_FLUIDSYNTH) == 0) {
         SDL_Log("XMIPlayer: Failed to init required midi support: %s", SDL_GetError());
     }
+#endif
 }
 
 XMIPlayer::~XMIPlayer() {
-- 
2.24.1