enable sdl_mixer opus support if possible
authoralfadur
Wed, 24 Apr 2019 21:14:44 +0300
changeset 14852 64f88108926b
parent 14851 8ddb5842fe0b
child 14855 cbc1216fdf39
enable sdl_mixer opus support if possible
hedgewars/SDLh.pas
hedgewars/uSound.pas
--- a/hedgewars/SDLh.pas	Wed Apr 24 16:21:46 2019 +0300
+++ b/hedgewars/SDLh.pas	Wed Apr 24 21:14:44 2019 +0300
@@ -251,6 +251,7 @@
     MIX_INIT_MP3        = $00000008;
     MIX_INIT_OGG        = $00000010;
     MIX_INIT_FLUIDSYNTH = $00000020;
+    MIX_INIT_OPUS       = $00000040;
 
     {* SDL_TTF *}
     TTF_STYLE_NORMAL = 0;
--- a/hedgewars/uSound.pas	Wed Apr 24 16:21:46 2019 +0300
+++ b/hedgewars/uSound.pas	Wed Apr 24 21:14:44 2019 +0300
@@ -409,7 +409,14 @@
     end;
 
     WriteToConsole('Init SDL_mixer... ');
-    if SDLCheck(Mix_Init(MIX_INIT_OGG) <> 0, 'Mix_Init', true) then exit;
+
+    if (Mix_Init(MIX_INIT_OGG or MIX_INIT_OPUS) and MIX_INIT_OPUS) = 0 then
+    begin
+      WriteToConsole('Cannot init OPUS: ' + SDL_GetError());
+
+      if SDLCheck(Mix_Init(MIX_INIT_OGG) <> 0, 'Mix_Init', true) then exit;
+    end;
+
     WriteLnToConsole(msgOK);
 
     // from uVariables to be used by other modules