Commits

leyla_linden  committed bae3fe9

Media sound attentuation first pass
reviewed by Richard

  • Participants
  • Parent commits 3b96e8f

Comments (0)

Files changed (2)

File indra/newview/app_settings/settings.xml

         <key>Value</key>
             <real>1.0</real>
         </map>
-    <key>RecentItemsSortOrder</key>
+  <key>MediaRollOffFactor</key>
+  <map>
+    <key>Comment</key>
+    <string>Multiplier to change rate of media attenuation</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>F32</string>
+    <key>Value</key>
+    <real>10.0</real>
+  </map>
+  <key>RecentItemsSortOrder</key>
     <map>
       <key>Comment</key>
       <string>Specifies sort key for recent inventory items (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top)</string>

File indra/newview/llviewermedia.cpp

 {
 	if(mMediaSource)
 	{
-		mMediaSource->setVolume(mRequestedVolume * LLViewerMedia::getVolume());
+		F32 attenuation_multiplier = 1.0;
+
+		if (mProximityDistance > 0)
+		{
+			// the attenuation multiplier should never be more than one since that would increase volume
+			attenuation_multiplier = llmin(1.0, gSavedSettings.getF32("MediaRollOffFactor")/mProximityDistance);
+		}
+
+		mMediaSource->setVolume(mRequestedVolume * LLViewerMedia::getVolume() * attenuation_multiplier);
 	}
 }
 
 	}
 	else
 	{
+		updateVolume();
+
 		// If we didn't just create the impl, it may need to get cookie updates.
 		if(!sUpdatedCookies.empty())
 		{