From c97890ca69df91e6590ac7dd234a3e86cf7fbaf1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 29 Oct 2012 22:53:06 +0000 Subject: Add "force gc" region console command which manually invokes garbage collection. For debugging purposes. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b6d0a3b..aa82af4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -74,8 +74,9 @@ namespace OpenSim.Region.Framework.Scenes { // ~ScenePresence() // { -// m_log.Debug("[SCENE PRESENCE] Destructor called"); +// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); // } + private void TriggerScenePresenceUpdated() { if (m_scene != null) -- cgit v1.1 From 09f4e72d6af4b86238af516b1719ff4f63aa7174 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 29 Oct 2012 23:22:40 +0000 Subject: Fix memory leak where removing an NPC did not remove its circuits. This was because we were removing by circuitcode where NPCs have no code. Now removing by agent ID instead. This commit also fixes the "show circuits" console command to work properly where the circuit has no associated IP address. --- OpenSim/Region/Application/OpenSim.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++-- .../Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index b24641a..2236e43 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -1111,7 +1111,7 @@ namespace OpenSim aCircuit.Name, aCircuit.child ? "child" : "root", aCircuit.circuitcode.ToString(), - aCircuit.IPAddress.ToString(), + aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set", aCircuit.Viewer); }); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2cdc4b3..7d8cbf5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3384,9 +3384,10 @@ namespace OpenSim.Region.Framework.Scenes } else { - // We remove the acd up here to avoid later raec conditions if two RemoveClient() calls occurred + // We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred // simultaneously. - m_authenticateHandler.RemoveCircuit(acd.circuitcode); + // We also need to remove by agent ID since NPCs will have no circuit code. + m_authenticateHandler.RemoveCircuit(agentID); } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 9179966..52ed846 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -117,6 +117,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); + + IClientAPI client; + Assert.That(m_scene.TryGetClient(npcId, out client), Is.True); + + // Have to account for both SP and NPC. + Assert.That(m_scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(2)); } [Test] @@ -136,6 +142,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests ScenePresence deletedNpc = m_scene.GetScenePresence(npcId); Assert.That(deletedNpc, Is.Null); + IClientAPI client; + Assert.That(m_scene.TryGetClient(npcId, out client), Is.False); + + // Have to account for SP still present. + Assert.That(m_scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); } [Test] -- cgit v1.1 From 7560010f340e9e67e0fb87d0e3863ed69bdbedf1 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 4 Oct 2012 11:33:21 +0100 Subject: Immediately setting gain to zero as a workaround for code not stopping sound started by llPlaySound --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fa57845..bedcd85 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2452,6 +2452,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llStopSound() { m_host.AddScriptLPS(1); + m_host.AdjustSoundGain(0); if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) { if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) -- cgit v1.1 From ed162a10beaa8bcab1c51f03a51acf5a9537eaae Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 13:50:12 +0100 Subject: Converting the ISoundModule implementation from an IRegionModule to an INonSharedRegionModule --- .../Region/CoreModules/World/Sound/SoundModule.cs | 141 ---------------- .../World/Sound/SoundModuleNonShared.cs | 179 +++++++++++++++++++++ 2 files changed, 179 insertions(+), 141 deletions(-) delete mode 100644 OpenSim/Region/CoreModules/World/Sound/SoundModule.cs create mode 100644 OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs deleted file mode 100644 index a2f0950..0000000 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using System.Reflection; -using log4net; - -namespace OpenSim.Region.CoreModules.World.Sound -{ - public class SoundModule : IRegionModule, ISoundModule - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected Scene m_scene; - - public void Initialise(Scene scene, IConfigSource source) - { - m_scene = scene; - - m_scene.EventManager.OnNewClient += OnNewClient; - - m_scene.RegisterModuleInterface(this); - } - - public void PostInitialise() {} - public void Close() {} - public string Name { get { return "Sound Module"; } } - public bool IsSharedModule { get { return false; } } - - private void OnNewClient(IClientAPI client) - { - client.OnSoundTrigger += TriggerSound; - } - - public virtual void PlayAttachedSound( - UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) - { - SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); - if (part == null) - return; - - SceneObjectGroup grp = part.ParentGroup; - - m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) - { - double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); - if (dis > 100.0) // Max audio distance - return; - - if (grp.IsAttachment) - { - if (grp.HasPrivateAttachmentPoint && sp.ControllingClient.AgentId != grp.OwnerID) - return; - - if (sp.ControllingClient.AgentId == grp.OwnerID) - dis = 0; - } - - float thisSpGain; - - // Scale by distance - if (radius == 0) - thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); - else - thisSpGain = (float)((double)gain * ((radius - dis) / radius)); - - sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); - }); - } - - public virtual void TriggerSound( - UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) - { - SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); - if (part == null) - { - ScenePresence sp; - if (!m_scene.TryGetScenePresence(objectID, out sp)) - return; - } - else - { - SceneObjectGroup grp = part.ParentGroup; - - if (grp.IsAttachment && grp.AttachmentPoint > 30) - { - objectID = ownerID; - parentID = ownerID; - } - } - - m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) - { - double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); - - if (dis > 100.0) // Max audio distance - return; - - float thisSpGain; - - // Scale by distance - if (radius == 0) - thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); - else - thisSpGain = (float)((double)gain * ((radius - dis) / radius)); - - sp.ControllingClient.SendTriggeredSound( - soundId, ownerID, objectID, parentID, handle, position, thisSpGain); - }); - } - } -} diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs new file mode 100644 index 0000000..9fd0a36 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -0,0 +1,179 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Reflection; + +using Nini.Config; +using OpenMetaverse; +using log4net; +using Mono.Addins; + +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.CoreModules.World.Sound +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SoundModuleNonShared")] + public class SoundModuleNonShared : INonSharedRegionModule, ISoundModule + { + private static readonly ILog m_log = LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private Scene m_scene; + + public bool Enabled { get; private set; } + + #region INonSharedRegionModule + + public void Initialise(IConfigSource configSource) + { + IConfig config = configSource.Configs["Sounds"]; + + Enabled = (config != null && config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared"); + } + + public void AddRegion(Scene scene) { } + + public void RemoveRegion(Scene scene) + { + m_scene.EventManager.OnClientLogin -= OnNewClient; + } + + public void RegionLoaded(Scene scene) + { + if (!Enabled) + return; + + m_scene = scene; + m_scene.EventManager.OnClientLogin += OnNewClient; + + m_scene.RegisterModuleInterface(this); + } + + public void Close() { } + + public Type ReplaceableInterface + { + get { return typeof(ISoundModule); } + } + + public string Name { get { return "Sound Module"; } } + + #endregion + + #region Event Handlers + + private void OnNewClient(IClientAPI client) + { + client.OnSoundTrigger += TriggerSound; + } + + #endregion + + #region ISoundModule + + public virtual void PlayAttachedSound( + UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + if (part == null) + return; + + SceneObjectGroup grp = part.ParentGroup; + + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); + if (dis > 100.0) // Max audio distance + return; + + if (grp.IsAttachment) + { + if (grp.HasPrivateAttachmentPoint && sp.ControllingClient.AgentId != grp.OwnerID) + return; + + if (sp.ControllingClient.AgentId == grp.OwnerID) + dis = 0; + } + + float thisSpGain; + + // Scale by distance + if (radius == 0) + thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); + else + thisSpGain = (float)((double)gain * ((radius - dis) / radius)); + + sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); + }); + } + + public virtual void TriggerSound( + UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + if (part == null) + { + ScenePresence sp; + if (!m_scene.TryGetScenePresence(objectID, out sp)) + return; + } + else + { + SceneObjectGroup grp = part.ParentGroup; + + if (grp.IsAttachment && grp.AttachmentPoint > 30) + { + objectID = ownerID; + parentID = ownerID; + } + } + + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); + + if (dis > 100.0) // Max audio distance + return; + + float thisSpGain; + + // Scale by distance + if (radius == 0) + thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); + else + thisSpGain = (float)((double)gain * ((radius - dis) / radius)); + + sp.ControllingClient.SendTriggeredSound( + soundId, ownerID, objectID, parentID, handle, position, thisSpGain); + }); + } + + #endregion + } +} -- cgit v1.1 From 375fb6658909f619f3210590743c228834d0d2c0 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:01:29 +0100 Subject: making the max distance for sounds to be heard from their origin a configurable option exposed via a public field on ISoundModule (with private setter in the implementation) --- .../Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 12 +++++++++--- OpenSim/Region/Framework/Interfaces/ISoundModule.cs | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 9fd0a36..ff052ba 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -48,13 +48,19 @@ namespace OpenSim.Region.CoreModules.World.Sound public bool Enabled { get; private set; } + public float MaxDistance { get; private set; } + #region INonSharedRegionModule public void Initialise(IConfigSource configSource) { IConfig config = configSource.Configs["Sounds"]; - Enabled = (config != null && config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared"); + if (config == null) + return; + + Enabled = config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared"; + MaxDistance = config.GetFloat("MaxDistance", 100.0f); } public void AddRegion(Scene scene) { } @@ -109,7 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Sound m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) { double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); - if (dis > 100.0) // Max audio distance + if (dis > MaxDistance) // Max audio distance return; if (grp.IsAttachment) @@ -158,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Sound { double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); - if (dis > 100.0) // Max audio distance + if (dis > MaxDistance) // Max audio distance return; float thisSpGain; diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 6117a80..4c558cc 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -32,6 +32,8 @@ namespace OpenSim.Region.Framework.Interfaces { public interface ISoundModule { + float MaxDistance { get; } + void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); void TriggerSound( -- cgit v1.1 From 6bd1f0f209bce2f158c881f525235078957e9a62 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:04:28 +0100 Subject: Factoring out an if-else block in PlayAttachedSound as it was using the previously hard-coded max distance value. --- .../Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index ff052ba..f3ec572 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -112,6 +112,9 @@ namespace OpenSim.Region.CoreModules.World.Sound SceneObjectGroup grp = part.ParentGroup; + if (radius == 0) + radius = MaxDistance; + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) { double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); @@ -130,9 +133,6 @@ namespace OpenSim.Region.CoreModules.World.Sound float thisSpGain; // Scale by distance - if (radius == 0) - thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); - else thisSpGain = (float)((double)gain * ((radius - dis) / radius)); sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); @@ -160,6 +160,9 @@ namespace OpenSim.Region.CoreModules.World.Sound } } + if (radius == 0) + radius = MaxDistance; + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) { double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); @@ -170,9 +173,6 @@ namespace OpenSim.Region.CoreModules.World.Sound float thisSpGain; // Scale by distance - if (radius == 0) - thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); - else thisSpGain = (float)((double)gain * ((radius - dis) / radius)); sp.ControllingClient.SendTriggeredSound( -- cgit v1.1 From 20be6a4b48d73734e0041780868ff60078163004 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:13:38 +0100 Subject: refactoring thisSpGain in PlayAttachedSound as it was previously using two typecasts in the assignment and had the assignment on a separate line to the declaration --- .../Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index f3ec572..14914b6 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -130,12 +130,10 @@ namespace OpenSim.Region.CoreModules.World.Sound dis = 0; } - float thisSpGain; - // Scale by distance - thisSpGain = (float)((double)gain * ((radius - dis) / radius)); + double thisSpGain = gain * ((radius - dis) / radius); - sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); + sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)thisSpGain, flags); }); } @@ -170,13 +168,11 @@ namespace OpenSim.Region.CoreModules.World.Sound if (dis > MaxDistance) // Max audio distance return; - float thisSpGain; - // Scale by distance - thisSpGain = (float)((double)gain * ((radius - dis) / radius)); + double thisSpGain = gain * ((radius - dis) / radius); sp.ControllingClient.SendTriggeredSound( - soundId, ownerID, objectID, parentID, handle, position, thisSpGain); + soundId, ownerID, objectID, parentID, handle, position, (float)thisSpGain); }); } -- cgit v1.1 From 1d47bcb6b6838500fa9b80d441a8b87ceaf0e01c Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:14:01 +0100 Subject: stripping whitespace from ISoundModule, formatting SoundModuleNonShared.cs --- OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 8 +++++--- OpenSim/Region/Framework/Interfaces/ISoundModule.cs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 14914b6..74f2874 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -133,7 +133,8 @@ namespace OpenSim.Region.CoreModules.World.Sound // Scale by distance double thisSpGain = gain * ((radius - dis) / radius); - sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)thisSpGain, flags); + sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, + ownerID, (float)thisSpGain, flags); }); } @@ -171,8 +172,9 @@ namespace OpenSim.Region.CoreModules.World.Sound // Scale by distance double thisSpGain = gain * ((radius - dis) / radius); - sp.ControllingClient.SendTriggeredSound( - soundId, ownerID, objectID, parentID, handle, position, (float)thisSpGain); + sp.ControllingClient.SendTriggeredSound(soundId, ownerID, + objectID, parentID, handle, position, + (float)thisSpGain); }); } diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 4c558cc..945029f 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces float MaxDistance { get; } void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); - + void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius); } -- cgit v1.1 From 516ee244b4f8f493b9b76a62b62f4e8304826e4f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:30:51 +0100 Subject: swapping GetSceneObjectPart for TryGetSceneObjectPart in PlayAttachedSound to imply why we're doing an early return. --- OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 74f2874..917b3dc 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -106,8 +106,8 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void PlayAttachedSound( UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) { - SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); - if (part == null) + SceneObjectPart part; + if (!m_scene.TryGetSceneObjectPart(objectID, out part)) return; SceneObjectGroup grp = part.ParentGroup; @@ -141,8 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) { - SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); - if (part == null) + SceneObjectPart part; + if (!m_scene.TryGetSceneObjectPart(objectID, out part)) { ScenePresence sp; if (!m_scene.TryGetScenePresence(objectID, out sp)) -- cgit v1.1 From 644089278814a269d30fe8198e6a000e6e3153e7 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:31:50 +0100 Subject: TryGetScenePresence in TriggerSound is probably meant to be using the ownerID, not the objectID --- OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 917b3dc..f0e446f 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -145,7 +145,7 @@ namespace OpenSim.Region.CoreModules.World.Sound if (!m_scene.TryGetSceneObjectPart(objectID, out part)) { ScenePresence sp; - if (!m_scene.TryGetScenePresence(objectID, out sp)) + if (!m_scene.TryGetScenePresence(ownerID, out sp)) return; } else -- cgit v1.1 From b42cfe49a2f4e95687eb76381ed911515ef2e3b2 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:37:01 +0100 Subject: Replacing double-if block in SceneObjectPart.SendSound with Util.Clip --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 27ef4c9..a539eff 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2684,10 +2684,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) { - if (volume > 1) - volume = 1; - if (volume < 0) - volume = 0; + volume = Util.Clip((float)volume, 0, 1); UUID ownerID = OwnerID; UUID objectID = ParentGroup.RootPart.UUID; -- cgit v1.1 From f4fe8763ad4f4cb85ff38eb65f1138baee74ece1 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:37:55 +0100 Subject: Changing the logic order in the TaskInventory iterator of ScenObjectPart.SendSound, since we can currently have non-unique object inventory names so we should check the asset type first. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a539eff..681feea 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2701,7 +2701,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (KeyValuePair item in TaskInventory) { - if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) + if (item.Value.Type == (int)AssetType.Sound && item.Value.Name == sound) { soundID = item.Value.ItemID; break; -- cgit v1.1 From 32db725dd770a52d02f86cf8a1274f68178d6844 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:39:06 +0100 Subject: SceneObjectPart.SendSound can exit early if a sound module was not found. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 681feea..3a39da0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2684,6 +2684,10 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) { + ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); + if(soundModule == null) + return; + volume = Util.Clip((float)volume, 0, 1); UUID ownerID = OwnerID; @@ -2713,9 +2717,6 @@ namespace OpenSim.Region.Framework.Scenes if (soundID == UUID.Zero) return; - ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); - if (soundModule != null) - { if (useMaster) { if (isMaster) @@ -2761,7 +2762,6 @@ namespace OpenSim.Region.Framework.Scenes else soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); } - } } /// -- cgit v1.1 From 1c618843b836c4e9ad8ae685d2f49836e32d8b08 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:39:23 +0100 Subject: formatting changes to SceneObjectPart.SendSound; consistent indentation --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3a39da0..b333a1a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2717,51 +2717,51 @@ namespace OpenSim.Region.Framework.Scenes if (soundID == UUID.Zero) return; - if (useMaster) + if (useMaster) + { + if (isMaster) { - if (isMaster) + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + ParentGroup.PlaySoundMasterPrim = this; + ownerID = OwnerID; + objectID = ParentGroup.RootPart.UUID; + parentID = ParentGroup.UUID; + position = AbsolutePosition; // region local + regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) { + ownerID = prim.OwnerID; + objectID = prim.ParentGroup.RootPart.UUID; + parentID = prim.ParentGroup.UUID; + position = prim.AbsolutePosition; // region local + regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; if (triggered) soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); else soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); - ParentGroup.PlaySoundMasterPrim = this; - ownerID = OwnerID; - objectID = ParentGroup.RootPart.UUID; - parentID = ParentGroup.UUID; - position = AbsolutePosition; // region local - regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; - if (triggered) - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); - else - soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); - foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) - { - ownerID = prim.OwnerID; - objectID = prim.ParentGroup.RootPart.UUID; - parentID = prim.ParentGroup.UUID; - position = prim.AbsolutePosition; // region local - regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; - if (triggered) - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); - else - soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); - } - ParentGroup.PlaySoundSlavePrims.Clear(); - ParentGroup.PlaySoundMasterPrim = null; - } - else - { - ParentGroup.PlaySoundSlavePrims.Add(this); } + ParentGroup.PlaySoundSlavePrims.Clear(); + ParentGroup.PlaySoundMasterPrim = null; } else { - if (triggered) - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); - else - soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + ParentGroup.PlaySoundSlavePrims.Add(this); } + } + else + { + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + } } /// -- cgit v1.1 From d4034271eb37ff31cbdcad416a00f4e4c426731e Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:42:59 +0100 Subject: formatting ISoundModule prior to documentation --- OpenSim/Region/Framework/Interfaces/ISoundModule.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 945029f..90fe0bc 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -34,9 +34,11 @@ namespace OpenSim.Region.Framework.Interfaces { float MaxDistance { get; } - void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); + void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, + double gain, Vector3 position, byte flags, float radius); void TriggerSound( - UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius); + UUID soundId, UUID ownerID, UUID objectID, UUID parentID, + double gain, Vector3 position, UInt64 handle, float radius); } } \ No newline at end of file -- cgit v1.1 From b9e0f1cd2be3fe8b20d639d66f5f4fc8f1995d73 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:46:31 +0100 Subject: documenting ISoundModule methods & fields --- .../Region/Framework/Interfaces/ISoundModule.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 90fe0bc..6930d78 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -32,11 +32,39 @@ namespace OpenSim.Region.Framework.Interfaces { public interface ISoundModule { + /// + /// Maximum distance between a sound source and a recipient. + /// float MaxDistance { get; } + /// + /// Play a sound from an object. + /// + /// Sound asset ID + /// Sound source owner + /// Sound source ID + /// Sound volume + /// Sound source position + /// Sound flags + /// + /// Radius used to affect gain over distance. + /// void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); + /// + /// Trigger a sound in the scene. + /// + /// Sound asset ID + /// Sound source owner + /// Sound source ID + /// Sound source parent. + /// Sound volume + /// Sound source position + /// + /// + /// Radius used to affect gain over distance. + /// void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius); -- cgit v1.1 From 206a694c6baf9603855cc8eab50909e5e63b0f10 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:50:31 +0100 Subject: moving comment for llStopSound inside the method block prior to transposition to sound module --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bedcd85..7fa01c1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2448,11 +2448,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); } - // Xantor 20080528: Clear prim data of sound instead public void llStopSound() { m_host.AddScriptLPS(1); m_host.AdjustSoundGain(0); + // Xantor 20080528: Clear prim data of sound instead if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) { if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) -- cgit v1.1 From 8763a637b5c2e48a97111b4f569e71b7e1c2f1d2 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:55:00 +0100 Subject: transposing stop sound into sound module --- .../World/Sound/SoundModuleNonShared.cs | 45 ++++++++++++++++++++++ .../Region/Framework/Interfaces/ISoundModule.cs | 6 +++ .../Shared/Api/Implementation/LSL_Api.cs | 42 +++----------------- 3 files changed, 56 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index f0e446f..670794d 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -178,6 +178,51 @@ namespace OpenSim.Region.CoreModules.World.Sound }); } + public virtual void StopSound(UUID objectID) + { + SceneObjectPart m_host; + if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) + return; + + m_host.AdjustSoundGain(0); + // Xantor 20080528: Clear prim data of sound instead + if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) + { + if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) + { + foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) + { + part.Sound = UUID.Zero; + part.SoundGain = 0; + part.SoundFlags = 0; + part.SoundRadius = 0; + part.ScheduleFullUpdate(); + part.SendFullUpdateToAllClients(); + } + m_host.ParentGroup.LoopSoundMasterPrim = null; + m_host.ParentGroup.LoopSoundSlavePrims.Clear(); + } + else + { + m_host.Sound = UUID.Zero; + m_host.SoundGain = 0; + m_host.SoundFlags = 0; + m_host.SoundRadius = 0; + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); + } + } + else + { + m_host.Sound = UUID.Zero; + m_host.SoundGain = 0; + m_host.SoundFlags = 0; + m_host.SoundRadius = 0; + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); + } + } + #endregion } } diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 6930d78..45219ed 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -68,5 +68,11 @@ namespace OpenSim.Region.Framework.Interfaces void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius); + + /// + /// Stop sounds eminating from an object. + /// + /// Sound source ID + void StopSound(UUID objectID); } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7fa01c1..25be3ff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -107,6 +107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IUrlModule m_UrlModule = null; protected Dictionary m_userInfoCache = new Dictionary(); protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. + protected ISoundModule m_SoundModule = null; public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { @@ -119,6 +120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_TransferModule = m_ScriptEngine.World.RequestModuleInterface(); m_UrlModule = m_ScriptEngine.World.RequestModuleInterface(); + m_SoundModule = m_ScriptEngine.World.RequestModuleInterface(); AsyncCommands = new AsyncCommandManager(ScriptEngine); } @@ -2451,43 +2453,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llStopSound() { m_host.AddScriptLPS(1); - m_host.AdjustSoundGain(0); - // Xantor 20080528: Clear prim data of sound instead - if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) - { - if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) - { - foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) - { - part.Sound = UUID.Zero; - part.SoundGain = 0; - part.SoundFlags = 0; - part.SoundRadius = 0; - part.ScheduleFullUpdate(); - part.SendFullUpdateToAllClients(); - } - m_host.ParentGroup.LoopSoundMasterPrim = null; - m_host.ParentGroup.LoopSoundSlavePrims.Clear(); - } - else - { - m_host.Sound = UUID.Zero; - m_host.SoundGain = 0; - m_host.SoundFlags = 0; - m_host.SoundRadius = 0; - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); - } - } - else - { - m_host.Sound = UUID.Zero; - m_host.SoundGain = 0; - m_host.SoundFlags = 0; - m_host.SoundRadius = 0; - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); - } + + if (m_SoundModule != null) + m_SoundModule.StopSound(m_host.UUID); } public void llPreloadSound(string sound) -- cgit v1.1 From a68e2fe1692a7611c58f774ac5b94c4298343433 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 15:16:30 +0100 Subject: transposing preload sound onto sound module --- .../World/Sound/SoundModuleNonShared.cs | 20 ++++++++++++++ .../Region/Framework/Interfaces/ISoundModule.cs | 10 +++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 31 ---------------------- .../Shared/Api/Implementation/LSL_Api.cs | 3 ++- 4 files changed, 32 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 670794d..0225d6f 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; +using System.Collections.Generic; using System.Reflection; using Nini.Config; @@ -223,6 +224,25 @@ namespace OpenSim.Region.CoreModules.World.Sound } } + public virtual void PreloadSound(UUID soundID, UUID objectID, float radius) + { + SceneObjectPart part; + if (soundID == UUID.Zero + || !m_scene.TryGetSceneObjectPart(objectID, out part)) + { + return; + } + + if (radius == 0) + radius = MaxDistance; + + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + if (!(Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) >= MaxDistance)) + sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); + }); + } + #endregion } } diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 45219ed..0f65763 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -74,5 +74,15 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Sound source ID void StopSound(UUID objectID); + + /// + /// Preload sound to viewers within range. + /// + /// Sound asset ID + /// Sound source ID + /// + /// Radius used to determine which viewers should preload the sound. + /// + void PreloadSound(UUID soundID, UUID objectID, float radius); } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b333a1a..48615de 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2287,37 +2287,6 @@ namespace OpenSim.Region.Framework.Scenes ScheduleTerseUpdate(); } - public void PreloadSound(string sound) - { - // UUID ownerID = OwnerID; - UUID objectID = ParentGroup.RootPart.UUID; - UUID soundID = UUID.Zero; - - if (!UUID.TryParse(sound, out soundID)) - { - //Trys to fetch sound id from prim's inventory. - //Prim's inventory doesn't support non script items yet - - lock (TaskInventory) - { - foreach (KeyValuePair item in TaskInventory) - { - if (item.Value.Name == sound) - { - soundID = item.Value.ItemID; - break; - } - } - } - } - - ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp) - { - if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) - sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); - }); - } - public void RemFlag(PrimFlags flag) { // PrimFlags prevflag = Flags; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 25be3ff..61fd1aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2461,7 +2461,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llPreloadSound(string sound) { m_host.AddScriptLPS(1); - m_host.PreloadSound(sound); + if (m_SoundModule != null) + m_SoundModule.PreloadSound(KeyOrName(sound), m_host.UUID, 0); ScriptSleep(1000); } -- cgit v1.1 From 29a8ae48b51de55a02f839b6e4566054ad3f7f58 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 6 Oct 2012 22:23:14 +0100 Subject: transposing LoopSoundMaster to Sound Module --- .../World/Sound/SoundModuleNonShared.cs | 36 ++++++++++++++++++++++ .../Region/Framework/Interfaces/ISoundModule.cs | 11 +++++++ .../Shared/Api/Implementation/LSL_Api.cs | 28 ++--------------- 3 files changed, 50 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 0225d6f..4912ed8 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -243,6 +243,42 @@ namespace OpenSim.Region.CoreModules.World.Sound }); } + public virtual void LoopSoundMaster(UUID objectID, UUID soundID, + double volume, double radius) + { + SceneObjectPart m_host; + if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) + return; + + m_host.ParentGroup.LoopSoundMasterPrim = m_host; + lock (m_host.ParentGroup.LoopSoundSlavePrims) + { + foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) + { + if (prim.Sound != UUID.Zero) + StopSound(objectID); + + prim.Sound = soundID; + prim.SoundGain = volume; + prim.SoundFlags = 1; // looping + prim.SoundRadius = radius; + + prim.ScheduleFullUpdate(); + prim.SendFullUpdateToAllClients(); + } + } + if (m_host.Sound != UUID.Zero) + StopSound(objectID); + + m_host.Sound = soundID; + m_host.SoundGain = volume; + m_host.SoundFlags = 1; // looping + m_host.SoundRadius = radius; + + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); + } + #endregion } } diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 0f65763..d2557b5 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -84,5 +84,16 @@ namespace OpenSim.Region.Framework.Interfaces /// Radius used to determine which viewers should preload the sound. /// void PreloadSound(UUID soundID, UUID objectID, float radius); + + /// + /// Declare object as new sync master, play specified sound at + /// specified volume with specified radius. + /// + /// Sound source ID + /// Sound asset ID + /// Sound volume + /// Sound radius + void LoopSoundMaster(UUID objectID, UUID soundID, double gain, + double radius); } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 61fd1aa..2669add 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2397,33 +2397,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llLoopSoundMaster(string sound, double volume) { m_host.AddScriptLPS(1); - m_host.ParentGroup.LoopSoundMasterPrim = m_host; - lock (m_host.ParentGroup.LoopSoundSlavePrims) + if (m_SoundModule != null) { - foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) - { - if (prim.Sound != UUID.Zero) - llStopSound(); - - prim.Sound = KeyOrName(sound); - prim.SoundGain = volume; - prim.SoundFlags = 1; // looping - prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? - - prim.ScheduleFullUpdate(); - prim.SendFullUpdateToAllClients(); - } + m_SoundModule.LoopSoundMaster(m_host.UUID, KeyOrName(sound), + volume, 20); } - if (m_host.Sound != UUID.Zero) - llStopSound(); - - m_host.Sound = KeyOrName(sound); - m_host.SoundGain = volume; - m_host.SoundFlags = 1; // looping - m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? - - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); } public void llLoopSoundSlave(string sound, double volume) -- cgit v1.1 From d7ffcace8f596d9b0cf84f1e8cbe4e2d6a71baef Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 6 Oct 2012 22:27:20 +0100 Subject: adjusting parameter order of PreloadSound to be more logical --- OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 2 +- OpenSim/Region/Framework/Interfaces/ISoundModule.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 4912ed8..5a560d8 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.World.Sound } } - public virtual void PreloadSound(UUID soundID, UUID objectID, float radius) + public virtual void PreloadSound(UUID objectID, UUID soundID, float radius) { SceneObjectPart part; if (soundID == UUID.Zero diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index d2557b5..d34a520 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -78,12 +78,12 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Preload sound to viewers within range. /// - /// Sound asset ID /// Sound source ID + /// Sound asset ID /// /// Radius used to determine which viewers should preload the sound. /// - void PreloadSound(UUID soundID, UUID objectID, float radius); + void PreloadSound(UUID objectID, UUID soundID, float radius); /// /// Declare object as new sync master, play specified sound at diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2669add..0252145 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2440,7 +2440,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); if (m_SoundModule != null) - m_SoundModule.PreloadSound(KeyOrName(sound), m_host.UUID, 0); + m_SoundModule.PreloadSound(m_host.UUID, KeyOrName(sound), 0); ScriptSleep(1000); } -- cgit v1.1 From e5df8cafb8d2cc813824299fe4714ee0ceee30c3 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 6 Oct 2012 22:37:27 +0100 Subject: Removing a locked iteration over SceneObjectGroup.LoopSoundSlavePrims as the SL Wiki spec does not state that slaves are set to match master values --- .../CoreModules/World/Sound/SoundModuleNonShared.cs | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 5a560d8..7ce13d1 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -251,22 +251,7 @@ namespace OpenSim.Region.CoreModules.World.Sound return; m_host.ParentGroup.LoopSoundMasterPrim = m_host; - lock (m_host.ParentGroup.LoopSoundSlavePrims) - { - foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) - { - if (prim.Sound != UUID.Zero) - StopSound(objectID); - - prim.Sound = soundID; - prim.SoundGain = volume; - prim.SoundFlags = 1; // looping - prim.SoundRadius = radius; - prim.ScheduleFullUpdate(); - prim.SendFullUpdateToAllClients(); - } - } if (m_host.Sound != UUID.Zero) StopSound(objectID); -- cgit v1.1 From 3d8f59aac38e57cf573809b0456053aa0cc8500d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 6 Oct 2012 22:40:26 +0100 Subject: refactoring StopSound into a private static method to skip repeating m_scene.TryGetSceneObjectPart --- OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 7ce13d1..b4b8e79 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -185,6 +185,11 @@ namespace OpenSim.Region.CoreModules.World.Sound if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) return; + StopSound(m_host); + } + + private static void StopSound(SceneObjectPart m_host) + { m_host.AdjustSoundGain(0); // Xantor 20080528: Clear prim data of sound instead if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) @@ -253,7 +258,7 @@ namespace OpenSim.Region.CoreModules.World.Sound m_host.ParentGroup.LoopSoundMasterPrim = m_host; if (m_host.Sound != UUID.Zero) - StopSound(objectID); + StopSound(m_host); m_host.Sound = soundID; m_host.SoundGain = volume; -- cgit v1.1 From 22693304fb3cfbb8d073c48affd2e56453dd2b2f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 15 Oct 2012 14:05:17 +0100 Subject: removing superfluous lines from SceneObjectPart.SendSound --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 48615de..681c725 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2695,11 +2695,6 @@ namespace OpenSim.Region.Framework.Scenes else soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); ParentGroup.PlaySoundMasterPrim = this; - ownerID = OwnerID; - objectID = ParentGroup.RootPart.UUID; - parentID = ParentGroup.UUID; - position = AbsolutePosition; // region local - regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; if (triggered) soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); else @@ -2707,10 +2702,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) { ownerID = prim.OwnerID; - objectID = prim.ParentGroup.RootPart.UUID; - parentID = prim.ParentGroup.UUID; position = prim.AbsolutePosition; // region local - regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; if (triggered) soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); else -- cgit v1.1 From 9df510157e26ffcaf04fd4b85512778fddc08f68 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 15 Oct 2012 14:28:34 +0100 Subject: deduplicating code into a single LoopSound method --- .../World/Sound/SoundModuleNonShared.cs | 13 ++++++++-- .../Region/Framework/Interfaces/ISoundModule.cs | 9 +++---- .../Shared/Api/Implementation/LSL_Api.cs | 28 ++++++---------------- 3 files changed, 23 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index b4b8e79..6f35a23 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -248,13 +248,22 @@ namespace OpenSim.Region.CoreModules.World.Sound }); } - public virtual void LoopSoundMaster(UUID objectID, UUID soundID, - double volume, double radius) + // Xantor 20080528 we should do this differently. + // 1) apply the sound to the object + // 2) schedule full update + // just sending the sound out once doesn't work so well when other avatars come in view later on + // or when the prim gets moved, changed, sat on, whatever + // see large number of mantises (mantes?) + // 20080530 Updated to remove code duplication + // 20080530 Stop sound if there is one, otherwise volume only changes don't work + public void LoopSound(UUID objectID, UUID soundID, + double volume, double radius, bool isMaster) { SceneObjectPart m_host; if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) return; + if (isMaster) m_host.ParentGroup.LoopSoundMasterPrim = m_host; if (m_host.Sound != UUID.Zero) diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index d34a520..e514a59 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -86,14 +86,15 @@ namespace OpenSim.Region.Framework.Interfaces void PreloadSound(UUID objectID, UUID soundID, float radius); /// - /// Declare object as new sync master, play specified sound at - /// specified volume with specified radius. + /// Loop specified sound at specified volume with specified radius, + /// optionally declaring object as new sync master. /// /// Sound source ID /// Sound asset ID /// Sound volume /// Sound radius - void LoopSoundMaster(UUID objectID, UUID soundID, double gain, - double radius); + /// Set object to sync master if true + void LoopSound(UUID objectID, UUID soundID, double gain, + double radius, bool isMaster); } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0252145..c479944 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2370,28 +2370,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); } - // Xantor 20080528 we should do this differently. - // 1) apply the sound to the object - // 2) schedule full update - // just sending the sound out once doesn't work so well when other avatars come in view later on - // or when the prim gets moved, changed, sat on, whatever - // see large number of mantises (mantes?) - // 20080530 Updated to remove code duplication - // 20080530 Stop sound if there is one, otherwise volume only changes don't work public void llLoopSound(string sound, double volume) { m_host.AddScriptLPS(1); - - if (m_host.Sound != UUID.Zero) - llStopSound(); - - m_host.Sound = KeyOrName(sound); - m_host.SoundGain = volume; - m_host.SoundFlags = 1; // looping - m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? - - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); + if (m_SoundModule != null) + { + m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), + volume, 20, false); + } } public void llLoopSoundMaster(string sound, double volume) @@ -2399,8 +2385,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - m_SoundModule.LoopSoundMaster(m_host.UUID, KeyOrName(sound), - volume, 20); + m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), + volume, 20, true); } } -- cgit v1.1 From e75596524a1d8f1a785d78eccdaf0fa585b703f8 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 15 Oct 2012 14:31:10 +0100 Subject: Formatting SoundModuleNonShared.LoopSound, consistent indentation --- OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 6f35a23..6f61c32 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.World.Sound return; if (isMaster) - m_host.ParentGroup.LoopSoundMasterPrim = m_host; + m_host.ParentGroup.LoopSoundMasterPrim = m_host; if (m_host.Sound != UUID.Zero) StopSound(m_host); -- cgit v1.1 From 57940087d125cf817d1d2492145dc224439434ad Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 15 Oct 2012 15:09:45 +0100 Subject: Factoring out a superfluous local variable & repeated assignment in SceneObjectPart.SendSound as linksets are only meant to have a single owner --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 681c725..240cfa5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2659,7 +2659,6 @@ namespace OpenSim.Region.Framework.Scenes volume = Util.Clip((float)volume, 0, 1); - UUID ownerID = OwnerID; UUID objectID = ParentGroup.RootPart.UUID; UUID parentID = ParentGroup.UUID; @@ -2691,22 +2690,21 @@ namespace OpenSim.Region.Framework.Scenes if (isMaster) { if (triggered) - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + soundModule.TriggerSound(soundID, OwnerID, objectID, parentID, volume, position, regionHandle, radius); else - soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + soundModule.PlayAttachedSound(soundID, OwnerID, objectID, volume, position, flags, radius); ParentGroup.PlaySoundMasterPrim = this; if (triggered) - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + soundModule.TriggerSound(soundID, OwnerID, objectID, parentID, volume, position, regionHandle, radius); else - soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + soundModule.PlayAttachedSound(soundID, OwnerID, objectID, volume, position, flags, radius); foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) { - ownerID = prim.OwnerID; position = prim.AbsolutePosition; // region local if (triggered) - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + soundModule.TriggerSound(soundID, OwnerID, objectID, parentID, volume, position, regionHandle, radius); else - soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + soundModule.PlayAttachedSound(soundID, OwnerID, objectID, volume, position, flags, radius); } ParentGroup.PlaySoundSlavePrims.Clear(); ParentGroup.PlaySoundMasterPrim = null; @@ -2719,9 +2717,9 @@ namespace OpenSim.Region.Framework.Scenes else { if (triggered) - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + soundModule.TriggerSound(soundID, OwnerID, objectID, parentID, volume, position, regionHandle, radius); else - soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + soundModule.PlayAttachedSound(soundID, OwnerID, objectID, volume, position, flags, radius); } } -- cgit v1.1 From af39af1cc407b88d6d2838acff09de77d4a4335d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 15 Oct 2012 16:11:26 +0100 Subject: fixing a bug in SceneObjectPart.SendSound where sounds would always come from the root prim rather than the source prim --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 240cfa5..5da4207 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2659,7 +2659,6 @@ namespace OpenSim.Region.Framework.Scenes volume = Util.Clip((float)volume, 0, 1); - UUID objectID = ParentGroup.RootPart.UUID; UUID parentID = ParentGroup.UUID; UUID soundID = UUID.Zero; @@ -2690,21 +2689,21 @@ namespace OpenSim.Region.Framework.Scenes if (isMaster) { if (triggered) - soundModule.TriggerSound(soundID, OwnerID, objectID, parentID, volume, position, regionHandle, radius); + soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius); else - soundModule.PlayAttachedSound(soundID, OwnerID, objectID, volume, position, flags, radius); + soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius); ParentGroup.PlaySoundMasterPrim = this; if (triggered) - soundModule.TriggerSound(soundID, OwnerID, objectID, parentID, volume, position, regionHandle, radius); + soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius); else - soundModule.PlayAttachedSound(soundID, OwnerID, objectID, volume, position, flags, radius); + soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius); foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) { position = prim.AbsolutePosition; // region local if (triggered) - soundModule.TriggerSound(soundID, OwnerID, objectID, parentID, volume, position, regionHandle, radius); + soundModule.TriggerSound(soundID, OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); else - soundModule.PlayAttachedSound(soundID, OwnerID, objectID, volume, position, flags, radius); + soundModule.PlayAttachedSound(soundID, OwnerID, prim.UUID, volume, position, flags, radius); } ParentGroup.PlaySoundSlavePrims.Clear(); ParentGroup.PlaySoundMasterPrim = null; @@ -2717,9 +2716,9 @@ namespace OpenSim.Region.Framework.Scenes else { if (triggered) - soundModule.TriggerSound(soundID, OwnerID, objectID, parentID, volume, position, regionHandle, radius); + soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius); else - soundModule.PlayAttachedSound(soundID, OwnerID, objectID, volume, position, flags, radius); + soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius); } } -- cgit v1.1 From 5abcecc7356bf58c479a7cff86581131a6ab3c9e Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:24:33 +0100 Subject: moving SendSound from SceneObjectPart to ISoundModule --- .../World/Sound/SoundModuleNonShared.cs | 73 ++++++++++++++++++ .../Region/Framework/Interfaces/ISoundModule.cs | 15 ++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 88 +++------------------- .../Scripting/Minimodule/SOPObject.cs | 7 +- .../Shared/Api/Implementation/LSL_Api.cs | 22 ++++-- 5 files changed, 119 insertions(+), 86 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 6f61c32..37863ee 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -278,6 +278,79 @@ namespace OpenSim.Region.CoreModules.World.Sound m_host.SendFullUpdateToAllClients(); } + public void SendSound(UUID objectID, string sound, double volume, + bool triggered, byte flags, float radius, bool useMaster, + bool isMaster) + { + SceneObjectPart part; + if (!m_scene.TryGetSceneObjectPart(objectID, out part)) + return; + + volume = Util.Clip((float)volume, 0, 1); + + UUID parentID = part.ParentGroup.UUID; + + UUID soundID = UUID.Zero; + Vector3 position = part.AbsolutePosition; // region local + ulong regionHandle = m_scene.RegionInfo.RegionHandle; + + if (!UUID.TryParse(sound, out soundID)) + { + // search sound file from inventory + lock (part.TaskInventory) + { + foreach (KeyValuePair item in part.TaskInventory) + { + if (item.Value.Type == (int)AssetType.Sound && item.Value.Name == sound) + { + soundID = item.Value.ItemID; + break; + } + } + } + } + + if (soundID == UUID.Zero) + return; + + if (useMaster) + { + if (isMaster) + { + if (triggered) + TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); + else + PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); + part.ParentGroup.PlaySoundMasterPrim = part; + if (triggered) + TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); + else + PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); + foreach (SceneObjectPart prim in part.ParentGroup.PlaySoundSlavePrims) + { + position = prim.AbsolutePosition; // region local + if (triggered) + TriggerSound(soundID, part.OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); + else + PlayAttachedSound(soundID, part.OwnerID, prim.UUID, volume, position, flags, radius); + } + part.ParentGroup.PlaySoundSlavePrims.Clear(); + part.ParentGroup.PlaySoundMasterPrim = null; + } + else + { + part.ParentGroup.PlaySoundSlavePrims.Add(part); + } + } + else + { + if (triggered) + TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); + else + PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); + } + } + #endregion } } diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index e514a59..c5edcb0 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -96,5 +96,20 @@ namespace OpenSim.Region.Framework.Interfaces /// Set object to sync master if true void LoopSound(UUID objectID, UUID soundID, double gain, double radius, bool isMaster); + + /// + /// Trigger or play an attached sound in this part's inventory. + /// + /// + /// + /// + /// + /// + /// + /// + /// + void SendSound(UUID objectID, string sound, double volume, + bool triggered, byte flags, float radius, bool useMaster, + bool isMaster); } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5da4207..cbb92b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2239,7 +2239,15 @@ namespace OpenSim.Region.Framework.Scenes // play the sound. if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) - SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + { + ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); + if (soundModule != null) + { + soundModule.SendSound(UUID, CollisionSound.ToString(), + CollisionSoundVolume, true, (byte)0, 0, false, + false); + } + } SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); @@ -2645,84 +2653,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Trigger or play an attached sound in this part's inventory. - /// - /// - /// - /// - /// - public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) - { - ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); - if(soundModule == null) - return; - - volume = Util.Clip((float)volume, 0, 1); - - UUID parentID = ParentGroup.UUID; - - UUID soundID = UUID.Zero; - Vector3 position = AbsolutePosition; // region local - ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; - - if (!UUID.TryParse(sound, out soundID)) - { - // search sound file from inventory - lock (TaskInventory) - { - foreach (KeyValuePair item in TaskInventory) - { - if (item.Value.Type == (int)AssetType.Sound && item.Value.Name == sound) - { - soundID = item.Value.ItemID; - break; - } - } - } - } - - if (soundID == UUID.Zero) - return; - - if (useMaster) - { - if (isMaster) - { - if (triggered) - soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius); - else - soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius); - ParentGroup.PlaySoundMasterPrim = this; - if (triggered) - soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius); - else - soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius); - foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) - { - position = prim.AbsolutePosition; // region local - if (triggered) - soundModule.TriggerSound(soundID, OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); - else - soundModule.PlayAttachedSound(soundID, OwnerID, prim.UUID, volume, position, flags, radius); - } - ParentGroup.PlaySoundSlavePrims.Clear(); - ParentGroup.PlaySoundMasterPrim = null; - } - else - { - ParentGroup.PlaySoundSlavePrims.Add(this); - } - } - else - { - if (triggered) - soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius); - else - soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius); - } - } - - /// /// Send a terse update to all clients /// public void SendTerseUpdateToAllClients() diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index aa23fee..9e438e2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -821,8 +821,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { if (!CanEdit()) return; - - GetSOP().SendSound(asset.ToString(), volume, true, 0, 0, false, false); + ISoundModule module = m_rootScene.RequestModuleInterface(); + if (module != null) + { + module.SendSound(GetSOP().UUID, asset.ToString(), volume, true, 0, 0, false, false); + } } #endregion diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c479944..f29be92 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2367,7 +2367,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); // send the sound, once, to all clients in range - m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); + if (m_SoundModule != null) + { + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); + } } public void llLoopSound(string sound, double volume) @@ -2404,14 +2407,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); // send the sound, once, to all clients in range - m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); + if (m_SoundModule != null) + { + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); + } } public void llTriggerSound(string sound, double volume) { m_host.AddScriptLPS(1); - // send the sound, once, to all clients in range - m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); + // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. + if (m_SoundModule != null) + { + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); + } } public void llStopSound() @@ -5824,10 +5833,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector bottom_south_west) { m_host.AddScriptLPS(1); + if (m_SoundModule != null) + { float radius1 = (float)llVecDist(llGetPos(), top_north_east); float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); float radius = Math.Abs(radius1 - radius2); - m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); + } } public void llEjectFromLand(string pest) -- cgit v1.1 From c5af16aef82e2bdf2f4d877a231180e00a8893a6 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:40:21 +0100 Subject: shuffling code around so that the interface for ISoundModule.SendSound() specifies a UUID rather than a string --- .../World/Sound/SoundModuleNonShared.cs | 25 ++---------- .../Region/Framework/Interfaces/ISoundModule.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- .../Scripting/Minimodule/SOPObject.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 44 ++++++++++++++++++++-- 5 files changed, 47 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 37863ee..417c071 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -278,10 +278,13 @@ namespace OpenSim.Region.CoreModules.World.Sound m_host.SendFullUpdateToAllClients(); } - public void SendSound(UUID objectID, string sound, double volume, + public void SendSound(UUID objectID, UUID soundID, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) { + if (soundID == UUID.Zero) + return; + SceneObjectPart part; if (!m_scene.TryGetSceneObjectPart(objectID, out part)) return; @@ -290,29 +293,9 @@ namespace OpenSim.Region.CoreModules.World.Sound UUID parentID = part.ParentGroup.UUID; - UUID soundID = UUID.Zero; Vector3 position = part.AbsolutePosition; // region local ulong regionHandle = m_scene.RegionInfo.RegionHandle; - if (!UUID.TryParse(sound, out soundID)) - { - // search sound file from inventory - lock (part.TaskInventory) - { - foreach (KeyValuePair item in part.TaskInventory) - { - if (item.Value.Type == (int)AssetType.Sound && item.Value.Name == sound) - { - soundID = item.Value.ItemID; - break; - } - } - } - } - - if (soundID == UUID.Zero) - return; - if (useMaster) { if (isMaster) diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index c5edcb0..5d1bb63 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -108,7 +108,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - void SendSound(UUID objectID, string sound, double volume, + void SendSound(UUID objectID, UUID sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cbb92b2..f79ac96 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2243,7 +2243,7 @@ namespace OpenSim.Region.Framework.Scenes ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); if (soundModule != null) { - soundModule.SendSound(UUID, CollisionSound.ToString(), + soundModule.SendSound(UUID, CollisionSound, CollisionSoundVolume, true, (byte)0, 0, false, false); } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 9e438e2..5ed1514 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -824,7 +824,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule ISoundModule module = m_rootScene.RequestModuleInterface(); if (module != null) { - module.SendSound(GetSOP().UUID, asset.ToString(), volume, true, 0, 0, false, false); + module.SendSound(GetSOP().UUID, asset, volume, true, 0, 0, false, false); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f29be92..869d94e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -333,6 +333,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return key; } + /// + /// Return the UUID of the asset matching the specified key or name + /// and asset type. + /// + /// + /// + /// + protected UUID KeyOrName(string k, AssetType type) + { + UUID key; + + if (!UUID.TryParse(k, out key)) + { + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k); + if (item != null && item.Type == (int)type) + key = item.AssetID; + } + else + { + lock (m_host.TaskInventory) + { + foreach (KeyValuePair item in m_host.TaskInventory) + { + if (item.Value.Type == (int)type && item.Value.Name == k) + { + key = item.Value.ItemID; + break; + } + } + } + } + + + return key; + } + //These are the implementations of the various ll-functions used by the LSL scripts. public LSL_Float llSin(double f) { @@ -2369,7 +2405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in range if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, false, false); } } @@ -2409,7 +2445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in range if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, true, false); } } @@ -2419,7 +2455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, false, false); } } @@ -5838,7 +5874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api float radius1 = (float)llVecDist(llGetPos(), top_north_east); float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); float radius = Math.Abs(radius1 - radius2); - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, radius, false, false); } } -- cgit v1.1 From c796f7861e318cc12248f3a86ee5b29e3fa99d79 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:44:09 +0100 Subject: 80-character width terminal formatting of recent commits to llPlaySound, llPlaySoundSlave, llTriggerSound and llTriggerSoundLimited --- .../Shared/Api/Implementation/LSL_Api.cs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 869d94e..610cb14 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2405,7 +2405,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in range if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, false, false); + m_SoundModule.SendSound(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, false, 0, + 0, false, false); } } @@ -2445,7 +2447,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in range if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, true, false); + m_SoundModule.SendSound(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, false, 0, + 0, true, false); } } @@ -2455,7 +2459,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, false, false); + m_SoundModule.SendSound(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, + false, false); } } @@ -5871,10 +5877,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - float radius1 = (float)llVecDist(llGetPos(), top_north_east); - float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); - float radius = Math.Abs(radius1 - radius2); - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, radius, false, false); + float radius1 = (float)llVecDist(llGetPos(), top_north_east); + float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); + float radius = Math.Abs(radius1 - radius2); + m_SoundModule.SendSound(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, true, 0, + radius, false, false); } } -- cgit v1.1 From f9923d4423f8f9dcf09a12e702737d2030a26d4a Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:45:30 +0100 Subject: shifting from two instances of typecasting to one instance of typecasting in llTriggerSoundLimited --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 610cb14..2b6a3fd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5877,12 +5877,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - float radius1 = (float)llVecDist(llGetPos(), top_north_east); - float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); - float radius = Math.Abs(radius1 - radius2); + double radius1 = llVecDist(llGetPos(), top_north_east); + double radius2 = llVecDist(llGetPos(), bottom_south_west); + double radius = Math.Abs(radius1 - radius2); m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, - radius, false, false); + (float)radius, false, false); } } -- cgit v1.1 From af9dc483e9db950ca4187a7afe186da80d2c7acf Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:48:41 +0100 Subject: refactoring llGetPos() to take advantage of implicit converter --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2b6a3fd..2654b5a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2082,8 +2082,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGetPos() { m_host.AddScriptLPS(1); - Vector3 pos = m_host.GetWorldPosition(); - return new LSL_Vector(pos.X, pos.Y, pos.Z); + return m_host.GetWorldPosition(); } public LSL_Vector llGetLocalPos() -- cgit v1.1 From ef157110897ef162c7f076d6d5f423b8cd9a8f47 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:49:25 +0100 Subject: refactoring llTriggerSoundLimited to not use the LSL methods, since that will cause unnecessary calls to m_host.AddScriptLPS(1) --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2654b5a..99b6189 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5876,8 +5876,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - double radius1 = llVecDist(llGetPos(), top_north_east); - double radius2 = llVecDist(llGetPos(), bottom_south_west); + double radius1 = VecDist(m_host.GetWorldPosition(), top_north_east); + double radius2 = VecDist(m_host.GetWorldPosition(), bottom_south_west); double radius = Math.Abs(radius1 - radius2); m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, -- cgit v1.1 From a9999a9676d46669150343e4cdbf65428326a91d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 13:11:17 +0100 Subject: Refactoring llTriggerSoundLimited with a new method on ISoundModule, as the LL Wiki spec for llTriggerSoundLimited states an axis-aligned bounding box, not radial constraint --- .../World/Sound/SoundModuleNonShared.cs | 30 ++++++++++++++++++++++ .../Region/Framework/Interfaces/ISoundModule.cs | 3 +++ .../Shared/Api/Implementation/LSL_Api.cs | 9 +++---- 3 files changed, 36 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 417c071..ac7f7b4 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -334,6 +334,36 @@ namespace OpenSim.Region.CoreModules.World.Sound } } + public void TriggerSoundLimited(UUID objectID, UUID sound, + double volume, Vector3 min, Vector3 max) + { + if (sound == UUID.Zero) + return; + + SceneObjectPart part; + if (!m_scene.TryGetSceneObjectPart(objectID, out part)) + return; + + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + double dis = Util.GetDistanceTo(sp.AbsolutePosition, + part.AbsolutePosition); + + if (dis > MaxDistance) // Max audio distance + return; + else if (!Util.IsInsideBox(sp.AbsolutePosition, min, max)) + return; + + // Scale by distance + double thisSpGain = volume * ((MaxDistance - dis) / MaxDistance); + + sp.ControllingClient.SendTriggeredSound(sound, part.OwnerID, + part.UUID, part.ParentGroup.UUID, + m_scene.RegionInfo.RegionHandle, + part.AbsolutePosition, (float)thisSpGain); + }); + } + #endregion } } diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 5d1bb63..2e53b16 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -111,5 +111,8 @@ namespace OpenSim.Region.Framework.Interfaces void SendSound(UUID objectID, UUID sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster); + + void TriggerSoundLimited(UUID objectID, UUID sound, double volume, + Vector3 min, Vector3 max); } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 99b6189..aeb74a5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5876,12 +5876,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - double radius1 = VecDist(m_host.GetWorldPosition(), top_north_east); - double radius2 = VecDist(m_host.GetWorldPosition(), bottom_south_west); - double radius = Math.Abs(radius1 - radius2); - m_SoundModule.SendSound(m_host.UUID, - KeyOrName(sound, AssetType.Sound), volume, true, 0, - (float)radius, false, false); + m_SoundModule.TriggerSoundLimited(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, + bottom_south_west, top_north_east); } } -- cgit v1.1 From dcac2a7f716e512b604cce02768770e1660600eb Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 13:27:03 +0100 Subject: refactoring llCollisionSound to use new KeyOrName method --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aeb74a5..0fa247d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4342,16 +4342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); // TODO: Parameter check logic required. - UUID soundId = UUID.Zero; - if (!UUID.TryParse(impact_sound, out soundId)) - { - TaskInventoryItem item = m_host.Inventory.GetInventoryItem(impact_sound); - - if (item != null && item.Type == (int)AssetType.Sound) - soundId = item.AssetID; - } - - m_host.CollisionSound = soundId; + m_host.CollisionSound = KeyOrName(impact_sound, AssetType.Sound); m_host.CollisionSoundVolume = (float)impact_volume; } -- cgit v1.1 From 2bb041925160922be669d7e185fb5da6df0efd29 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 14:30:33 +0100 Subject: documenting some params on ISoundModule methods --- .../Region/Framework/Interfaces/ISoundModule.cs | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 2e53b16..68af492 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -100,18 +100,27 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Trigger or play an attached sound in this part's inventory. /// - /// - /// - /// - /// + /// Sound source ID + /// Sound asset ID + /// Sound volume + /// Triggered or not. /// - /// - /// - /// + /// Sound radius + /// Play using sound master + /// Play as sound master void SendSound(UUID objectID, UUID sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster); + /// + /// Trigger a sound to be played to all agents within an axis-aligned + /// bounding box. + /// + /// Sound source ID + /// Sound asset ID + /// Sound volume + /// AABB bottom south-west corner + /// AABB top north-east corner void TriggerSoundLimited(UUID objectID, UUID sound, double volume, Vector3 min, Vector3 max); } -- cgit v1.1 From e0b5a3cd900d8ad29cdb7d43415b069d5484a424 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 15:15:03 +0100 Subject: tweaking configuration logic so that the INonSharedRegionModule will load by default --- .../Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index ac7f7b4..68bd413 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -58,10 +58,15 @@ namespace OpenSim.Region.CoreModules.World.Sound IConfig config = configSource.Configs["Sounds"]; if (config == null) - return; - - Enabled = config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared"; - MaxDistance = config.GetFloat("MaxDistance", 100.0f); + { + Enabled = true; + MaxDistance = 100.0f; + } + else + { + Enabled = config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared"; + MaxDistance = config.GetFloat("MaxDistance", 100.0f); + } } public void AddRegion(Scene scene) { } -- cgit v1.1 From e308841de98ed3798b1c960c84831588b6598123 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 15:28:22 +0100 Subject: SianaGearz notes stop sound flag is 1 << 5, so using that for ISoundModule.StopSound rather than setting gain to zero --- OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 68bd413..c163e86 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -204,8 +204,7 @@ namespace OpenSim.Region.CoreModules.World.Sound foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) { part.Sound = UUID.Zero; - part.SoundGain = 0; - part.SoundFlags = 0; + part.SoundFlags = 1 << 5; part.SoundRadius = 0; part.ScheduleFullUpdate(); part.SendFullUpdateToAllClients(); @@ -216,8 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Sound else { m_host.Sound = UUID.Zero; - m_host.SoundGain = 0; - m_host.SoundFlags = 0; + m_host.SoundFlags = 1 << 5; m_host.SoundRadius = 0; m_host.ScheduleFullUpdate(); m_host.SendFullUpdateToAllClients(); @@ -226,8 +224,7 @@ namespace OpenSim.Region.CoreModules.World.Sound else { m_host.Sound = UUID.Zero; - m_host.SoundGain = 0; - m_host.SoundFlags = 0; + m_host.SoundFlags = 1 << 5; m_host.SoundRadius = 0; m_host.ScheduleFullUpdate(); m_host.SendFullUpdateToAllClients(); -- cgit v1.1 From a16ddbee4116fd1234bb2d53598616d5345c09c9 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 29 Oct 2012 16:05:02 +0000 Subject: Renaming module back to SoundModule as the hypothetical plan was to make another module using the shared region module interface, but this was pointed out by Melanie_T to be mostly pointless. --- .../Region/CoreModules/World/Sound/SoundModule.cs | 371 +++++++++++++++++++++ .../World/Sound/SoundModuleNonShared.cs | 371 --------------------- 2 files changed, 371 insertions(+), 371 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Sound/SoundModule.cs delete mode 100644 OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs new file mode 100644 index 0000000..1db6519 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -0,0 +1,371 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.Reflection; + +using Nini.Config; +using OpenMetaverse; +using log4net; +using Mono.Addins; + +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.CoreModules.World.Sound +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SoundModule")] + public class SoundModule : INonSharedRegionModule, ISoundModule + { + private static readonly ILog m_log = LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private Scene m_scene; + + public bool Enabled { get; private set; } + + public float MaxDistance { get; private set; } + + #region INonSharedRegionModule + + public void Initialise(IConfigSource configSource) + { + IConfig config = configSource.Configs["Sounds"]; + + if (config == null) + { + Enabled = true; + MaxDistance = 100.0f; + } + else + { + Enabled = config.GetString("Module", "SoundModule") == "SoundModule"; + MaxDistance = config.GetFloat("MaxDistance", 100.0f); + } + } + + public void AddRegion(Scene scene) { } + + public void RemoveRegion(Scene scene) + { + m_scene.EventManager.OnClientLogin -= OnNewClient; + } + + public void RegionLoaded(Scene scene) + { + if (!Enabled) + return; + + m_scene = scene; + m_scene.EventManager.OnClientLogin += OnNewClient; + + m_scene.RegisterModuleInterface(this); + } + + public void Close() { } + + public Type ReplaceableInterface + { + get { return typeof(ISoundModule); } + } + + public string Name { get { return "Sound Module"; } } + + #endregion + + #region Event Handlers + + private void OnNewClient(IClientAPI client) + { + client.OnSoundTrigger += TriggerSound; + } + + #endregion + + #region ISoundModule + + public virtual void PlayAttachedSound( + UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) + { + SceneObjectPart part; + if (!m_scene.TryGetSceneObjectPart(objectID, out part)) + return; + + SceneObjectGroup grp = part.ParentGroup; + + if (radius == 0) + radius = MaxDistance; + + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); + if (dis > MaxDistance) // Max audio distance + return; + + if (grp.IsAttachment) + { + if (grp.HasPrivateAttachmentPoint && sp.ControllingClient.AgentId != grp.OwnerID) + return; + + if (sp.ControllingClient.AgentId == grp.OwnerID) + dis = 0; + } + + // Scale by distance + double thisSpGain = gain * ((radius - dis) / radius); + + sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, + ownerID, (float)thisSpGain, flags); + }); + } + + public virtual void TriggerSound( + UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) + { + SceneObjectPart part; + if (!m_scene.TryGetSceneObjectPart(objectID, out part)) + { + ScenePresence sp; + if (!m_scene.TryGetScenePresence(ownerID, out sp)) + return; + } + else + { + SceneObjectGroup grp = part.ParentGroup; + + if (grp.IsAttachment && grp.AttachmentPoint > 30) + { + objectID = ownerID; + parentID = ownerID; + } + } + + if (radius == 0) + radius = MaxDistance; + + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); + + if (dis > MaxDistance) // Max audio distance + return; + + // Scale by distance + double thisSpGain = gain * ((radius - dis) / radius); + + sp.ControllingClient.SendTriggeredSound(soundId, ownerID, + objectID, parentID, handle, position, + (float)thisSpGain); + }); + } + + public virtual void StopSound(UUID objectID) + { + SceneObjectPart m_host; + if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) + return; + + StopSound(m_host); + } + + private static void StopSound(SceneObjectPart m_host) + { + m_host.AdjustSoundGain(0); + // Xantor 20080528: Clear prim data of sound instead + if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) + { + if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) + { + foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) + { + part.Sound = UUID.Zero; + part.SoundFlags = 1 << 5; + part.SoundRadius = 0; + part.ScheduleFullUpdate(); + part.SendFullUpdateToAllClients(); + } + m_host.ParentGroup.LoopSoundMasterPrim = null; + m_host.ParentGroup.LoopSoundSlavePrims.Clear(); + } + else + { + m_host.Sound = UUID.Zero; + m_host.SoundFlags = 1 << 5; + m_host.SoundRadius = 0; + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); + } + } + else + { + m_host.Sound = UUID.Zero; + m_host.SoundFlags = 1 << 5; + m_host.SoundRadius = 0; + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); + } + } + + public virtual void PreloadSound(UUID objectID, UUID soundID, float radius) + { + SceneObjectPart part; + if (soundID == UUID.Zero + || !m_scene.TryGetSceneObjectPart(objectID, out part)) + { + return; + } + + if (radius == 0) + radius = MaxDistance; + + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + if (!(Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) >= MaxDistance)) + sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); + }); + } + + // Xantor 20080528 we should do this differently. + // 1) apply the sound to the object + // 2) schedule full update + // just sending the sound out once doesn't work so well when other avatars come in view later on + // or when the prim gets moved, changed, sat on, whatever + // see large number of mantises (mantes?) + // 20080530 Updated to remove code duplication + // 20080530 Stop sound if there is one, otherwise volume only changes don't work + public void LoopSound(UUID objectID, UUID soundID, + double volume, double radius, bool isMaster) + { + SceneObjectPart m_host; + if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) + return; + + if (isMaster) + m_host.ParentGroup.LoopSoundMasterPrim = m_host; + + if (m_host.Sound != UUID.Zero) + StopSound(m_host); + + m_host.Sound = soundID; + m_host.SoundGain = volume; + m_host.SoundFlags = 1; // looping + m_host.SoundRadius = radius; + + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); + } + + public void SendSound(UUID objectID, UUID soundID, double volume, + bool triggered, byte flags, float radius, bool useMaster, + bool isMaster) + { + if (soundID == UUID.Zero) + return; + + SceneObjectPart part; + if (!m_scene.TryGetSceneObjectPart(objectID, out part)) + return; + + volume = Util.Clip((float)volume, 0, 1); + + UUID parentID = part.ParentGroup.UUID; + + Vector3 position = part.AbsolutePosition; // region local + ulong regionHandle = m_scene.RegionInfo.RegionHandle; + + if (useMaster) + { + if (isMaster) + { + if (triggered) + TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); + else + PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); + part.ParentGroup.PlaySoundMasterPrim = part; + if (triggered) + TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); + else + PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); + foreach (SceneObjectPart prim in part.ParentGroup.PlaySoundSlavePrims) + { + position = prim.AbsolutePosition; // region local + if (triggered) + TriggerSound(soundID, part.OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); + else + PlayAttachedSound(soundID, part.OwnerID, prim.UUID, volume, position, flags, radius); + } + part.ParentGroup.PlaySoundSlavePrims.Clear(); + part.ParentGroup.PlaySoundMasterPrim = null; + } + else + { + part.ParentGroup.PlaySoundSlavePrims.Add(part); + } + } + else + { + if (triggered) + TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); + else + PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); + } + } + + public void TriggerSoundLimited(UUID objectID, UUID sound, + double volume, Vector3 min, Vector3 max) + { + if (sound == UUID.Zero) + return; + + SceneObjectPart part; + if (!m_scene.TryGetSceneObjectPart(objectID, out part)) + return; + + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + double dis = Util.GetDistanceTo(sp.AbsolutePosition, + part.AbsolutePosition); + + if (dis > MaxDistance) // Max audio distance + return; + else if (!Util.IsInsideBox(sp.AbsolutePosition, min, max)) + return; + + // Scale by distance + double thisSpGain = volume * ((MaxDistance - dis) / MaxDistance); + + sp.ControllingClient.SendTriggeredSound(sound, part.OwnerID, + part.UUID, part.ParentGroup.UUID, + m_scene.RegionInfo.RegionHandle, + part.AbsolutePosition, (float)thisSpGain); + }); + } + + #endregion + } +} diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs deleted file mode 100644 index c163e86..0000000 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections.Generic; -using System.Reflection; - -using Nini.Config; -using OpenMetaverse; -using log4net; -using Mono.Addins; - -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.CoreModules.World.Sound -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SoundModuleNonShared")] - public class SoundModuleNonShared : INonSharedRegionModule, ISoundModule - { - private static readonly ILog m_log = LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - private Scene m_scene; - - public bool Enabled { get; private set; } - - public float MaxDistance { get; private set; } - - #region INonSharedRegionModule - - public void Initialise(IConfigSource configSource) - { - IConfig config = configSource.Configs["Sounds"]; - - if (config == null) - { - Enabled = true; - MaxDistance = 100.0f; - } - else - { - Enabled = config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared"; - MaxDistance = config.GetFloat("MaxDistance", 100.0f); - } - } - - public void AddRegion(Scene scene) { } - - public void RemoveRegion(Scene scene) - { - m_scene.EventManager.OnClientLogin -= OnNewClient; - } - - public void RegionLoaded(Scene scene) - { - if (!Enabled) - return; - - m_scene = scene; - m_scene.EventManager.OnClientLogin += OnNewClient; - - m_scene.RegisterModuleInterface(this); - } - - public void Close() { } - - public Type ReplaceableInterface - { - get { return typeof(ISoundModule); } - } - - public string Name { get { return "Sound Module"; } } - - #endregion - - #region Event Handlers - - private void OnNewClient(IClientAPI client) - { - client.OnSoundTrigger += TriggerSound; - } - - #endregion - - #region ISoundModule - - public virtual void PlayAttachedSound( - UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) - { - SceneObjectPart part; - if (!m_scene.TryGetSceneObjectPart(objectID, out part)) - return; - - SceneObjectGroup grp = part.ParentGroup; - - if (radius == 0) - radius = MaxDistance; - - m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) - { - double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); - if (dis > MaxDistance) // Max audio distance - return; - - if (grp.IsAttachment) - { - if (grp.HasPrivateAttachmentPoint && sp.ControllingClient.AgentId != grp.OwnerID) - return; - - if (sp.ControllingClient.AgentId == grp.OwnerID) - dis = 0; - } - - // Scale by distance - double thisSpGain = gain * ((radius - dis) / radius); - - sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, - ownerID, (float)thisSpGain, flags); - }); - } - - public virtual void TriggerSound( - UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) - { - SceneObjectPart part; - if (!m_scene.TryGetSceneObjectPart(objectID, out part)) - { - ScenePresence sp; - if (!m_scene.TryGetScenePresence(ownerID, out sp)) - return; - } - else - { - SceneObjectGroup grp = part.ParentGroup; - - if (grp.IsAttachment && grp.AttachmentPoint > 30) - { - objectID = ownerID; - parentID = ownerID; - } - } - - if (radius == 0) - radius = MaxDistance; - - m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) - { - double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); - - if (dis > MaxDistance) // Max audio distance - return; - - // Scale by distance - double thisSpGain = gain * ((radius - dis) / radius); - - sp.ControllingClient.SendTriggeredSound(soundId, ownerID, - objectID, parentID, handle, position, - (float)thisSpGain); - }); - } - - public virtual void StopSound(UUID objectID) - { - SceneObjectPart m_host; - if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) - return; - - StopSound(m_host); - } - - private static void StopSound(SceneObjectPart m_host) - { - m_host.AdjustSoundGain(0); - // Xantor 20080528: Clear prim data of sound instead - if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) - { - if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) - { - foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) - { - part.Sound = UUID.Zero; - part.SoundFlags = 1 << 5; - part.SoundRadius = 0; - part.ScheduleFullUpdate(); - part.SendFullUpdateToAllClients(); - } - m_host.ParentGroup.LoopSoundMasterPrim = null; - m_host.ParentGroup.LoopSoundSlavePrims.Clear(); - } - else - { - m_host.Sound = UUID.Zero; - m_host.SoundFlags = 1 << 5; - m_host.SoundRadius = 0; - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); - } - } - else - { - m_host.Sound = UUID.Zero; - m_host.SoundFlags = 1 << 5; - m_host.SoundRadius = 0; - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); - } - } - - public virtual void PreloadSound(UUID objectID, UUID soundID, float radius) - { - SceneObjectPart part; - if (soundID == UUID.Zero - || !m_scene.TryGetSceneObjectPart(objectID, out part)) - { - return; - } - - if (radius == 0) - radius = MaxDistance; - - m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) - { - if (!(Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) >= MaxDistance)) - sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); - }); - } - - // Xantor 20080528 we should do this differently. - // 1) apply the sound to the object - // 2) schedule full update - // just sending the sound out once doesn't work so well when other avatars come in view later on - // or when the prim gets moved, changed, sat on, whatever - // see large number of mantises (mantes?) - // 20080530 Updated to remove code duplication - // 20080530 Stop sound if there is one, otherwise volume only changes don't work - public void LoopSound(UUID objectID, UUID soundID, - double volume, double radius, bool isMaster) - { - SceneObjectPart m_host; - if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) - return; - - if (isMaster) - m_host.ParentGroup.LoopSoundMasterPrim = m_host; - - if (m_host.Sound != UUID.Zero) - StopSound(m_host); - - m_host.Sound = soundID; - m_host.SoundGain = volume; - m_host.SoundFlags = 1; // looping - m_host.SoundRadius = radius; - - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); - } - - public void SendSound(UUID objectID, UUID soundID, double volume, - bool triggered, byte flags, float radius, bool useMaster, - bool isMaster) - { - if (soundID == UUID.Zero) - return; - - SceneObjectPart part; - if (!m_scene.TryGetSceneObjectPart(objectID, out part)) - return; - - volume = Util.Clip((float)volume, 0, 1); - - UUID parentID = part.ParentGroup.UUID; - - Vector3 position = part.AbsolutePosition; // region local - ulong regionHandle = m_scene.RegionInfo.RegionHandle; - - if (useMaster) - { - if (isMaster) - { - if (triggered) - TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); - else - PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); - part.ParentGroup.PlaySoundMasterPrim = part; - if (triggered) - TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); - else - PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); - foreach (SceneObjectPart prim in part.ParentGroup.PlaySoundSlavePrims) - { - position = prim.AbsolutePosition; // region local - if (triggered) - TriggerSound(soundID, part.OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); - else - PlayAttachedSound(soundID, part.OwnerID, prim.UUID, volume, position, flags, radius); - } - part.ParentGroup.PlaySoundSlavePrims.Clear(); - part.ParentGroup.PlaySoundMasterPrim = null; - } - else - { - part.ParentGroup.PlaySoundSlavePrims.Add(part); - } - } - else - { - if (triggered) - TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); - else - PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); - } - } - - public void TriggerSoundLimited(UUID objectID, UUID sound, - double volume, Vector3 min, Vector3 max) - { - if (sound == UUID.Zero) - return; - - SceneObjectPart part; - if (!m_scene.TryGetSceneObjectPart(objectID, out part)) - return; - - m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) - { - double dis = Util.GetDistanceTo(sp.AbsolutePosition, - part.AbsolutePosition); - - if (dis > MaxDistance) // Max audio distance - return; - else if (!Util.IsInsideBox(sp.AbsolutePosition, min, max)) - return; - - // Scale by distance - double thisSpGain = volume * ((MaxDistance - dis) / MaxDistance); - - sp.ControllingClient.SendTriggeredSound(sound, part.OwnerID, - part.UUID, part.ParentGroup.UUID, - m_scene.RegionInfo.RegionHandle, - part.AbsolutePosition, (float)thisSpGain); - }); - } - - #endregion - } -} -- cgit v1.1 From a09cba6da363606f0e2d63118b63f5b05232c452 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 29 Oct 2012 16:17:18 +0000 Subject: refactoring to use assembly:classname style of configuration --- OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 1db6519..513a8f5 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; +using System.IO; using System.Collections.Generic; using System.Reflection; @@ -64,7 +65,9 @@ namespace OpenSim.Region.CoreModules.World.Sound } else { - Enabled = config.GetString("Module", "SoundModule") == "SoundModule"; + Enabled = config.GetString("Module", "OpenSim.Region.CoreModules.dll:SoundModule") == + Path.GetFileName(Assembly.GetExecutingAssembly().Location) + + ":" + MethodBase.GetCurrentMethod().DeclaringType.Name; MaxDistance = config.GetFloat("MaxDistance", 100.0f); } } -- cgit v1.1 From aeeed29d627f7d40bbcc160bf446a019b54e8b32 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Oct 2012 01:07:14 +0000 Subject: correct ODEPrim.MeshAssetReveived -> MeshAssetReceived --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 2548648..7c46ff8 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -3335,7 +3335,6 @@ Console.WriteLine(" JointCreateFixed"); m_material = pMaterial; } - private void CheckMeshAsset() { if (_pbs.SculptEntry && !m_assetFailed && _pbs.SculptTexture != UUID.Zero) @@ -3345,12 +3344,12 @@ Console.WriteLine(" JointCreateFixed"); { RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; if (assetProvider != null) - assetProvider(_pbs.SculptTexture, MeshAssetReveived); + assetProvider(_pbs.SculptTexture, MeshAssetReceived); }); } } - void MeshAssetReveived(AssetBase asset) + void MeshAssetReceived(AssetBase asset) { if (asset.Data != null && asset.Data.Length > 0) { -- cgit v1.1 From 37de965233ad6c25c2ce7a29d89762aa478a6147 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Oct 2012 01:08:00 +0000 Subject: Make MeshAssetReceived private. Keep methods private unless they need to be opened up to external callers. Reduces analysis complexity. --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 7c46ff8..5b49e3b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -3349,7 +3349,7 @@ Console.WriteLine(" JointCreateFixed"); } } - void MeshAssetReceived(AssetBase asset) + private void MeshAssetReceived(AssetBase asset) { if (asset.Data != null && asset.Data.Length > 0) { -- cgit v1.1