From ea47b0362548101d201f3bef26436d3420d791fd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 May 2012 12:27:49 +0100 Subject: Added a invalidCollisionSoundUUID so that scripts can stop all collision sounds with llCollisionSound("",...). UUID.Zero means defaults should be used. In case part has several scripts with confliting llCollisionSound result depende on exec order. Specially on reset the efect of "" depends on reset order, it should override the others. This is intermediate improve(?) since collisions sounds seem to need a deaper revision. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8716e20..2fb42f4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1336,11 +1336,13 @@ namespace OpenSim.Region.Framework.Scenes set { m_sitAnimation = value; } } + public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); + public UUID CollisionSound { get { return m_collisionSound; } set - { + { m_collisionSound = value; aggregateScriptEvents(); } @@ -2655,8 +2657,15 @@ namespace OpenSim.Region.Framework.Scenes bool IsNotVolumeDtc = !VolumeDetectActive; - if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) - SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) + { + if(CollisionSound != UUID.Zero) + SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + else + { + // default sounds + } + } SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); if (IsNotVolumeDtc) @@ -4743,7 +4752,7 @@ namespace OpenSim.Region.Framework.Scenes pa.OnCollisionUpdate -= PhysicsCollision; - bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); + bool hassound = ( CollisionSound != invalidCollisionSoundUUID); scriptEvents CombinedEvents = AggregateScriptEvents; // merge with root part -- cgit v1.1 From 0de7219485b55ce297d963c46e5ba869eeb1b8e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 May 2012 23:36:37 +0100 Subject: collision sounds: simplify send code a bit and limit sending rate to 5 per sec per part ??? --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2fb42f4..38e7a12 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -188,6 +188,7 @@ namespace OpenSim.Region.Framework.Scenes public double SoundRadius; + public uint TimeStampFull; public uint TimeStampLastActivity; // Will be used for AutoReturn @@ -332,6 +333,8 @@ namespace OpenSim.Region.Framework.Scenes private UUID m_collisionSound; private float m_collisionSoundVolume; + private DateTime LastColSoundSentTime; + private SOPVehicle m_vehicle = null; @@ -371,6 +374,7 @@ namespace OpenSim.Region.Framework.Scenes // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log m_inventory = new SceneObjectPartInventory(this); + LastColSoundSentTime = DateTime.UtcNow; } /// @@ -2660,7 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) { if(CollisionSound != UUID.Zero) - SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + SendCollisionSound(CollisionSound, CollisionSoundVolume); else { // default sounds @@ -3199,6 +3203,37 @@ namespace OpenSim.Region.Framework.Scenes } } + public void SendCollisionSound(UUID soundID, double volume) + { + if (soundID == UUID.Zero) + return; + + + ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); + if (soundModule == null) + return; + + if (volume > 1) + volume = 1; + if (volume < 0) + volume = 0; + + DateTime now = DateTime.UtcNow; + if((now - LastColSoundSentTime).Milliseconds < 200) // reduce rate to 5 per sec per part ?? + return; + + LastColSoundSentTime = now; + + UUID ownerID = OwnerID; + UUID objectID = ParentGroup.RootPart.UUID; + UUID parentID = ParentGroup.UUID; + Vector3 position = AbsolutePosition; // region local + ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; + + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0); + } + + /// /// Send a terse update to all clients /// -- cgit v1.1 From 7cbc54d92a4702efb8a7bc1b0ec611c4abbc104b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 01:04:30 +0100 Subject: default collision sounds. Incomplete, untested, needs revision --- OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 204 +++++++++++++++++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 2 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Region/Framework/Scenes/CollisionSounds.cs (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs new file mode 100644 index 0000000..65c8012 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs @@ -0,0 +1,204 @@ +/* + * 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. + */ +// Ubit 2012 + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Region.Framework.Scenes +{ + public static class CollisionSounds + { + // defines for cases + // only know one UUID for now (woodflesh) + + private const int MaxMaterials = 7; + // part part + private static UUID snd_StoneStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_StoneMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_StoneGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_StoneWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_StoneFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_StonePlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_StoneRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + + private static UUID snd_MetalStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_MetalMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_MetalGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_MetalWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_MetalFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_MetalPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_MetalRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + + private static UUID snd_GlassStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_GlassMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_GlassGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_GlassWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_GlassFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_GlassPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_GlassRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + + private static UUID snd_WoodStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_WoodMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_WoodGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_WoodWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_WoodFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_WoodPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_WoodRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + + private static UUID snd_FleshStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_FleshMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_FleshGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_FleshWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_FleshFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_FleshPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_FleshRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + + private static UUID snd_PlasticStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_PlasticMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_PlasticGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_PlasticWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_PlasticFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_PlasticPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_PlasticRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + + private static UUID snd_RubberStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_RubberMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_RubberGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_RubberWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_RubberFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_RubberPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_RubberRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + + // terrain part + private static UUID snd_TerrainStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_TerrainMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_TerrainGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_TerrainWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_TerrainFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_TerrainPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_TerrainRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + + public static UUID[] m_TerrainPart = { + snd_TerrainStone, + snd_TerrainMetal, + snd_TerrainGlass, + snd_TerrainWood, + snd_TerrainFlesh, + snd_TerrainPlastic, + snd_TerrainRubber + }; + + public static UUID[] m_PartPart = { + snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, + snd_MetalStone, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber, + snd_GlassStone, snd_GlassMetal, snd_GlassGlass, snd_GlassWood, snd_GlassFlesh, snd_GlassPlastic, snd_GlassRubber, + snd_WoodStone, snd_WoodMetal, snd_WoodGlass, snd_WoodWood, snd_WoodFlesh, snd_WoodPlastic, snd_WoodRubber, + snd_FleshStone, snd_FleshMetal, snd_FleshGlass, snd_FleshWood, snd_FleshFlesh, snd_FleshPlastic, snd_FleshRubber, + snd_PlasticStone, snd_PlasticMetal, snd_PlasticGlass, snd_PlasticWood, snd_PlasticFlesh, snd_PlasticPlastic, snd_PlasticRubber, + snd_RubberStone, snd_RubberMetal, snd_RubberGlass, snd_RubberWood, snd_RubberFlesh, snd_RubberPlastic, snd_RubberRubber + }; + + public static void PartCollisionSound(SceneObjectPart part,List Colliders) + { + if(Colliders.Count == 0 || part == null) + return; + + if ((part.Flags & PrimFlags.Physics) == 0) // let only active prims trigger sounds + return; + + if (part.ParentGroup == null) + return; + + if (part.CollisionSound == part.invalidCollisionSoundUUID) + return; + + UUID soundID; + int otherMaterial; + + int thisMaterial = (int) part.Material; + if (thisMaterial >= MaxMaterials) + thisMaterial = 3; + + int thisMatScaled = thisMaterial * MaxMaterials; + int index; + + bool doneownsound = false; + + foreach (uint Id in Colliders) + { + if (Id == 0) + { + if (!doneownsound) + { + soundID = m_TerrainPart[thisMaterial]; + part.SendCollisionSound(soundID, 1.0); + doneownsound = true; + } + continue; + } + + SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(Id); + if (otherPart != null) + { + if (otherPart.CollisionSound == part.invalidCollisionSoundUUID) + continue; + if (otherPart.CollisionSound != UUID.Zero) + otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); + else + { + otherMaterial = (int)otherPart.Material; + if (otherMaterial >= MaxMaterials) + otherMaterial = 3; + index = thisMatScaled + otherMaterial; + soundID = m_PartPart[index]; + if (doneownsound) + otherPart.SendCollisionSound(soundID, 1.0); + else + { + part.SendCollisionSound(soundID, 1.0); + doneownsound = true; + } + } + } + else if (!doneownsound) + { + ScenePresence av = part.ParentGroup.Scene.GetScenePresence(Id); + if (av != null && (!av.IsChildAgent)) + { + index = thisMatScaled + 4; // flesh + soundID = m_PartPart[index]; + part.SendCollisionSound(soundID, 1.0); + doneownsound = true; + } + } + } + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 38e7a12..af9b7eb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2667,7 +2667,7 @@ namespace OpenSim.Region.Framework.Scenes SendCollisionSound(CollisionSound, CollisionSoundVolume); else { - // default sounds + CollisionSounds.PartCollisionSound(this, startedColliders); } } -- cgit v1.1 From b743835f9ed665c85eb78569b2bc31853eb64332 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 01:36:42 +0100 Subject: default colisionVolume is 0, use it only for user specified sound --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index af9b7eb..5874d34 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2661,10 +2661,13 @@ namespace OpenSim.Region.Framework.Scenes bool IsNotVolumeDtc = !VolumeDetectActive; - if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) + if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) { - if(CollisionSound != UUID.Zero) - SendCollisionSound(CollisionSound, CollisionSoundVolume); + if (CollisionSound != UUID.Zero) + { + if (CollisionSoundVolume > 0.0f) + SendCollisionSound(CollisionSound, CollisionSoundVolume); + } else { CollisionSounds.PartCollisionSound(this, startedColliders); -- cgit v1.1 From 038986baffff3d2a6b2ec4f10ae8c40635b5398b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 04:14:13 +0100 Subject: add avatar colision sounds. Changed test sound UUID --- OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 180 ++++++++++++++------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 + 2 files changed, 120 insertions(+), 62 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index 65c8012..a22ee10 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs @@ -40,70 +40,70 @@ namespace OpenSim.Region.Framework.Scenes private const int MaxMaterials = 7; // part part - private static UUID snd_StoneStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_StoneMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_StoneGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_StoneWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_StoneFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_StonePlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_StoneRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - - private static UUID snd_MetalStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_MetalMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_MetalGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_MetalWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_MetalFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_MetalPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_MetalRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - - private static UUID snd_GlassStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_GlassMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_GlassGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_GlassWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_GlassFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_GlassPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_GlassRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - - private static UUID snd_WoodStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_WoodMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_WoodGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_WoodWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_WoodFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_WoodPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_WoodRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - - private static UUID snd_FleshStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_FleshMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_FleshGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_FleshWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_FleshFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_FleshPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_FleshRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - - private static UUID snd_PlasticStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_PlasticMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_PlasticGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_PlasticWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_PlasticFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_PlasticPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_PlasticRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - - private static UUID snd_RubberStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_RubberMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_RubberGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_RubberWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_RubberFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_RubberPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_RubberRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_StoneStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_StoneWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + + private static UUID snd_MetalStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_MetalMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_MetalWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + + private static UUID snd_GlassStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_GlassMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_GlassGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_GlassWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + + private static UUID snd_WoodStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_WoodMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_WoodGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_WoodWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_WoodFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_WoodPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_WoodRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + + private static UUID snd_FleshStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_FleshMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_FleshGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_FleshWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_FleshFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + + private static UUID snd_PlasticStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_PlasticMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_PlasticGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_PlasticWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_PlasticFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_PlasticPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + + private static UUID snd_RubberStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_RubberMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_RubberGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_RubberWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_RubberFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_RubberPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_RubberRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); // terrain part - private static UUID snd_TerrainStone = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_TerrainMetal = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_TerrainGlass = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_TerrainWood = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_TerrainFlesh = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_TerrainPlastic = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); - private static UUID snd_TerrainRubber = new UUID("be582e5d-b123-41a2-a150-454c39e961c8"); + private static UUID snd_TerrainStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_TerrainMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_TerrainGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_TerrainWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_TerrainFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_TerrainPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); + private static UUID snd_TerrainRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); public static UUID[] m_TerrainPart = { snd_TerrainStone, @@ -187,6 +187,7 @@ namespace OpenSim.Region.Framework.Scenes } } } +/* avatars get notification let them trigger the sound else if (!doneownsound) { ScenePresence av = part.ParentGroup.Scene.GetScenePresence(Id); @@ -198,7 +199,62 @@ namespace OpenSim.Region.Framework.Scenes doneownsound = true; } } + */ + } + } + + public static void AvatarCollisionSound(ScenePresence av, List Colliders) + { + if (Colliders.Count == 0 || av == null) + return; + + UUID soundID; + int otherMaterial; + + int thisMaterial = 3; + + int thisMatScaled = thisMaterial * MaxMaterials; + int index; +// bool doneownsound = false; + + foreach (uint Id in Colliders) + { + if (Id == 0) + { + continue; + } + + SceneObjectPart otherPart = av.Scene.GetSceneObjectPart(Id); + if (otherPart != null) + { + if (otherPart.CollisionSound == otherPart.invalidCollisionSoundUUID) + continue; + if (otherPart.CollisionSound != UUID.Zero) + otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); + else + { + otherMaterial = (int)otherPart.Material; + if (otherMaterial >= MaxMaterials) + otherMaterial = 3; + index = thisMatScaled + otherMaterial; + soundID = m_PartPart[index]; + otherPart.SendCollisionSound(soundID, 1.0); + } + } +/* + else if (!doneownsound) + { + ScenePresence otherav = av.Scene.GetScenePresence(Id); + if (otherav != null && (!otherav.IsChildAgent)) + { + soundID = snd_FleshFlesh; + av.SendCollisionSound(soundID, 1.0); + doneownsound = true; + } + } + */ } } + } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ba0ed95..b8c33b0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4145,6 +4145,8 @@ namespace OpenSim.Region.Framework.Scenes // do event notification if (startedColliders.Count > 0) { + CollisionSounds.AvatarCollisionSound(this, startedColliders); + ColliderArgs StartCollidingMessage = new ColliderArgs(); List colliding = new List(); foreach (uint localId in startedColliders) -- cgit v1.1 From e4231e95a976f8b3c02add39b94721eebb639674 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 04:41:46 +0100 Subject: increase avatars collisions report to 10 per sec, Stopped sound on avatar to volumedetect collision --- OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index a22ee10..c46756c 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs @@ -167,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(Id); if (otherPart != null) { - if (otherPart.CollisionSound == part.invalidCollisionSoundUUID) + if (otherPart.CollisionSound == part.invalidCollisionSoundUUID || otherPart.VolumeDetectActive) continue; if (otherPart.CollisionSound != UUID.Zero) otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b8c33b0..ebddf21 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3425,7 +3425,7 @@ namespace OpenSim.Region.Framework.Scenes //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong - PhysicsActor.SubscribeEvents(500); + PhysicsActor.SubscribeEvents(100); PhysicsActor.LocalID = LocalId; } -- cgit v1.1 From 6af78836a540c9b0a5972ab241364dae52e8e74d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 12:17:29 +0100 Subject: trigger collision sounds on active agent position for better spatial effect without using the detailed collision position. (current error will be half max physical prim size). Moved some checks from sop to collisionSound code --- OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 25 ++++++++++++++++------ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 ++++------------- 2 files changed, 22 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index c46756c..5d43027 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs @@ -130,7 +130,7 @@ namespace OpenSim.Region.Framework.Scenes if(Colliders.Count == 0 || part == null) return; - if ((part.Flags & PrimFlags.Physics) == 0) // let only active prims trigger sounds + if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) return; if (part.ParentGroup == null) @@ -142,6 +142,15 @@ namespace OpenSim.Region.Framework.Scenes UUID soundID; int otherMaterial; + Vector3 position = part.AbsolutePosition; + + if (part.CollisionSound != UUID.Zero) + { + if (part.CollisionSoundVolume > 0.0f) + part.SendCollisionSound(part.CollisionSound, part.CollisionSoundVolume, position); + return; + } + int thisMaterial = (int) part.Material; if (thisMaterial >= MaxMaterials) thisMaterial = 3; @@ -158,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes if (!doneownsound) { soundID = m_TerrainPart[thisMaterial]; - part.SendCollisionSound(soundID, 1.0); + part.SendCollisionSound(soundID, 1.0, position); doneownsound = true; } continue; @@ -170,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes if (otherPart.CollisionSound == part.invalidCollisionSoundUUID || otherPart.VolumeDetectActive) continue; if (otherPart.CollisionSound != UUID.Zero) - otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); + otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); else { otherMaterial = (int)otherPart.Material; @@ -179,10 +188,10 @@ namespace OpenSim.Region.Framework.Scenes index = thisMatScaled + otherMaterial; soundID = m_PartPart[index]; if (doneownsound) - otherPart.SendCollisionSound(soundID, 1.0); + otherPart.SendCollisionSound(soundID, 1.0, position); else { - part.SendCollisionSound(soundID, 1.0); + part.SendCollisionSound(soundID, 1.0, position); doneownsound = true; } } @@ -217,6 +226,8 @@ namespace OpenSim.Region.Framework.Scenes int index; // bool doneownsound = false; + Vector3 position = av.AbsolutePosition; + foreach (uint Id in Colliders) { if (Id == 0) @@ -230,7 +241,7 @@ namespace OpenSim.Region.Framework.Scenes if (otherPart.CollisionSound == otherPart.invalidCollisionSoundUUID) continue; if (otherPart.CollisionSound != UUID.Zero) - otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); + otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); else { otherMaterial = (int)otherPart.Material; @@ -238,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes otherMaterial = 3; index = thisMatScaled + otherMaterial; soundID = m_PartPart[index]; - otherPart.SendCollisionSound(soundID, 1.0); + otherPart.SendCollisionSound(soundID, 1.0, position); } } /* diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5874d34..b5705b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2632,7 +2632,6 @@ namespace OpenSim.Region.Framework.Scenes else { - // calculate things that started colliding this time // and build up list of colliders this time foreach (uint localid in collissionswith.Keys) @@ -2657,22 +2656,13 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localID in endedColliders) m_lastColliders.Remove(localID); } + // play the sound. bool IsNotVolumeDtc = !VolumeDetectActive; if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) - { - if (CollisionSound != UUID.Zero) - { - if (CollisionSoundVolume > 0.0f) - SendCollisionSound(CollisionSound, CollisionSoundVolume); - } - else - { - CollisionSounds.PartCollisionSound(this, startedColliders); - } - } + CollisionSounds.PartCollisionSound(this, startedColliders); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); if (IsNotVolumeDtc) @@ -3206,12 +3196,11 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SendCollisionSound(UUID soundID, double volume) + public void SendCollisionSound(UUID soundID, double volume, Vector3 position) { if (soundID == UUID.Zero) return; - ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface(); if (soundModule == null) return; @@ -3230,10 +3219,9 @@ namespace OpenSim.Region.Framework.Scenes UUID ownerID = OwnerID; UUID objectID = ParentGroup.RootPart.UUID; UUID parentID = ParentGroup.UUID; - Vector3 position = AbsolutePosition; // region local ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0); + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); } -- cgit v1.1