Brought in EXT-1399 (relates to wind sounds)
Modified EXT-1399 to allow falling from the sky wind. When one drops from great heights, they hear the wind rush past their ears.
This commit is contained in:
@@ -1767,6 +1767,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>0.5</real>
|
<real>0.5</real>
|
||||||
</map>
|
</map>
|
||||||
|
<key>AudioLevelWind</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Audio level of wind noise when standing still</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>F32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<real>0.5</real>
|
||||||
|
</map>
|
||||||
<key>AudioStreamingMusic</key>
|
<key>AudioStreamingMusic</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "llviewercamera.h"
|
#include "llviewercamera.h"
|
||||||
#include "llviewercontrol.h"
|
#include "llviewercontrol.h"
|
||||||
#include "llviewerwindow.h"
|
#include "llviewerwindow.h"
|
||||||
|
#include "llvoavatarself.h" //For mInAir
|
||||||
#include "llvoiceclient.h"
|
#include "llvoiceclient.h"
|
||||||
#include "llviewermedia.h"
|
#include "llviewermedia.h"
|
||||||
|
|
||||||
@@ -239,24 +240,49 @@ void audio_update_wind(bool force_update)
|
|||||||
gAudiop->setRolloffFactor(audio_level_rolloff);
|
gAudiop->setRolloffFactor(audio_level_rolloff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this line rotates the wind vector to be listener (agent) relative
|
|
||||||
// unfortunately we have to pre-translate to undo the translation that
|
// Scale down the contribution of weather-simulation wind to the
|
||||||
// occurs in the transform call
|
// ambient wind noise. Wind velocity averages 3.5 m/s, with gusts to 7 m/s
|
||||||
gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal(gWindVec - gAgent.getVelocity());
|
// whereas steady-state avatar walk velocity is only 3.2 m/s.
|
||||||
|
// Without this the world feels desolate on first login when you are
|
||||||
|
// standing still.
|
||||||
|
static LLCachedControl<F32> wind_level("AudioLevelWind", 0.5f);
|
||||||
|
LLVector3 scaled_wind_vec = gWindVec * wind_level;
|
||||||
|
|
||||||
|
// Mix in the avatar's motion, subtract because when you walk north,
|
||||||
|
// the apparent wind moves south.
|
||||||
|
LLVector3 final_wind_vec = scaled_wind_vec - gAgent.getVelocity();
|
||||||
|
// rotate the wind vector to be listener (agent) relative
|
||||||
|
gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal(final_wind_vec);
|
||||||
|
|
||||||
// don't use the setter setMaxWindGain() because we don't
|
// don't use the setter setMaxWindGain() because we don't
|
||||||
// want to screw up the fade-in on startup by setting actual source gain
|
// want to screw up the fade-in on startup by setting actual source gain
|
||||||
// outside the fade-in.
|
// outside the fade-in.
|
||||||
static const LLCachedControl<bool> mute_audio("MuteAudio",false);
|
F32 master_volume = gSavedSettings.getBOOL("MuteAudio") ? 0.f : gSavedSettings.getF32("AudioLevelMaster");
|
||||||
static const LLCachedControl<bool> mute_ambient("MuteAmbient",false);
|
F32 ambient_volume = gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient");
|
||||||
static const LLCachedControl<F32> audio_level_master("AudioLevelMaster", 1.0f);
|
F32 max_wind_volume = master_volume * ambient_volume;
|
||||||
static const LLCachedControl<F32> audio_level_ambient("AudioLevelAmbient",1.0f);
|
|
||||||
F32 master_volume = mute_audio ? 0.f : (F32)audio_level_master;
|
|
||||||
F32 ambient_volume = mute_ambient ? 0.f : (F32)audio_level_ambient;
|
|
||||||
|
|
||||||
F32 wind_volume = master_volume * ambient_volume;
|
const F32 WIND_SOUND_TRANSITION_TIME = 2.f;
|
||||||
gAudiop->mMaxWindGain = wind_volume;
|
// 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 = 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mute wind when not /*flying*/ in air
|
||||||
|
if /*(gAgent.getFlying())*/ (gAgentAvatarp && gAgentAvatarp->mInAir)
|
||||||
|
{
|
||||||
|
// 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;
|
last_camera_water_height = camera_water_height;
|
||||||
gAudiop->updateWind(gRelativeWindVec, camera_water_height);
|
gAudiop->updateWind(gRelativeWindVec, camera_water_height);
|
||||||
|
|||||||
Reference in New Issue
Block a user