diff options
author | Justin Clarke Casey | 2008-12-23 17:54:13 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-12-23 17:54:13 +0000 |
commit | cce1b096dbd8aba46c405b7654d67d3ba96de33a (patch) | |
tree | ae8208af8343d8d82df1343038855e1d3c91eba0 /OpenSim/Region/Environment/Modules/World | |
parent | * Add a method to allow friendship offers to a logged in client from an offli... (diff) | |
download | opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.zip opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.gz opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.bz2 opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.xz |
* refactor: Replace part of SceneObjectPart with the identical sound playing code in the SoundModule
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
-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 | } |