aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2012-05-16 23:36:37 +0100
committerUbitUmarov2012-05-16 23:36:37 +0100
commit0de7219485b55ce297d963c46e5ba869eeb1b8e3 (patch)
treed532861a4426251bb5925c926ec6f37a0291dfd0
parent Added a invalidCollisionSoundUUID so that scripts can stop all collision sou... (diff)
downloadopensim-SC_OLD-0de7219485b55ce297d963c46e5ba869eeb1b8e3.zip
opensim-SC_OLD-0de7219485b55ce297d963c46e5ba869eeb1b8e3.tar.gz
opensim-SC_OLD-0de7219485b55ce297d963c46e5ba869eeb1b8e3.tar.bz2
opensim-SC_OLD-0de7219485b55ce297d963c46e5ba869eeb1b8e3.tar.xz
collision sounds: simplify send code a bit and limit sending rate to 5 per sec per part ???
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs37
1 files changed, 36 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2fb42f4..38e7a12 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -188,6 +188,7 @@ namespace OpenSim.Region.Framework.Scenes
188 188
189 public double SoundRadius; 189 public double SoundRadius;
190 190
191
191 public uint TimeStampFull; 192 public uint TimeStampFull;
192 193
193 public uint TimeStampLastActivity; // Will be used for AutoReturn 194 public uint TimeStampLastActivity; // Will be used for AutoReturn
@@ -332,6 +333,8 @@ namespace OpenSim.Region.Framework.Scenes
332 private UUID m_collisionSound; 333 private UUID m_collisionSound;
333 private float m_collisionSoundVolume; 334 private float m_collisionSoundVolume;
334 335
336 private DateTime LastColSoundSentTime;
337
335 338
336 private SOPVehicle m_vehicle = null; 339 private SOPVehicle m_vehicle = null;
337 340
@@ -371,6 +374,7 @@ namespace OpenSim.Region.Framework.Scenes
371 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 374 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
372 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log 375 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
373 m_inventory = new SceneObjectPartInventory(this); 376 m_inventory = new SceneObjectPartInventory(this);
377 LastColSoundSentTime = DateTime.UtcNow;
374 } 378 }
375 379
376 /// <summary> 380 /// <summary>
@@ -2660,7 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes
2660 if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) 2664 if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID)
2661 { 2665 {
2662 if(CollisionSound != UUID.Zero) 2666 if(CollisionSound != UUID.Zero)
2663 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); 2667 SendCollisionSound(CollisionSound, CollisionSoundVolume);
2664 else 2668 else
2665 { 2669 {
2666 // default sounds 2670 // default sounds
@@ -3199,6 +3203,37 @@ namespace OpenSim.Region.Framework.Scenes
3199 } 3203 }
3200 } 3204 }
3201 3205
3206 public void SendCollisionSound(UUID soundID, double volume)
3207 {
3208 if (soundID == UUID.Zero)
3209 return;
3210
3211
3212 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
3213 if (soundModule == null)
3214 return;
3215
3216 if (volume > 1)
3217 volume = 1;
3218 if (volume < 0)
3219 volume = 0;
3220
3221 DateTime now = DateTime.UtcNow;
3222 if((now - LastColSoundSentTime).Milliseconds < 200) // reduce rate to 5 per sec per part ??
3223 return;
3224
3225 LastColSoundSentTime = now;
3226
3227 UUID ownerID = OwnerID;
3228 UUID objectID = ParentGroup.RootPart.UUID;
3229 UUID parentID = ParentGroup.UUID;
3230 Vector3 position = AbsolutePosition; // region local
3231 ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
3232
3233 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0);
3234 }
3235
3236
3202 /// <summary> 3237 /// <summary>
3203 /// Send a terse update to all clients 3238 /// Send a terse update to all clients
3204 /// </summary> 3239 /// </summary>