diff options
author | Melanie | 2010-11-05 13:45:28 +0000 |
---|---|---|
committer | Melanie | 2010-11-05 13:45:28 +0000 |
commit | 644eb9fd7f87637727d4789fa331accbffce931e (patch) | |
tree | 892e6b737c4975fef0a32e632b0a46d8ad73da40 /OpenSim | |
parent | Fix attached sounds from HUDs erroneously being delivered to other avatars (diff) | |
download | opensim-SC-644eb9fd7f87637727d4789fa331accbffce931e.zip opensim-SC-644eb9fd7f87637727d4789fa331accbffce931e.tar.gz opensim-SC-644eb9fd7f87637727d4789fa331accbffce931e.tar.bz2 opensim-SC-644eb9fd7f87637727d4789fa331accbffce931e.tar.xz |
Fix playing sound from HUDs
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index e77062b..8df645d 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | |||
@@ -31,12 +31,14 @@ using OpenMetaverse; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Interfaces; | 32 | using OpenSim.Region.Framework.Interfaces; |
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using System.Reflection; | ||
35 | using log4net; | ||
34 | 36 | ||
35 | namespace OpenSim.Region.CoreModules.World.Sound | 37 | namespace 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 | ||
@@ -79,7 +81,6 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
79 | 81 | ||
80 | if (grp.IsAttachment) | 82 | if (grp.IsAttachment) |
81 | { | 83 | { |
82 | |||
83 | if (grp.GetAttachmentPoint() > 30) // HUD | 84 | if (grp.GetAttachmentPoint() > 30) // HUD |
84 | { | 85 | { |
85 | if (sp.ControllingClient.AgentId != grp.OwnerID) | 86 | if (sp.ControllingClient.AgentId != grp.OwnerID) |
@@ -96,6 +97,7 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
96 | else | 97 | else |
97 | gain = (float)((double)gain * ((radius - dis) / radius)); | 98 | gain = (float)((double)gain * ((radius - dis) / radius)); |
98 | 99 | ||
100 | m_log.DebugFormat("Play sound, gain {0}", gain); | ||
99 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); | 101 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); |
100 | }); | 102 | }); |
101 | } | 103 | } |
@@ -103,6 +105,18 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
103 | public virtual void TriggerSound( | 105 | public virtual void TriggerSound( |
104 | 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) |
105 | { | 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 | |||
106 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 120 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
107 | { | 121 | { |
108 | 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; |