]> git.mxchange.org Git - flightgear.git/commitdiff
Minor tweaks to sound subsystem update rates.
authorcurt <curt>
Mon, 26 Aug 2002 20:46:13 +0000 (20:46 +0000)
committercurt <curt>
Mon, 26 Aug 2002 20:46:13 +0000 (20:46 +0000)
src/Main/main.cxx
src/Scenery/newcache.cxx
src/Sound/soundmgr.cxx
src/Sound/soundmgr.hxx

index 2e1df4a6890aa9b3133e9a9f75487ebe3ab42f01..508398564b61743f0c31839429d3f6204bb3c115 100644 (file)
@@ -1087,17 +1087,8 @@ static void fgMainLoop( void ) {
 #ifdef ENABLE_AUDIO_SUPPORT
     if ( fgGetBool("/sim/sound/audible")
            && globals->get_soundmgr()->is_working() ) {
-        static double dt = 0.0;
-        static double sound_update_rate = 0.05;
-
-        dt += delta_time_sec;
-
-       // Updating four times a second should be enough
-        if ( dt >= sound_update_rate ) {
-           globals->get_fx()->update( dt );
-           globals->get_soundmgr()->update( dt );
-            dt = 0.0;
-        }
+        globals->get_fx()->update( delta_time_sec );
+        globals->get_soundmgr()->update( delta_time_sec );
     }
 #endif
 
index 5b822595adf43cc76e0c4d0acdbdeb672b7c7445..5b3c3149232afafa7b39a5979dfafb10df87a0ad 100644 (file)
@@ -206,9 +206,9 @@ long FGNewCache::get_oldest_tile() {
         }
     }
 
-    SG_LOG( SG_TERRAIN, SG_INFO, "    min_time = " << min_time );
-    SG_LOG( SG_TERRAIN, SG_INFO, "    index = " << min_index );
-    SG_LOG( SG_TERRAIN, SG_INFO, "    max_time = " << max_time );
+    SG_LOG( SG_TERRAIN, SG_DEBUG, "    min_time = " << min_time );
+    SG_LOG( SG_TERRAIN, SG_DEBUG, "    index = " << min_index );
+    SG_LOG( SG_TERRAIN, SG_DEBUG, "    max_time = " << max_time );
 
     return min_index;
 }
index 2b7e25576c4dee1eb1686c4fe3eb14c3d7f2cfad..7faa4be4a78cd65159ed863b4f47d0b2cf285323 100644 (file)
@@ -146,7 +146,6 @@ FGSoundMgr::~FGSoundMgr() {
 
 // initialize the sound manager
 void FGSoundMgr::init() {
-    last.stamp();
     safety = FG_MAX_SOUND_SAFETY;
 
     // audio_mixer -> setMasterVolume ( 80 ) ;  /* 80% of max volume. */
@@ -191,18 +190,11 @@ void FGSoundMgr::unbind ()
 
 
 // run the audio scheduler
-void FGSoundMgr::update(double dt) {
-                               // FIXME: use dt supplied (seconds)
-    SGTimeStamp current;
-    current.stamp();
-
-    double elapsed = (double)(current - last) / 1000000.0;
-    last = current;
-
-    if ( elapsed > safety ) {
-       safety = elapsed;
+void FGSoundMgr::update( double dt ) {
+    if ( dt > safety ) {
+       safety = dt;
     } else {
-       safety = safety * 0.99 + elapsed * 0.01;
+       safety = safety * 0.99 + dt * 0.01;
     }
     if ( safety > FG_MAX_SOUND_SAFETY ) {
        safety = FG_MAX_SOUND_SAFETY;
index d9e9dd8fb6d4eb5eb3cc90ce7bb0bfb9c9a2b089..3e89b225bbc63a3ad70b5359580caa6602436946 100644 (file)
@@ -114,7 +114,6 @@ class FGSoundMgr : public FGSubsystem
     sound_map sounds;
     sample_map samples;
 
-    SGTimeStamp last;
     double safety;
 
 public: