diff options
Diffstat (limited to '')
5 files changed, 119 insertions, 86 deletions
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 | |||
278 | m_host.SendFullUpdateToAllClients(); | 278 | m_host.SendFullUpdateToAllClients(); |
279 | } | 279 | } |
280 | 280 | ||
281 | public void SendSound(UUID objectID, string sound, double volume, | ||
282 | bool triggered, byte flags, float radius, bool useMaster, | ||
283 | bool isMaster) | ||
284 | { | ||
285 | SceneObjectPart part; | ||
286 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) | ||
287 | return; | ||
288 | |||
289 | volume = Util.Clip((float)volume, 0, 1); | ||
290 | |||
291 | UUID parentID = part.ParentGroup.UUID; | ||
292 | |||
293 | UUID soundID = UUID.Zero; | ||
294 | Vector3 position = part.AbsolutePosition; // region local | ||
295 | ulong regionHandle = m_scene.RegionInfo.RegionHandle; | ||
296 | |||
297 | if (!UUID.TryParse(sound, out soundID)) | ||
298 | { | ||
299 | // search sound file from inventory | ||
300 | lock (part.TaskInventory) | ||
301 | { | ||
302 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in part.TaskInventory) | ||
303 | { | ||
304 | if (item.Value.Type == (int)AssetType.Sound && item.Value.Name == sound) | ||
305 | { | ||
306 | soundID = item.Value.ItemID; | ||
307 | break; | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | } | ||
312 | |||
313 | if (soundID == UUID.Zero) | ||
314 | return; | ||
315 | |||
316 | if (useMaster) | ||
317 | { | ||
318 | if (isMaster) | ||
319 | { | ||
320 | if (triggered) | ||
321 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
322 | else | ||
323 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
324 | part.ParentGroup.PlaySoundMasterPrim = part; | ||
325 | if (triggered) | ||
326 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
327 | else | ||
328 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
329 | foreach (SceneObjectPart prim in part.ParentGroup.PlaySoundSlavePrims) | ||
330 | { | ||
331 | position = prim.AbsolutePosition; // region local | ||
332 | if (triggered) | ||
333 | TriggerSound(soundID, part.OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); | ||
334 | else | ||
335 | PlayAttachedSound(soundID, part.OwnerID, prim.UUID, volume, position, flags, radius); | ||
336 | } | ||
337 | part.ParentGroup.PlaySoundSlavePrims.Clear(); | ||
338 | part.ParentGroup.PlaySoundMasterPrim = null; | ||
339 | } | ||
340 | else | ||
341 | { | ||
342 | part.ParentGroup.PlaySoundSlavePrims.Add(part); | ||
343 | } | ||
344 | } | ||
345 | else | ||
346 | { | ||
347 | if (triggered) | ||
348 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
349 | else | ||
350 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
351 | } | ||
352 | } | ||
353 | |||
281 | #endregion | 354 | #endregion |
282 | } | 355 | } |
283 | } | 356 | } |
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 | |||
96 | /// <param name="isMaster">Set object to sync master if true</param> | 96 | /// <param name="isMaster">Set object to sync master if true</param> |
97 | void LoopSound(UUID objectID, UUID soundID, double gain, | 97 | void LoopSound(UUID objectID, UUID soundID, double gain, |
98 | double radius, bool isMaster); | 98 | double radius, bool isMaster); |
99 | |||
100 | /// <summary> | ||
101 | /// Trigger or play an attached sound in this part's inventory. | ||
102 | /// </summary> | ||
103 | /// <param name="objectID"></param> | ||
104 | /// <param name="sound"></param> | ||
105 | /// <param name="volume"></param> | ||
106 | /// <param name="triggered"></param> | ||
107 | /// <param name="flags"></param> | ||
108 | /// <param name="radius"></param> | ||
109 | /// <param name="useMaster"></param> | ||
110 | /// <param name="isMaster"></param> | ||
111 | void SendSound(UUID objectID, string sound, double volume, | ||
112 | bool triggered, byte flags, float radius, bool useMaster, | ||
113 | bool isMaster); | ||
99 | } | 114 | } |
100 | } \ No newline at end of file | 115 | } \ 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 | |||
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() |
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 | |||
821 | { | 821 | { |
822 | if (!CanEdit()) | 822 | if (!CanEdit()) |
823 | return; | 823 | return; |
824 | 824 | ISoundModule module = m_rootScene.RequestModuleInterface<ISoundModule>(); | |
825 | GetSOP().SendSound(asset.ToString(), volume, true, 0, 0, false, false); | 825 | if (module != null) |
826 | { | ||
827 | module.SendSound(GetSOP().UUID, asset.ToString(), volume, true, 0, 0, false, false); | ||
828 | } | ||
826 | } | 829 | } |
827 | 830 | ||
828 | #endregion | 831 | #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 | |||
2367 | m_host.AddScriptLPS(1); | 2367 | m_host.AddScriptLPS(1); |
2368 | 2368 | ||
2369 | // send the sound, once, to all clients in range | 2369 | // send the sound, once, to all clients in range |
2370 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); | 2370 | if (m_SoundModule != null) |
2371 | { | ||
2372 | m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); | ||
2373 | } | ||
2371 | } | 2374 | } |
2372 | 2375 | ||
2373 | public void llLoopSound(string sound, double volume) | 2376 | public void llLoopSound(string sound, double volume) |
@@ -2404,14 +2407,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2404 | m_host.AddScriptLPS(1); | 2407 | m_host.AddScriptLPS(1); |
2405 | 2408 | ||
2406 | // send the sound, once, to all clients in range | 2409 | // send the sound, once, to all clients in range |
2407 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); | 2410 | if (m_SoundModule != null) |
2411 | { | ||
2412 | m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); | ||
2413 | } | ||
2408 | } | 2414 | } |
2409 | 2415 | ||
2410 | public void llTriggerSound(string sound, double volume) | 2416 | public void llTriggerSound(string sound, double volume) |
2411 | { | 2417 | { |
2412 | m_host.AddScriptLPS(1); | 2418 | m_host.AddScriptLPS(1); |
2413 | // send the sound, once, to all clients in range | 2419 | // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. |
2414 | m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); | 2420 | if (m_SoundModule != null) |
2421 | { | ||
2422 | m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); | ||
2423 | } | ||
2415 | } | 2424 | } |
2416 | 2425 | ||
2417 | public void llStopSound() | 2426 | public void llStopSound() |
@@ -5824,10 +5833,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5824 | LSL_Vector bottom_south_west) | 5833 | LSL_Vector bottom_south_west) |
5825 | { | 5834 | { |
5826 | m_host.AddScriptLPS(1); | 5835 | m_host.AddScriptLPS(1); |
5836 | if (m_SoundModule != null) | ||
5837 | { | ||
5827 | float radius1 = (float)llVecDist(llGetPos(), top_north_east); | 5838 | float radius1 = (float)llVecDist(llGetPos(), top_north_east); |
5828 | float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); | 5839 | float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); |
5829 | float radius = Math.Abs(radius1 - radius2); | 5840 | float radius = Math.Abs(radius1 - radius2); |
5830 | m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); | 5841 | m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); |
5842 | } | ||
5831 | } | 5843 | } |
5832 | 5844 | ||
5833 | public void llEjectFromLand(string pest) | 5845 | public void llEjectFromLand(string pest) |