aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-23 17:54:13 +0000
committerJustin Clarke Casey2008-12-23 17:54:13 +0000
commitcce1b096dbd8aba46c405b7654d67d3ba96de33a (patch)
treeae8208af8343d8d82df1343038855e1d3c91eba0
parent* Add a method to allow friendship offers to a logged in client from an offli... (diff)
downloadopensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.zip
opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.gz
opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.bz2
opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.xz
* refactor: Replace part of SceneObjectPart with the identical sound playing code in the SoundModule
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IClientAPI.cs6
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs9
-rw-r--r--OpenSim/Region/Environment/Interfaces/ISoundModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs23
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs20
5 files changed, 34 insertions, 28 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index e3163d7..f9071a5 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -406,9 +406,9 @@ namespace OpenSim.Framework
406 public delegate void AcceptCallingCard(IClientAPI remoteClient, UUID transactionID, UUID folderID); 406 public delegate void AcceptCallingCard(IClientAPI remoteClient, UUID transactionID, UUID folderID);
407 407
408 public delegate void DeclineCallingCard(IClientAPI remoteClient, UUID transactionID); 408 public delegate void DeclineCallingCard(IClientAPI remoteClient, UUID transactionID);
409
410 409
411 public delegate void SoundTrigger(UUID soundId,UUID ownerid,UUID objid, UUID parentid,float Gain, Vector3 Position,UInt64 Handle); 410 public delegate void SoundTrigger(
411 UUID soundId, UUID ownerid, UUID objid, UUID parentid, double Gain, Vector3 Position, UInt64 Handle);
412 412
413 public delegate void StartLure(byte lureType, string message, UUID targetID, IClientAPI client); 413 public delegate void StartLure(byte lureType, string message, UUID targetID, IClientAPI client);
414 public delegate void TeleportLureRequest(UUID lureID, uint teleportFlags, IClientAPI client); 414 public delegate void TeleportLureRequest(UUID lureID, uint teleportFlags, IClientAPI client);
@@ -723,8 +723,6 @@ namespace OpenSim.Framework
723 event TeleportLureRequest OnTeleportLureRequest; 723 event TeleportLureRequest OnTeleportLureRequest;
724 event NetworkStats OnNetworkStatsUpdate; 724 event NetworkStats OnNetworkStatsUpdate;
725 725
726 // void ActivateGesture(UUID assetId, UUID gestureId);
727
728 /// <summary> 726 /// <summary>
729 /// Tell this client what items it should be wearing now 727 /// Tell this client what items it should be wearing now
730 /// </summary> 728 /// </summary>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 9d8ecf0..8922364 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4597,6 +4597,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4597 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); 4597 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
4598 } 4598 }
4599 break; 4599 break;
4600
4600 case PacketType.AgentSit: 4601 case PacketType.AgentSit:
4601 if (OnAgentSit != null) 4602 if (OnAgentSit != null)
4602 { 4603 {
@@ -4609,13 +4610,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4609 } 4610 }
4610 } 4611 }
4611 break; 4612 break;
4613
4612 case PacketType.SoundTrigger: 4614 case PacketType.SoundTrigger:
4613 // TODO: handle this packet
4614 // SM 200811
4615 SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack; 4615 SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack;
4616 handlerSoundTrigger = OnSoundTrigger; 4616 handlerSoundTrigger = OnSoundTrigger;
4617 if (handlerSoundTrigger != null) 4617 if (handlerSoundTrigger != null)
4618 //UUID ownerID, UUID objectID, UUID parentID
4619 { 4618 {
4620 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, 4619 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID,
4621 soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID, 4620 soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID,
@@ -4623,9 +4622,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4623 soundTriggerPacket.SoundData.Handle); 4622 soundTriggerPacket.SoundData.Handle);
4624 4623
4625 } 4624 }
4626 else
4627 m_log.Error("Null pointer for Soundtrigger");
4628 break; 4625 break;
4626
4629 case PacketType.AvatarPickerRequest: 4627 case PacketType.AvatarPickerRequest:
4630 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; 4628 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack;
4631 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; 4629 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData;
@@ -4639,6 +4637,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4639 Utils.BytesToString(querydata.Name)); 4637 Utils.BytesToString(querydata.Name));
4640 } 4638 }
4641 break; 4639 break;
4640
4642 case PacketType.AgentDataUpdateRequest: 4641 case PacketType.AgentDataUpdateRequest:
4643 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack; 4642 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
4644 4643
diff --git a/OpenSim/Region/Environment/Interfaces/ISoundModule.cs b/OpenSim/Region/Environment/Interfaces/ISoundModule.cs
index 0ec5652..3bb4c57 100644
--- a/OpenSim/Region/Environment/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Environment/Interfaces/ISoundModule.cs
@@ -33,7 +33,9 @@ namespace OpenSim.Region.Environment
33{ 33{
34 public interface ISoundModule 34 public interface ISoundModule
35 { 35 {
36 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags);
37
36 void TriggerSound( 38 void TriggerSound(
37 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, float gain, Vector3 position, UInt64 handle); 39 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle);
38 } 40 }
39} \ No newline at end of file 41} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs b/OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs
index 7c89466..4547480 100644
--- a/OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Sound/SoundModule.cs
@@ -61,20 +61,37 @@ namespace OpenSim.Region.Environment.World.Sound
61 client.OnSoundTrigger += TriggerSound; 61 client.OnSoundTrigger += TriggerSound;
62 } 62 }
63 63
64 public virtual void PlayAttachedSound(
65 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags)
66 {
67 foreach (ScenePresence p in m_scene.GetAvatars())
68 {
69 double dis = Util.GetDistanceTo(p.AbsolutePosition, position);
70 if (dis > 100.0) // Max audio distance
71 continue;
72
73 // Scale by distance
74 gain = (float)((double)gain*((100.0 - dis) / 100.0));
75
76 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
77 }
78 }
79
64 public virtual void TriggerSound( 80 public virtual void TriggerSound(
65 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, float gain, Vector3 position, UInt64 handle) 81 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle)
66 { 82 {
67 foreach (ScenePresence p in m_scene.GetAvatars()) 83 foreach (ScenePresence p in m_scene.GetAvatars())
68 { 84 {
69 double dis = Util.GetDistanceTo(p.AbsolutePosition, position); 85 double dis = Util.GetDistanceTo(p.AbsolutePosition, position);
70 if (dis > 100.0) // Max audio distance 86 if (dis > 100.0) // Max audio distance
71 continue; 87 continue;
72 88
73 // Scale by distance 89 // Scale by distance
74 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 90 gain = (float)((double)gain*((100.0 - dis) / 100.0));
91
75 p.ControllingClient.SendTriggeredSound( 92 p.ControllingClient.SendTriggeredSound(
76 soundId, ownerID, objectID, parentID, handle, position, (float)gain); 93 soundId, ownerID, objectID, parentID, handle, position, (float)gain);
77 } 94 }
78 } 95 }
79 } 96 }
80} 97}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index ddfb413..6795c0a 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -37,6 +37,7 @@ using log4net;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Environment.Scenes.Scripting; 41using OpenSim.Region.Environment.Scenes.Scripting;
41using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.Physics.Manager;
42 43
@@ -2362,24 +2363,13 @@ if (m_shape != null) {
2362 if (soundID == UUID.Zero) 2363 if (soundID == UUID.Zero)
2363 return; 2364 return;
2364 2365
2365 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2366 ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>();
2366 foreach (ScenePresence p in avatarts) 2367 if (soundModule != null)
2367 { 2368 {
2368 double dis=Util.GetDistanceTo(p.AbsolutePosition, position);
2369 if (dis > 100.0) // Max audio distance
2370 continue;
2371
2372 // Scale by distance
2373 volume*=((100.0-dis)/100.0);
2374
2375 if (triggered) 2369 if (triggered)
2376 { 2370 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle);
2377 p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume);
2378 }
2379 else 2371 else
2380 { 2372 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags);
2381 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)volume, flags);
2382 }
2383 } 2373 }
2384 } 2374 }
2385 2375