From: ehofman Date: Mon, 5 Oct 2009 13:47:03 +0000 (+0000) Subject: allow disabling sound completely (note: openal gets initialized but shuts down a... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b64259b2950d6bf0e6572e3362b6ee109104192e;p=flightgear.git allow disabling sound completely (note: openal gets initialized but shuts down a bit later leaving the soundmanager to handle only very specific commands). At this time by specifying '--prop:/sim/sound/enabled=false', not sure why '--disable-sound' doesn't work properly --- diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 92d32a1ca..a78759c42 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -134,7 +134,6 @@ using std::string; extern const char *default_root; -float init_volume; // Scan the command line options for the specified option and return diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 390aeb3b8..91e1542db 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -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 diff --git a/src/Main/options.cxx b/src/Main/options.cxx index ad17068e6..73ebf0627 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -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 },