diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index 6b4f92d89..c5fa6ae5e 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -33,11 +33,11 @@ #include
#include
+#include #include #include #include -#include #include FGFX::FGFX ( const std::string &refname, SGPropertyNode *props ) : @@ -61,10 +61,11 @@ FGFX::FGFX ( const std::string &refname, SGPropertyNode *props ) : _avionics_ext = _props->getNode("sim/sound/avionics/external-view", true); _internal = _props->getNode("sim/current-view/internal", true); - _smgr = globals->get_subsystem(); + _smgr = globals->get_subsystem(); if (!_smgr) { return; } + _active = _smgr->is_active(); _refname = refname; _smgr->add(this, refname); @@ -162,6 +163,15 @@ FGFX::update (double dt) if (!_smgr) { return; } + + if (!_active && _smgr->is_active()) + { + _active = true; + for ( unsigned int i = 0; i < _sound.size(); i++ ) { + _sound[i]->start(); + } + } + if ( _enabled->getBoolValue() ) { if ( _avionics_enabled->getBoolValue()) diff --git a/src/Sound/fg_fx.hxx b/src/Sound/fg_fx.hxx index 798d07cef..36c738215 100644 --- a/src/Sound/fg_fx.hxx +++ b/src/Sound/fg_fx.hxx @@ -59,6 +59,7 @@ public: private: + bool _active; bool _is_aimodel; SGSharedPtr _avionics; std::vector _sound;