From 25c4d9b6202be1a116787ec4e228f3c5c8a6587d Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 26 Aug 2002 20:46:13 +0000 Subject: [PATCH] Minor tweaks to sound subsystem update rates. --- src/Main/main.cxx | 13 ++----------- src/Scenery/newcache.cxx | 6 +++--- src/Sound/soundmgr.cxx | 16 ++++------------ src/Sound/soundmgr.hxx | 1 - 4 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 2e1df4a68..508398564 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -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 diff --git a/src/Scenery/newcache.cxx b/src/Scenery/newcache.cxx index 5b822595a..5b3c31492 100644 --- a/src/Scenery/newcache.cxx +++ b/src/Scenery/newcache.cxx @@ -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; } diff --git a/src/Sound/soundmgr.cxx b/src/Sound/soundmgr.cxx index 2b7e25576..7faa4be4a 100644 --- a/src/Sound/soundmgr.cxx +++ b/src/Sound/soundmgr.cxx @@ -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; diff --git a/src/Sound/soundmgr.hxx b/src/Sound/soundmgr.hxx index d9e9dd8fb..3e89b225b 100644 --- a/src/Sound/soundmgr.hxx +++ b/src/Sound/soundmgr.hxx @@ -114,7 +114,6 @@ class FGSoundMgr : public FGSubsystem sound_map sounds; sample_map samples; - SGTimeStamp last; double safety; public: -- 2.39.5