X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSound%2Ffg_fx.cxx;h=abf3a2678668dbb997b896c3010f629b5266e15d;hb=2bc7dc685b35b489730ef36050a318b331c14977;hp=6e06fa403830ef91b14ff2d93e903bff41a76400;hpb=33e816abb938b45baf148748a34ac9cef573ce04;p=flightgear.git diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index 6e06fa403..abf3a2678 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -39,14 +39,15 @@ #include FGFX::FGFX ( SGSoundMgr *smgr, const string &refname ) : - last_pause( true ), + last_pause( false ), last_volume( 0.0 ), _pause( fgGetNode("/sim/sound/pause") ), _volume( fgGetNode("/sim/sound/volume") ) { SGSampleGroup::_smgr = smgr; + SGSampleGroup::_refname = refname; SGSampleGroup::_smgr->add(this, refname); - SGSampleGroup::_active = _smgr->is_working(); + _avionics = _smgr->find("avionics", true); } @@ -91,7 +92,7 @@ FGFX::init() try { sound->init(globals->get_props(), node->getChild(i), this, - globals->get_fg_root()); + _avionics, globals->get_fg_root()); _sound.push_back(sound); } catch ( sg_exception &e ) { @@ -114,7 +115,6 @@ FGFX::reinit() void FGFX::update (double dt) { - // command sound manger bool new_pause = _pause->getBoolValue(); if ( new_pause != last_pause ) { if ( new_pause ) { @@ -125,20 +125,20 @@ FGFX::update (double dt) last_pause = new_pause; } - double volume = _volume->getDoubleValue(); - if ( volume != last_volume ) { - set_volume( volume ); - last_volume = volume; - } - if ( !new_pause ) { + double volume = _volume->getDoubleValue(); + if ( volume != last_volume ) { + set_volume( volume ); + last_volume = volume; + } + // update sound effects if not paused for ( unsigned int i = 0; i < _sound.size(); i++ ) { _sound[i]->update(dt); } - } - SGSampleGroup::update(dt); + SGSampleGroup::update(dt); + } } // end of fg_fx.cxx