1
0
Fork 0

Minor tweaks to sound subsystem update rates.

This commit is contained in:
curt 2002-08-26 20:46:13 +00:00
parent 3976a6d55c
commit 25c4d9b620
4 changed files with 9 additions and 27 deletions

View 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

View 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;
}

View 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;

View file

@ -114,7 +114,6 @@ class FGSoundMgr : public FGSubsystem
sound_map sounds;
sample_map samples;
SGTimeStamp last;
double safety;
public: