X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSound%2Ffg_fx.cxx;h=abf3a2678668dbb997b896c3010f629b5266e15d;hb=2bc7dc685b35b489730ef36050a318b331c14977;hp=934ec5c1aa49baa21580d1a1205369423003c4b8;hpb=b582c118bd6bba58a32d75d2d8ef45b612b231d3;p=flightgear.git diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index 934ec5c1a..abf3a2678 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -39,7 +39,7 @@ #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") ) @@ -47,7 +47,7 @@ FGFX::FGFX ( SGSoundMgr *smgr, const string &refname ) : SGSampleGroup::_smgr = smgr; SGSampleGroup::_refname = refname; SGSampleGroup::_smgr->add(this, refname); - SGSampleGroup::_active = _smgr->is_working(); + _avionics = _smgr->find("avionics", true); } @@ -92,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 ) { @@ -115,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 ) { @@ -126,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