diff --git a/src/Sound/soundmanager.cxx b/src/Sound/soundmanager.cxx index c3d6244d6..925c09910 100644 --- a/src/Sound/soundmanager.cxx +++ b/src/Sound/soundmanager.cxx @@ -59,7 +59,8 @@ void Listener::valueChanged(SGPropertyNode * node) } FGSoundManager::FGSoundManager() - : _is_initialized(false), + : _active_dt(0.0), + _is_initialized(false), _enabled(false), _listener(new Listener(this)) { @@ -189,7 +190,13 @@ void FGSoundManager::update(double dt) set_velocity( velocity ); - set_volume(_volume->getFloatValue()); + float vf = 1.0f; + if (_active_dt < 5.0) { + _active_dt += dt; + vf = std::min(std::pow(_active_dt*0.2, 5.0), 1.0); + } + + set_volume(vf*_volume->getFloatValue()); SGSoundMgr::update(dt); } } diff --git a/src/Sound/soundmanager.hxx b/src/Sound/soundmanager.hxx index 5ae177038..72324a72f 100644 --- a/src/Sound/soundmanager.hxx +++ b/src/Sound/soundmanager.hxx @@ -57,6 +57,7 @@ private: SGSharedPtr _chatterQueue; + double _active_dt; bool _is_initialized, _enabled; SGPropertyNode_ptr _sound_working, _sound_enabled, _volume, _device_name; SGPropertyNode_ptr _velocityNorthFPS, _velocityEastFPS, _velocityDownFPS;