]> git.mxchange.org Git - flightgear.git/commitdiff
allow disabling sound completely (note: openal gets initialized but shuts down a...
authorehofman <ehofman>
Mon, 5 Oct 2009 13:47:03 +0000 (13:47 +0000)
committerTim Moore <timoore@redhat.com>
Tue, 6 Oct 2009 08:23:15 +0000 (10:23 +0200)
src/Main/fg_init.cxx
src/Main/main.cxx
src/Main/options.cxx

index 92d32a1caaf2bc5911bba51edf6b6923574c43db..a78759c42f1a0c2384951f1b1293081f0d987c46 100644 (file)
 using std::string;
 
 extern const char *default_root;
-float init_volume;
 
 
 // Scan the command line options for the specified option and return
index 390aeb3b8693679db738e19be624e2eee7acd9a4..91e1542dbe3a323eb307d0ffcd0f2505e018c5be 100644 (file)
@@ -87,7 +87,6 @@
 
 static double real_delta_time_sec = 0.0;
 double delta_time_sec = 0.0;
-extern float init_volume;
 
 using namespace flightgear;
 
@@ -492,9 +491,11 @@ static void fgMainLoop( void ) {
     if (!scenery_loaded && globals->get_tile_mgr()->isSceneryLoaded()
         && cur_fdm_state->get_inited()) {
         fgSetBool("sim/sceneryloaded",true);
-        fgSetFloat("/sim/sound/volume", init_volume);
 #ifdef ENABLE_AUDIO_SUPPORT
-        smgr->set_volume(init_volume);
+        if (fgGetBool("/sim/sound/enabled") == false)
+            smgr->stop();
+        else 
+            smgr->set_volume(fgGetFloat("/sim/sound/volume"));
 #endif
     }
 
@@ -638,8 +639,6 @@ static void fgIdleFunction ( void ) {
         // Add the Sound Manager before any other subsystem that uses it.
         // This makes sure the SoundMgr is available at construction time.
         ////////////////////////////////////////////////////////////////////
-        init_volume = fgGetFloat("/sim/sound/volume");
-        fgSetFloat("/sim/sound/volume", 0.0f);
         globals->add_subsystem("soundmgr", new SGSoundMgr);
 #endif
 
index ad17068e682f48494c07c76a0aa5a11ab0b83697..73ebf0627d28e853162c7be7eb7e0fc19163606a 100644 (file)
@@ -186,6 +186,7 @@ fgSetDefaults ()
     fgSetBool("/sim/hud/enable3d", true);
     fgSetBool("/sim/hud/visibility", false);
     fgSetBool("/sim/panel/visibility", true);
+    fgSetBool("/sim/sound/enabled", true);
     fgSetBool("/sim/sound/pause", false);
 
                                // Flight Model options
@@ -1290,8 +1291,8 @@ struct OptionDesc {
     {"enable-hud",                   false, OPTION_BOOL,   "/sim/hud/visibility", true, "", 0 },
     {"disable-panel",                false, OPTION_BOOL,   "/sim/panel/visibility", false, "", 0 },
     {"enable-panel",                 false, OPTION_BOOL,   "/sim/panel/visibility", true, "", 0 },
-    {"disable-sound",                false, OPTION_BOOL,   "/sim/sound/pause", true, "", 0 },
-    {"enable-sound",                 false, OPTION_BOOL,   "/sim/sound/pause", false, "", 0 },
+    {"disable-sound",                false, OPTION_BOOL,   "/sim/sound/enabled", true, "", 0 },
+    {"enable-sound",                 false, OPTION_BOOL,   "/sim/sound/enabled", false, "", 0 },
     {"airport",                      true,  OPTION_STRING, "/sim/presets/airport-id", false, "", 0 },
     {"runway",                       true,  OPTION_FUNC,   "", false, "", fgOptRunway },
     {"vor",                          true,  OPTION_FUNC,   "", false, "", fgOptVOR },