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
---
.../Region/Framework/Interfaces/ISoundModule.cs | 15 ++++
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 88 +++-------------------
2 files changed, 24 insertions(+), 79 deletions(-)
(limited to 'OpenSim/Region/Framework')
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()
--
cgit v1.1