aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Sound/SoundModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 37f1f2e..1f5a4ff 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
60 } 60 }
61 61
62 public virtual void PlayAttachedSound( 62 public virtual void PlayAttachedSound(
63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags) 63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
64 { 64 {
65 foreach (ScenePresence p in m_scene.GetAvatars()) 65 foreach (ScenePresence p in m_scene.GetAvatars())
66 { 66 {
@@ -69,14 +69,17 @@ namespace OpenSim.Region.CoreModules.World.Sound
69 continue; 69 continue;
70 70
71 // Scale by distance 71 // Scale by distance
72 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 72 if (radius == 0)
73 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
74 else
75 gain = (float)((double)gain * ((radius - dis) / radius));
73 76
74 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); 77 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
75 } 78 }
76 } 79 }
77 80
78 public virtual void TriggerSound( 81 public virtual void TriggerSound(
79 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) 82 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
80 { 83 {
81 foreach (ScenePresence p in m_scene.GetAvatars()) 84 foreach (ScenePresence p in m_scene.GetAvatars())
82 { 85 {
@@ -85,7 +88,10 @@ namespace OpenSim.Region.CoreModules.World.Sound
85 continue; 88 continue;
86 89
87 // Scale by distance 90 // Scale by distance
88 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 91 if (radius == 0)
92 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
93 else
94 gain = (float)((double)gain * ((radius - dis) / radius));
89 95
90 p.ControllingClient.SendTriggeredSound( 96 p.ControllingClient.SendTriggeredSound(
91 soundId, ownerID, objectID, parentID, handle, position, (float)gain); 97 soundId, ownerID, objectID, parentID, handle, position, (float)gain);