summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/settings.xml26
-rw-r--r--indra/newview/llviewermedia.cpp19
2 files changed, 33 insertions, 12 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 6f11a6d616..266ed2b5fd 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5838,7 +5838,7 @@
<key>Value</key>
<real>1.0</real>
</map>
- <key>MediaRollOffFactor</key>
+ <key>MediaRollOffRate</key>
<map>
<key>Comment</key>
<string>Multiplier to change rate of media attenuation</string>
@@ -5847,7 +5847,29 @@
<key>Type</key>
<string>F32</string>
<key>Value</key>
- <real>10.0</real>
+ <real>0.2</real>
+ </map>
+ <key>MediaRollOffMin</key>
+ <map>
+ <key>Comment</key>
+ <string>Adjusts the distance at which media attentuation starts</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>7.0</real>
+ </map>
+ <key>MediaRollOffMax</key>
+ <map>
+ <key>Comment</key>
+ <string>Distance at which media volume is set to 0</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>30.0</real>
</map>
<key>RecentItemsSortOrder</key>
<map>
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index c8f3374f38..076a9609e3 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1918,22 +1918,21 @@ void LLViewerMediaImpl::updateVolume()
// always scale the volume by the global media volume
F32 volume = mRequestedVolume * LLViewerMedia::getVolume();
- // attenuate if this is not parcel media
- if (!mIsParcelMedia)
+ if (mProximityCamera > 0)
{
- if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMaxDistance"))
+ if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMax"))
{
volume = 0;
}
- else
+ else if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMin"))
{
- // attenuated volume = volume * roll_off rate / distance^2
- // adjust distance by saved setting so we can tune the distance at which attenuation begins
- // the actual start distance is sqrt(MediaRollOffMaxDistance)+MediaRollOffStartAdjustment
- F64 adjusted_distance = mProximityCamera - gSavedSettings.getF32("MediaRollOffStart");
-
+ // attenuated_volume = v / ( 1 + (roll_off_rate * (d - min))^2
+ // the +1 is there so that for distance 0 the volume stays the same
+ F64 adjusted_distance = mProximityCamera - gSavedSettings.getF32("MediaRollOffMin");
+ F64 attenuation = gSavedSettings.getF32("MediaRollOffRate") * adjusted_distance;
+ attenuation = attenuation * attenuation;
// the attenuation multiplier should never be more than one since that would increase volume
- volume = volume * llmin(1.0, gSavedSettings.getF32("MediaRollOffRate")/adjusted_distance*adjusted_distance);
+ volume = volume * llmin(1.0, 1 /(attenuation + 1));
}
}