hedgewars/uSound.pas
changeset 13495 f725701ca529
parent 13288 ee8c6eb0ab47
child 13628 d5e029b84e16
--- a/hedgewars/uSound.pas	Mon Jul 16 20:28:01 2018 +0200
+++ b/hedgewars/uSound.pas	Mon Jul 16 23:27:15 2018 +0200
@@ -339,7 +339,11 @@
 var success: boolean;
 begin
     if not (isSoundEnabled or isMusicEnabled) then
+        begin
+        isAudioMuted:= true;
+        cInitVolume:= 0;
         exit;
+        end;
     WriteToConsole('Init sound...');
     success:= SDL_InitSubSystem(SDL_INIT_AUDIO) = 0;
 
@@ -357,12 +361,17 @@
         WriteLnToConsole(msgFailed);
         isSoundEnabled:= false;
         isMusicEnabled:= false;
+        isAudioMuted:= true;
+        cInitVolume:= 0;
     end;
 
     WriteToConsole('Init SDL_mixer... ');
     if SDLCheck(Mix_Init(MIX_INIT_OGG) <> 0, 'Mix_Init', true) then exit;
     WriteLnToConsole(msgOK);
 
+    // from uVariables to be used by other modules
+    cIsSoundEnabled:= true;
+
     Mix_AllocateChannels(Succ(chanTPU));
     previousVolume:= cInitVolume;
     ChangeVolume(cInitVolume);