aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorSignpostMarv2012-10-05 15:16:30 +0100
committerJustin Clark-Casey (justincc)2012-10-29 23:38:58 +0000
commita68e2fe1692a7611c58f774ac5b94c4298343433 (patch)
treea26fdba2a74fc1579a9dab1eed79773a4d7567b7 /OpenSim/Region
parenttransposing stop sound into sound module (diff)
downloadopensim-SC-a68e2fe1692a7611c58f774ac5b94c4298343433.zip
opensim-SC-a68e2fe1692a7611c58f774ac5b94c4298343433.tar.gz
opensim-SC-a68e2fe1692a7611c58f774ac5b94c4298343433.tar.bz2
opensim-SC-a68e2fe1692a7611c58f774ac5b94c4298343433.tar.xz
transposing preload sound onto sound module
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs20
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs3
4 files changed, 32 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
index 670794d..0225d6f 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System; 27using System;
28using System.Collections.Generic;
28using System.Reflection; 29using System.Reflection;
29 30
30using Nini.Config; 31using Nini.Config;
@@ -223,6 +224,25 @@ namespace OpenSim.Region.CoreModules.World.Sound
223 } 224 }
224 } 225 }
225 226
227 public virtual void PreloadSound(UUID soundID, UUID objectID, float radius)
228 {
229 SceneObjectPart part;
230 if (soundID == UUID.Zero
231 || !m_scene.TryGetSceneObjectPart(objectID, out part))
232 {
233 return;
234 }
235
236 if (radius == 0)
237 radius = MaxDistance;
238
239 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
240 {
241 if (!(Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) >= MaxDistance))
242 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
243 });
244 }
245
226 #endregion 246 #endregion
227 } 247 }
228} 248}
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index 45219ed..0f65763 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -74,5 +74,15 @@ namespace OpenSim.Region.Framework.Interfaces
74 /// </summary> 74 /// </summary>
75 /// <param name="objectID">Sound source ID</param> 75 /// <param name="objectID">Sound source ID</param>
76 void StopSound(UUID objectID); 76 void StopSound(UUID objectID);
77
78 /// <summary>
79 /// Preload sound to viewers within range.
80 /// </summary>
81 /// <param name="soundID">Sound asset ID</param>
82 /// <param name="objectID">Sound source ID</param>
83 /// <param name="radius">
84 /// Radius used to determine which viewers should preload the sound.
85 /// </param>
86 void PreloadSound(UUID soundID, UUID objectID, float radius);
77 } 87 }
78} \ No newline at end of file 88} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b333a1a..48615de 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2287,37 +2287,6 @@ namespace OpenSim.Region.Framework.Scenes
2287 ScheduleTerseUpdate(); 2287 ScheduleTerseUpdate();
2288 } 2288 }
2289 2289
2290 public void PreloadSound(string sound)
2291 {
2292 // UUID ownerID = OwnerID;
2293 UUID objectID = ParentGroup.RootPart.UUID;
2294 UUID soundID = UUID.Zero;
2295
2296 if (!UUID.TryParse(sound, out soundID))
2297 {
2298 //Trys to fetch sound id from prim's inventory.
2299 //Prim's inventory doesn't support non script items yet
2300
2301 lock (TaskInventory)
2302 {
2303 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2304 {
2305 if (item.Value.Name == sound)
2306 {
2307 soundID = item.Value.ItemID;
2308 break;
2309 }
2310 }
2311 }
2312 }
2313
2314 ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
2315 {
2316 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
2317 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2318 });
2319 }
2320
2321 public void RemFlag(PrimFlags flag) 2290 public void RemFlag(PrimFlags flag)
2322 { 2291 {
2323 // PrimFlags prevflag = Flags; 2292 // PrimFlags prevflag = Flags;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 25be3ff..61fd1aa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2461,7 +2461,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2461 public void llPreloadSound(string sound) 2461 public void llPreloadSound(string sound)
2462 { 2462 {
2463 m_host.AddScriptLPS(1); 2463 m_host.AddScriptLPS(1);
2464 m_host.PreloadSound(sound); 2464 if (m_SoundModule != null)
2465 m_SoundModule.PreloadSound(KeyOrName(sound), m_host.UUID, 0);
2465 ScriptSleep(1000); 2466 ScriptSleep(1000);
2466 } 2467 }
2467 2468