summaryrefslogtreecommitdiff
path: root/indra/newview/llvieweraudio.cpp
diff options
context:
space:
mode:
authorgabriel lee <gabriel@lindenlab.com>2010-02-02 10:58:47 +0000
committergabriel lee <gabriel@lindenlab.com>2010-02-02 10:58:47 +0000
commit95d0df4ab05c4cfcc78f684ab28d36b9cc84410e (patch)
treeb1621cd22044edade98019af9d1b77383e3b88ef /indra/newview/llvieweraudio.cpp
parent5dfdb0d5a41143512180390193ce79644bcb9469 (diff)
parent4ad357ec70e15afdfe78816990cb23c7ba17619c (diff)
merged back my last changes
Diffstat (limited to 'indra/newview/llvieweraudio.cpp')
-rw-r--r--indra/newview/llvieweraudio.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index 38103f9e41..934981b0ad 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -242,10 +242,29 @@ void audio_update_wind(bool force_update)
// outside the fade-in.
F32 master_volume = gSavedSettings.getBOOL("MuteAudio") ? 0.f : gSavedSettings.getF32("AudioLevelMaster");
F32 ambient_volume = gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient");
+ F32 max_wind_volume = master_volume * ambient_volume;
- F32 wind_volume = master_volume * ambient_volume;
- gAudiop->mMaxWindGain = wind_volume;
-
+ const F32 WIND_SOUND_TRANSITION_TIME = 2.f;
+ // amount to change volume this frame
+ F32 volume_delta = (LLFrameTimer::getFrameDeltaTimeF32() / WIND_SOUND_TRANSITION_TIME) * max_wind_volume;
+ if (force_update)
+ {
+ // initialize wind volume (force_update) by using large volume_delta
+ // which is sufficient to completely turn off or turn on wind noise
+ volume_delta = max_wind_volume;
+ }
+
+ // mute wind when not flying
+ if (gAgent.getFlying())
+ {
+ // volume increases by volume_delta, up to no more than max_wind_volume
+ gAudiop->mMaxWindGain = llmin(gAudiop->mMaxWindGain + volume_delta, max_wind_volume);
+ }
+ else
+ {
+ // volume decreases by volume_delta, down to no less than 0
+ gAudiop->mMaxWindGain = llmax(gAudiop->mMaxWindGain - volume_delta, 0.f);
+ }
last_camera_water_height = camera_water_height;
gAudiop->updateWind(gRelativeWindVec, camera_water_height);