aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-31 22:52:17 +0100
committerJustin Clark-Casey (justincc)2012-07-31 22:52:17 +0100
commitd89faa3c16833a78bb6af3defa5c7bf272b55e1c (patch)
treeb050e6ed57a4dfa83f135a791ceeed6f92e2e111 /OpenSim/Region/CoreModules/World
parentAdds support to ScriptModuleComms for region modules to export (diff)
downloadopensim-SC_OLD-d89faa3c16833a78bb6af3defa5c7bf272b55e1c.zip
opensim-SC_OLD-d89faa3c16833a78bb6af3defa5c7bf272b55e1c.tar.gz
opensim-SC_OLD-d89faa3c16833a78bb6af3defa5c7bf272b55e1c.tar.bz2
opensim-SC_OLD-d89faa3c16833a78bb6af3defa5c7bf272b55e1c.tar.xz
Fix bug in SoundModule.TriggerSound() where every sound update to an avatar would base its gain calculation on the previous avatar's gain, instead of the original input gain.
This was making sound attenuate oddly when there were NPCs in the region, though it could also happen with ordinary avatars.
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index d768a1a..14c1a39 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -119,17 +119,20 @@ namespace OpenSim.Region.CoreModules.World.Sound
119 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) 119 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
120 { 120 {
121 double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); 121 double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
122
122 if (dis > 100.0) // Max audio distance 123 if (dis > 100.0) // Max audio distance
123 return; 124 return;
124 125
126 float thisSpGain;
127
125 // Scale by distance 128 // Scale by distance
126 if (radius == 0) 129 if (radius == 0)
127 gain = (float)((double)gain * ((100.0 - dis) / 100.0)); 130 thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0));
128 else 131 else
129 gain = (float)((double)gain * ((radius - dis) / radius)); 132 thisSpGain = (float)((double)gain * ((radius - dis) / radius));
130 133
131 sp.ControllingClient.SendTriggeredSound( 134 sp.ControllingClient.SendTriggeredSound(
132 soundId, ownerID, objectID, parentID, handle, position, (float)gain); 135 soundId, ownerID, objectID, parentID, handle, position, thisSpGain);
133 }); 136 });
134 } 137 }
135 } 138 }