diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Sound')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs b/OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs index 7c89466..4547480 100644 --- a/OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs | |||
@@ -61,20 +61,37 @@ namespace OpenSim.Region.Environment.World.Sound | |||
61 | client.OnSoundTrigger += TriggerSound; | 61 | client.OnSoundTrigger += TriggerSound; |
62 | } | 62 | } |
63 | 63 | ||
64 | public virtual void PlayAttachedSound( | ||
65 | UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags) | ||
66 | { | ||
67 | foreach (ScenePresence p in m_scene.GetAvatars()) | ||
68 | { | ||
69 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); | ||
70 | if (dis > 100.0) // Max audio distance | ||
71 | continue; | ||
72 | |||
73 | // Scale by distance | ||
74 | gain = (float)((double)gain*((100.0 - dis) / 100.0)); | ||
75 | |||
76 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); | ||
77 | } | ||
78 | } | ||
79 | |||
64 | public virtual void TriggerSound( | 80 | public virtual void TriggerSound( |
65 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, float gain, Vector3 position, UInt64 handle) | 81 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) |
66 | { | 82 | { |
67 | foreach (ScenePresence p in m_scene.GetAvatars()) | 83 | foreach (ScenePresence p in m_scene.GetAvatars()) |
68 | { | 84 | { |
69 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); | 85 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); |
70 | if (dis > 100.0) // Max audio distance | 86 | if (dis > 100.0) // Max audio distance |
71 | continue; | 87 | continue; |
72 | 88 | ||
73 | // Scale by distance | 89 | // Scale by distance |
74 | gain = (float)((double)gain*((100.0 - dis) / 100.0)); | 90 | gain = (float)((double)gain*((100.0 - dis) / 100.0)); |
91 | |||
75 | p.ControllingClient.SendTriggeredSound( | 92 | p.ControllingClient.SendTriggeredSound( |
76 | soundId, ownerID, objectID, parentID, handle, position, (float)gain); | 93 | soundId, ownerID, objectID, parentID, handle, position, (float)gain); |
77 | } | 94 | } |
78 | } | 95 | } |
79 | } | 96 | } |
80 | } | 97 | } |