From 9de9625a6229cffa6611d1cdd1c2525192a4de72 Mon Sep 17 00:00:00 2001
From: Ketmar Dark <ketmar@ketmar.no-ip.org>
Date: Thu, 7 Apr 2016 06:51:40 +0300
Subject: [PATCH] sdl mixer: initializing all possible engines

---
 src/engine/e_sound.pas | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/engine/e_sound.pas b/src/engine/e_sound.pas
index 76f9929..46d7584 100644
--- a/src/engine/e_sound.pas
+++ b/src/engine/e_sound.pas
@@ -124,17 +124,16 @@ begin
   Result := False;
   SoundInitialized := False;
 
-{ // wow, this is actually MIDI player!
+  // wow, this is actually MIDI player!
   // we need module player
-  if (Mix_Init(MIX_INIT_MOD) and MIX_INIT_MOD) <> MIX_INIT_MOD then
-  begin
-    e_WriteLog('Error initializing SDL module player:', MSG_FATALERROR);
-    e_WriteLog(Mix_GetError(), MSG_FATALERROR);
-    //Exit;
-  end;
-}
-
-  res := Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 2048);
+  res := Mix_Init(MIX_INIT_MOD or MIX_INIT_MP3 or MIX_INIT_OGG or MIX_INIT_FLAC);
+  if (res and MIX_INIT_FLAC) <> 0 then e_WriteLog('SDL: FLAC playback is active', MSG_NOTIFY);
+  if (res and MIX_INIT_MOD) <> 0 then e_WriteLog('SDL: MOD/MIDI playback is active', MSG_NOTIFY);
+  if (res and MIX_INIT_MP3) <> 0 then e_WriteLog('SDL: MP3 playback is active', MSG_NOTIFY);
+  if (res and MIX_INIT_OGG) <> 0 then e_WriteLog('SDL: OGG playback is active', MSG_NOTIFY);
+
+  res := Mix_OpenAudio(48000, AUDIO_S16LSB, 2, 2048);
+  if res = -1 then res := Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 2048);
   if res = -1 then
   begin
     e_WriteLog('Error initializing SDL mixer:', MSG_FATALERROR);
-- 
2.29.2