]> git.mxchange.org Git - flightgear.git/commitdiff
Erik Hofman:
authorcurt <curt>
Mon, 30 Sep 2002 18:45:09 +0000 (18:45 +0000)
committercurt <curt>
Mon, 30 Sep 2002 18:45:09 +0000 (18:45 +0000)
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".

src/Sound/fg_sound.cxx

index bcd95d824dbfc6495f943ae618d348c328f8c1a0..b11ba15903d9c4cbb2489c1a2e38cbb203951cca 100644 (file)
@@ -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