aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs93
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs152
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs3
4 files changed, 95 insertions, 158 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index 6117a80..68af492 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -32,9 +32,96 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface ISoundModule 33 public interface ISoundModule
34 { 34 {
35 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); 35 /// <summary>
36 36 /// Maximum distance between a sound source and a recipient.
37 /// </summary>
38 float MaxDistance { get; }
39
40 /// <summary>
41 /// Play a sound from an object.
42 /// </summary>
43 /// <param name="soundID">Sound asset ID</param>
44 /// <param name="ownerID">Sound source owner</param>
45 /// <param name="objectID">Sound source ID</param>
46 /// <param name="gain">Sound volume</param>
47 /// <param name="position">Sound source position</param>
48 /// <param name="flags">Sound flags</param>
49 /// <param name="radius">
50 /// Radius used to affect gain over distance.
51 /// </param>
52 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID,
53 double gain, Vector3 position, byte flags, float radius);
54
55 /// <summary>
56 /// Trigger a sound in the scene.
57 /// </summary>
58 /// <param name="soundId">Sound asset ID</param>
59 /// <param name="ownerID">Sound source owner</param>
60 /// <param name="objectID">Sound source ID</param>
61 /// <param name="parentID">Sound source parent.</param>
62 /// <param name="gain">Sound volume</param>
63 /// <param name="position">Sound source position</param>
64 /// <param name="handle"></param>
65 /// <param name="radius">
66 /// Radius used to affect gain over distance.
67 /// </param>
37 void TriggerSound( 68 void TriggerSound(
38 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius); 69 UUID soundId, UUID ownerID, UUID objectID, UUID parentID,
70 double gain, Vector3 position, UInt64 handle, float radius);
71
72 /// <summary>
73 /// Stop sounds eminating from an object.
74 /// </summary>
75 /// <param name="objectID">Sound source ID</param>
76 void StopSound(UUID objectID);
77
78 /// <summary>
79 /// Preload sound to viewers within range.
80 /// </summary>
81 /// <param name="objectID">Sound source ID</param>
82 /// <param name="soundID">Sound asset ID</param>
83 /// <param name="radius">
84 /// Radius used to determine which viewers should preload the sound.
85 /// </param>
86 void PreloadSound(UUID objectID, UUID soundID, float radius);
87
88 /// <summary>
89 /// Loop specified sound at specified volume with specified radius,
90 /// optionally declaring object as new sync master.
91 /// </summary>
92 /// <param name="objectID">Sound source ID</param>
93 /// <param name="soundID">Sound asset ID</param>
94 /// <param name="gain">Sound volume</param>
95 /// <param name="radius">Sound radius</param>
96 /// <param name="isMaster">Set object to sync master if true</param>
97 void LoopSound(UUID objectID, UUID soundID, double gain,
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">Sound source ID</param>
104 /// <param name="sound">Sound asset ID</param>
105 /// <param name="volume">Sound volume</param>
106 /// <param name="triggered">Triggered or not.</param>
107 /// <param name="flags"></param>
108 /// <param name="radius">Sound radius</param>
109 /// <param name="useMaster">Play using sound master</param>
110 /// <param name="isMaster">Play as sound master</param>
111 void SendSound(UUID objectID, UUID sound, double volume,
112 bool triggered, byte flags, float radius, bool useMaster,
113 bool isMaster);
114
115 /// <summary>
116 /// Trigger a sound to be played to all agents within an axis-aligned
117 /// bounding box.
118 /// </summary>
119 /// <param name="objectID">Sound source ID</param>
120 /// <param name="sound">Sound asset ID</param>
121 /// <param name="volume">Sound volume</param>
122 /// <param name="min">AABB bottom south-west corner</param>
123 /// <param name="max">AABB top north-east corner</param>
124 void TriggerSoundLimited(UUID objectID, UUID sound, double volume,
125 Vector3 min, Vector3 max);
39 } 126 }
40} \ No newline at end of file 127} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9f87e1e..2066536 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3552,9 +3552,10 @@ namespace OpenSim.Region.Framework.Scenes
3552 } 3552 }
3553 else 3553 else
3554 { 3554 {
3555 // We remove the acd up here to avoid later raec conditions if two RemoveClient() calls occurred 3555 // We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred
3556 // simultaneously. 3556 // simultaneously.
3557 m_authenticateHandler.RemoveCircuit(acd.circuitcode); 3557 // We also need to remove by agent ID since NPCs will have no circuit code.
3558 m_authenticateHandler.RemoveCircuit(agentID);
3558 } 3559 }
3559 } 3560 }
3560 3561
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 248679b..b7f4291 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2895,38 +2895,6 @@ namespace OpenSim.Region.Framework.Scenes
2895 ScheduleTerseUpdate(); 2895 ScheduleTerseUpdate();
2896 } 2896 }
2897 2897
2898 public void PreloadSound(string sound)
2899 {
2900 // UUID ownerID = OwnerID;
2901 UUID objectID = ParentGroup.RootPart.UUID;
2902 UUID soundID = UUID.Zero;
2903
2904 if (!UUID.TryParse(sound, out soundID))
2905 {
2906 //Trys to fetch sound id from prim's inventory.
2907 //Prim's inventory doesn't support non script items yet
2908
2909 TaskInventory.LockItemsForRead(true);
2910
2911 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2912 {
2913 if (item.Value.Name == sound)
2914 {
2915 soundID = item.Value.ItemID;
2916 break;
2917 }
2918 }
2919
2920 TaskInventory.LockItemsForRead(false);
2921 }
2922
2923 ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
2924 {
2925 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
2926 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2927 });
2928 }
2929
2930 public void RemFlag(PrimFlags flag) 2898 public void RemFlag(PrimFlags flag)
2931 { 2899 {
2932 // PrimFlags prevflag = Flags; 2900 // PrimFlags prevflag = Flags;
@@ -3298,126 +3266,6 @@ namespace OpenSim.Region.Framework.Scenes
3298 } 3266 }
3299 3267
3300 /// <summary> 3268 /// <summary>
3301 /// Trigger or play an attached sound in this part's inventory.
3302 /// </summary>
3303 /// <param name="sound"></param>
3304 /// <param name="volume"></param>
3305 /// <param name="triggered"></param>
3306 /// <param name="flags"></param>
3307 public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
3308 {
3309 if (volume > 1)
3310 volume = 1;
3311 if (volume < 0)
3312 volume = 0;
3313
3314 UUID ownerID = OwnerID;
3315 UUID objectID = ParentGroup.RootPart.UUID;
3316 UUID parentID = ParentGroup.UUID;
3317
3318 UUID soundID = UUID.Zero;
3319 Vector3 position = AbsolutePosition; // region local
3320 ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
3321
3322 if (!UUID.TryParse(sound, out soundID))
3323 {
3324 // search sound file from inventory
3325 TaskInventory.LockItemsForRead(true);
3326 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3327 {
3328 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3329 {
3330 soundID = item.Value.ItemID;
3331 break;
3332 }
3333 }
3334 TaskInventory.LockItemsForRead(false);
3335 }
3336
3337 if (soundID == UUID.Zero)
3338 return;
3339
3340 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
3341 if (soundModule != null)
3342 {
3343 if (useMaster)
3344 {
3345 if (isMaster)
3346 {
3347 if (triggered)
3348 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3349 else
3350 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3351 ParentGroup.PlaySoundMasterPrim = this;
3352 ownerID = OwnerID;
3353 objectID = ParentGroup.RootPart.UUID;
3354 parentID = ParentGroup.UUID;
3355 position = AbsolutePosition; // region local
3356 regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
3357 if (triggered)
3358 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3359 else
3360 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3361 foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
3362 {
3363 ownerID = prim.OwnerID;
3364 objectID = prim.ParentGroup.RootPart.UUID;
3365 parentID = prim.ParentGroup.UUID;
3366 position = prim.AbsolutePosition; // region local
3367 regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
3368 if (triggered)
3369 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3370 else
3371 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3372 }
3373 ParentGroup.PlaySoundSlavePrims.Clear();
3374 ParentGroup.PlaySoundMasterPrim = null;
3375 }
3376 else
3377 {
3378 ParentGroup.PlaySoundSlavePrims.Add(this);
3379 }
3380 }
3381 else
3382 {
3383 if (triggered)
3384 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3385 else
3386 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3387 }
3388 }
3389 }
3390
3391 public void SendCollisionSound(UUID soundID, double volume, Vector3 position)
3392 {
3393 if (soundID == UUID.Zero)
3394 return;
3395
3396 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
3397 if (soundModule == null)
3398 return;
3399
3400 if (volume > 1)
3401 volume = 1;
3402 if (volume < 0)
3403 volume = 0;
3404
3405 int now = Util.EnvironmentTickCount();
3406 if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200)
3407 return;
3408
3409 LastColSoundSentTime = now;
3410
3411 UUID ownerID = OwnerID;
3412 UUID objectID = ParentGroup.RootPart.UUID;
3413 UUID parentID = ParentGroup.UUID;
3414 ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
3415
3416 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 );
3417 }
3418
3419
3420 /// <summary>
3421 /// Send a terse update to all clients 3269 /// Send a terse update to all clients
3422 /// </summary> 3270 /// </summary>
3423 public void SendTerseUpdateToAllClients() 3271 public void SendTerseUpdateToAllClients()
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 870bd66..285d1ae 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -75,8 +75,9 @@ namespace OpenSim.Region.Framework.Scenes
75 { 75 {
76// ~ScenePresence() 76// ~ScenePresence()
77// { 77// {
78// m_log.Debug("[SCENE PRESENCE] Destructor called"); 78// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
79// } 79// }
80
80 private void TriggerScenePresenceUpdated() 81 private void TriggerScenePresenceUpdated()
81 { 82 {
82 if (m_scene != null) 83 if (m_scene != null)