X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSound%2Ffg_fx.cxx;h=42b622108aa4f060c09130e78a66304ded142c96;hb=bcea720db3e29a62626b361f2149a7147e149f3b;hp=be9378c73d19441d60eb5acd876b3d0ce3c3391e;hpb=21d50b11f5152e3fe76068eb693a3fa41c66efdd;p=flightgear.git diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index be9378c73..42b622108 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -32,6 +32,7 @@ #include "fg_fx.hxx" #include
+#include
#include #include @@ -39,7 +40,7 @@ #include #include -FGFX::FGFX ( SGSoundMgr *smgr, const std::string &refname, SGPropertyNode *props ) : +FGFX::FGFX ( const std::string &refname, SGPropertyNode *props ) : _props( props ) { if (!props) { @@ -60,6 +61,11 @@ FGFX::FGFX ( SGSoundMgr *smgr, const std::string &refname, SGPropertyNode *props _avionics_ext = _props->getNode("sim/sound/avionics/external-view", true); _internal = _props->getNode("sim/current-view/internal", true); + SGSoundMgr *smgr = globals->get_soundmgr(); + if (!smgr) { + return; + } + SGSampleGroup::_smgr = smgr; SGSampleGroup::_refname = refname; SGSampleGroup::_smgr->add(this, refname); @@ -84,6 +90,10 @@ FGFX::~FGFX () void FGFX::init() { + if (!_smgr) { + return; + } + SGPropertyNode *node = _props->getNode("sim/sound", true); std::string path_str = node->getStringValue("path"); @@ -143,6 +153,10 @@ FGFX::reinit() void FGFX::update (double dt) { + if (!_smgr) { + return; + } + if ( _enabled->getBoolValue() ) { if ( _avionics_enabled->getBoolValue()) {