1
0
Fork 0

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

This commit is contained in:
ehofman 2009-10-05 13:47:03 +00:00 committed by Tim Moore
parent 446b200edc
commit b64259b295
3 changed files with 7 additions and 8 deletions

View file

@ -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

View 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

View 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 },