From: curt Date: Mon, 30 Sep 2002 18:45:09 +0000 (+0000) Subject: Erik Hofman: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1604c9bae2f6d20b42e8ee3c42e19861c3a99dbb;p=flightgear.git Erik Hofman: This is a small patch which resets the delay counter if the sound doesn't need to be stopped. Also the code is reorganiozed a bit to fix sume "bugs". --- diff --git a/src/Sound/fg_sound.cxx b/src/Sound/fg_sound.cxx index bcd95d824..b11ba1590 100644 --- a/src/Sound/fg_sound.cxx +++ b/src/Sound/fg_sound.cxx @@ -270,22 +270,22 @@ FGSound::update (double dt) ) { - if (_sample->is_playing()) { + if ((_mode != FGSound::IN_TRANSIT) || (_stopping < MAX_TRANSIT_TIME)) { - if ((_mode != FGSound::IN_TRANSIT) || (_stopping < MAX_TRANSIT_TIME)) { + if (_sample->is_playing()) { + SG_LOG(SG_GENERAL, SG_INFO, "Stopping audio after " << _dt_play + << " sec: " << _name ); - _active = false; _sample->stop( _mgr->get_scheduler() ); + } - SG_LOG(SG_GENERAL, SG_INFO, "Stopping audio after " << _dt_play - << " sec: " << _name ); + _active = false; + _dt_stop += dt; + _dt_play = 0.0; - } else - _stopping += dt; - } - _dt_stop += dt; - _dt_play = 0.0; + } else + _stopping += dt; return; @@ -308,10 +308,12 @@ FGSound::update (double dt) } // - // Update playing time and cache the current value. + // Update the playing time, cache the current value and + // clear the delay timer. // - _dt_play += dt; + _dt_play += dt; _prev_value = curr_value; + _stopping = 0.0; // // Update the volume