aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs25
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs44
5 files changed, 47 insertions, 28 deletions
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
278 m_host.SendFullUpdateToAllClients(); 278 m_host.SendFullUpdateToAllClients();
279 } 279 }
280 280
281 public void SendSound(UUID objectID, string sound, double volume, 281 public void SendSound(UUID objectID, UUID soundID, double volume,
282 bool triggered, byte flags, float radius, bool useMaster, 282 bool triggered, byte flags, float radius, bool useMaster,
283 bool isMaster) 283 bool isMaster)
284 { 284 {
285 if (soundID == UUID.Zero)
286 return;
287
285 SceneObjectPart part; 288 SceneObjectPart part;
286 if (!m_scene.TryGetSceneObjectPart(objectID, out part)) 289 if (!m_scene.TryGetSceneObjectPart(objectID, out part))
287 return; 290 return;
@@ -290,29 +293,9 @@ namespace OpenSim.Region.CoreModules.World.Sound
290 293
291 UUID parentID = part.ParentGroup.UUID; 294 UUID parentID = part.ParentGroup.UUID;
292 295
293 UUID soundID = UUID.Zero;
294 Vector3 position = part.AbsolutePosition; // region local 296 Vector3 position = part.AbsolutePosition; // region local
295 ulong regionHandle = m_scene.RegionInfo.RegionHandle; 297 ulong regionHandle = m_scene.RegionInfo.RegionHandle;
296 298
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) 299 if (useMaster)
317 { 300 {
318 if (isMaster) 301 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
108 /// <param name="radius"></param> 108 /// <param name="radius"></param>
109 /// <param name="useMaster"></param> 109 /// <param name="useMaster"></param>
110 /// <param name="isMaster"></param> 110 /// <param name="isMaster"></param>
111 void SendSound(UUID objectID, string sound, double volume, 111 void SendSound(UUID objectID, UUID sound, double volume,
112 bool triggered, byte flags, float radius, bool useMaster, 112 bool triggered, byte flags, float radius, bool useMaster,
113 bool isMaster); 113 bool isMaster);
114 } 114 }
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
2243 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>(); 2243 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
2244 if (soundModule != null) 2244 if (soundModule != null)
2245 { 2245 {
2246 soundModule.SendSound(UUID, CollisionSound.ToString(), 2246 soundModule.SendSound(UUID, CollisionSound,
2247 CollisionSoundVolume, true, (byte)0, 0, false, 2247 CollisionSoundVolume, true, (byte)0, 0, false,
2248 false); 2248 false);
2249 } 2249 }
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
824 ISoundModule module = m_rootScene.RequestModuleInterface<ISoundModule>(); 824 ISoundModule module = m_rootScene.RequestModuleInterface<ISoundModule>();
825 if (module != null) 825 if (module != null)
826 { 826 {
827 module.SendSound(GetSOP().UUID, asset.ToString(), volume, true, 0, 0, false, false); 827 module.SendSound(GetSOP().UUID, asset, volume, true, 0, 0, false, false);
828 } 828 }
829 } 829 }
830 830
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
333 return key; 333 return key;
334 } 334 }
335 335
336 /// <summary>
337 /// Return the UUID of the asset matching the specified key or name
338 /// and asset type.
339 /// </summary>
340 /// <param name="k"></param>
341 /// <param name="type"></param>
342 /// <returns></returns>
343 protected UUID KeyOrName(string k, AssetType type)
344 {
345 UUID key;
346
347 if (!UUID.TryParse(k, out key))
348 {
349 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
350 if (item != null && item.Type == (int)type)
351 key = item.AssetID;
352 }
353 else
354 {
355 lock (m_host.TaskInventory)
356 {
357 foreach (KeyValuePair<UUID, TaskInventoryItem> item in m_host.TaskInventory)
358 {
359 if (item.Value.Type == (int)type && item.Value.Name == k)
360 {
361 key = item.Value.ItemID;
362 break;
363 }
364 }
365 }
366 }
367
368
369 return key;
370 }
371
336 //These are the implementations of the various ll-functions used by the LSL scripts. 372 //These are the implementations of the various ll-functions used by the LSL scripts.
337 public LSL_Float llSin(double f) 373 public LSL_Float llSin(double f)
338 { 374 {
@@ -2369,7 +2405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2369 // send the sound, once, to all clients in range 2405 // send the sound, once, to all clients in range
2370 if (m_SoundModule != null) 2406 if (m_SoundModule != null)
2371 { 2407 {
2372 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); 2408 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, false, false);
2373 } 2409 }
2374 } 2410 }
2375 2411
@@ -2409,7 +2445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2409 // send the sound, once, to all clients in range 2445 // send the sound, once, to all clients in range
2410 if (m_SoundModule != null) 2446 if (m_SoundModule != null)
2411 { 2447 {
2412 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); 2448 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, true, false);
2413 } 2449 }
2414 } 2450 }
2415 2451
@@ -2419,7 +2455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2419 // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. 2455 // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory.
2420 if (m_SoundModule != null) 2456 if (m_SoundModule != null)
2421 { 2457 {
2422 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); 2458 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, false, false);
2423 } 2459 }
2424 } 2460 }
2425 2461
@@ -5838,7 +5874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5838 float radius1 = (float)llVecDist(llGetPos(), top_north_east); 5874 float radius1 = (float)llVecDist(llGetPos(), top_north_east);
5839 float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); 5875 float radius2 = (float)llVecDist(llGetPos(), bottom_south_west);
5840 float radius = Math.Abs(radius1 - radius2); 5876 float radius = Math.Abs(radius1 - radius2);
5841 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); 5877 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, radius, false, false);
5842 } 5878 }
5843 } 5879 }
5844 5880