aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoropensim mirror account2010-11-05 07:40:06 -0700
committeropensim mirror account2010-11-05 07:40:06 -0700
commit3711f956a60dcc626003f6f250e4c1bfc34e4063 (patch)
tree892e6b737c4975fef0a32e632b0a46d8ad73da40
parentMerge branch 'master' of /var/git/opensim/ (diff)
parentFix playing sound from HUDs (diff)
downloadopensim-SC-3711f956a60dcc626003f6f250e4c1bfc34e4063.zip
opensim-SC-3711f956a60dcc626003f6f250e4c1bfc34e4063.tar.gz
opensim-SC-3711f956a60dcc626003f6f250e4c1bfc34e4063.tar.bz2
opensim-SC-3711f956a60dcc626003f6f250e4c1bfc34e4063.tar.xz
Merge branch 'master' of /var/git/opensim/
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs1
2 files changed, 35 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index a52fea4..8df645d 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -31,12 +31,14 @@ using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using System.Reflection;
35using log4net;
34 36
35namespace OpenSim.Region.CoreModules.World.Sound 37namespace OpenSim.Region.CoreModules.World.Sound
36{ 38{
37 public class SoundModule : IRegionModule, ISoundModule 39 public class SoundModule : IRegionModule, ISoundModule
38 { 40 {
39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 42
41 protected Scene m_scene; 43 protected Scene m_scene;
42 44
@@ -62,6 +64,12 @@ namespace OpenSim.Region.CoreModules.World.Sound
62 public virtual void PlayAttachedSound( 64 public virtual void PlayAttachedSound(
63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) 65 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
64 { 66 {
67 SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
68 if (part == null)
69 return;
70
71 SceneObjectGroup grp = part.ParentGroup;
72
65 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 73 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
66 { 74 {
67 if (sp.IsChildAgent) 75 if (sp.IsChildAgent)
@@ -71,12 +79,25 @@ namespace OpenSim.Region.CoreModules.World.Sound
71 if (dis > 100.0) // Max audio distance 79 if (dis > 100.0) // Max audio distance
72 return; 80 return;
73 81
82 if (grp.IsAttachment)
83 {
84 if (grp.GetAttachmentPoint() > 30) // HUD
85 {
86 if (sp.ControllingClient.AgentId != grp.OwnerID)
87 return;
88 }
89
90 if (sp.ControllingClient.AgentId == grp.OwnerID)
91 dis = 0;
92 }
93
74 // Scale by distance 94 // Scale by distance
75 if (radius == 0) 95 if (radius == 0)
76 gain = (float)((double)gain * ((100.0 - dis) / 100.0)); 96 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
77 else 97 else
78 gain = (float)((double)gain * ((radius - dis) / radius)); 98 gain = (float)((double)gain * ((radius - dis) / radius));
79 99
100 m_log.DebugFormat("Play sound, gain {0}", gain);
80 sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); 101 sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
81 }); 102 });
82 } 103 }
@@ -84,6 +105,18 @@ namespace OpenSim.Region.CoreModules.World.Sound
84 public virtual void TriggerSound( 105 public virtual void TriggerSound(
85 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) 106 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
86 { 107 {
108 SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
109 if (part == null)
110 return;
111
112 SceneObjectGroup grp = part.ParentGroup;
113
114 if (grp.IsAttachment && grp.GetAttachmentPoint() > 30)
115 {
116 objectID = ownerID;
117 parentID = ownerID;
118 }
119
87 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 120 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
88 { 121 {
89 if (sp.IsChildAgent) 122 if (sp.IsChildAgent)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 7a6449d..f164201 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3100,6 +3100,7 @@ namespace OpenSim.Region.Framework.Scenes
3100 UUID ownerID = _ownerID; 3100 UUID ownerID = _ownerID;
3101 UUID objectID = ParentGroup.RootPart.UUID; 3101 UUID objectID = ParentGroup.RootPart.UUID;
3102 UUID parentID = GetRootPartUUID(); 3102 UUID parentID = GetRootPartUUID();
3103
3103 UUID soundID = UUID.Zero; 3104 UUID soundID = UUID.Zero;
3104 Vector3 position = AbsolutePosition; // region local 3105 Vector3 position = AbsolutePosition; // region local
3105 ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; 3106 ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle;