aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorSignpostMarv2012-10-16 12:24:33 +0100
committerJustin Clark-Casey (justincc)2012-10-29 23:39:00 +0000
commit5abcecc7356bf58c479a7cff86581131a6ab3c9e (patch)
tree73a621d699527ada735b8518cd32074858f0c3c9 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentfixing a bug in SceneObjectPart.SendSound where sounds would always come from... (diff)
downloadopensim-SC-5abcecc7356bf58c479a7cff86581131a6ab3c9e.zip
opensim-SC-5abcecc7356bf58c479a7cff86581131a6ab3c9e.tar.gz
opensim-SC-5abcecc7356bf58c479a7cff86581131a6ab3c9e.tar.bz2
opensim-SC-5abcecc7356bf58c479a7cff86581131a6ab3c9e.tar.xz
moving SendSound from SceneObjectPart to ISoundModule
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs88
1 files changed, 9 insertions, 79 deletions
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
2239 2239
2240 // play the sound. 2240 // play the sound.
2241 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) 2241 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
2242 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); 2242 {
2243 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
2244 if (soundModule != null)
2245 {
2246 soundModule.SendSound(UUID, CollisionSound.ToString(),
2247 CollisionSoundVolume, true, (byte)0, 0, false,
2248 false);
2249 }
2250 }
2243 2251
2244 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); 2252 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart);
2245 SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); 2253 SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding);
@@ -2645,84 +2653,6 @@ namespace OpenSim.Region.Framework.Scenes
2645 } 2653 }
2646 2654
2647 /// <summary> 2655 /// <summary>
2648 /// Trigger or play an attached sound in this part's inventory.
2649 /// </summary>
2650 /// <param name="sound"></param>
2651 /// <param name="volume"></param>
2652 /// <param name="triggered"></param>
2653 /// <param name="flags"></param>
2654 public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
2655 {
2656 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
2657 if(soundModule == null)
2658 return;
2659
2660 volume = Util.Clip((float)volume, 0, 1);
2661
2662 UUID parentID = ParentGroup.UUID;
2663
2664 UUID soundID = UUID.Zero;
2665 Vector3 position = AbsolutePosition; // region local
2666 ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
2667
2668 if (!UUID.TryParse(sound, out soundID))
2669 {
2670 // search sound file from inventory
2671 lock (TaskInventory)
2672 {
2673 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2674 {
2675 if (item.Value.Type == (int)AssetType.Sound && item.Value.Name == sound)
2676 {
2677 soundID = item.Value.ItemID;
2678 break;
2679 }
2680 }
2681 }
2682 }
2683
2684 if (soundID == UUID.Zero)
2685 return;
2686
2687 if (useMaster)
2688 {
2689 if (isMaster)
2690 {
2691 if (triggered)
2692 soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius);
2693 else
2694 soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius);
2695 ParentGroup.PlaySoundMasterPrim = this;
2696 if (triggered)
2697 soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius);
2698 else
2699 soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius);
2700 foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
2701 {
2702 position = prim.AbsolutePosition; // region local
2703 if (triggered)
2704 soundModule.TriggerSound(soundID, OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius);
2705 else
2706 soundModule.PlayAttachedSound(soundID, OwnerID, prim.UUID, volume, position, flags, radius);
2707 }
2708 ParentGroup.PlaySoundSlavePrims.Clear();
2709 ParentGroup.PlaySoundMasterPrim = null;
2710 }
2711 else
2712 {
2713 ParentGroup.PlaySoundSlavePrims.Add(this);
2714 }
2715 }
2716 else
2717 {
2718 if (triggered)
2719 soundModule.TriggerSound(soundID, OwnerID, UUID, parentID, volume, position, regionHandle, radius);
2720 else
2721 soundModule.PlayAttachedSound(soundID, OwnerID, UUID, volume, position, flags, radius);
2722 }
2723 }
2724
2725 /// <summary>
2726 /// Send a terse update to all clients 2656 /// Send a terse update to all clients
2727 /// </summary> 2657 /// </summary>
2728 public void SendTerseUpdateToAllClients() 2658 public void SendTerseUpdateToAllClients()