diff options
author | Charles Krinke | 2008-11-19 18:41:10 +0000 |
---|---|---|
committer | Charles Krinke | 2008-11-19 18:41:10 +0000 |
commit | 164ed57ad35b4496dcd8da6fb8ec6546300c9036 (patch) | |
tree | 923d8023fb5dbdcbb7b897e1816b8d302e663de1 /OpenSim/Region | |
parent | Mantis#2657. Thank you kindly, StrawberryFride for a patch that: (diff) | |
download | opensim-SC_OLD-164ed57ad35b4496dcd8da6fb8ec6546300c9036.zip opensim-SC_OLD-164ed57ad35b4496dcd8da6fb8ec6546300c9036.tar.gz opensim-SC_OLD-164ed57ad35b4496dcd8da6fb8ec6546300c9036.tar.bz2 opensim-SC_OLD-164ed57ad35b4496dcd8da6fb8ec6546300c9036.tar.xz |
Mantis#2638. Thank you kindly, Sacha Magne for a patch that:
Implementing "Play sound inworld". Currently a WIP .
Diffstat (limited to 'OpenSim/Region')
4 files changed, 52 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3265817..25927b6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -255,6 +255,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
255 | //Gesture | 255 | //Gesture |
256 | private ActivateGesture handlerActivateGesture; | 256 | private ActivateGesture handlerActivateGesture; |
257 | private DeactivateGesture handlerDeactivateGesture; | 257 | private DeactivateGesture handlerDeactivateGesture; |
258 | //Sound | ||
259 | private SoundTrigger handlerSoundTrigger; | ||
258 | private ObjectOwner handlerObjectOwner; | 260 | private ObjectOwner handlerObjectOwner; |
259 | 261 | ||
260 | private DirPlacesQuery handlerDirPlacesQuery; | 262 | private DirPlacesQuery handlerDirPlacesQuery; |
@@ -981,14 +983,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
981 | public event OfferCallingCard OnOfferCallingCard; | 983 | public event OfferCallingCard OnOfferCallingCard; |
982 | public event AcceptCallingCard OnAcceptCallingCard; | 984 | public event AcceptCallingCard OnAcceptCallingCard; |
983 | public event DeclineCallingCard OnDeclineCallingCard; | 985 | public event DeclineCallingCard OnDeclineCallingCard; |
986 | public event SoundTrigger OnSoundTrigger; | ||
984 | 987 | ||
985 | // voire si c'est necessaire | 988 | |
989 | |||
986 | public void ActivateGesture(UUID assetId, UUID gestureId) | 990 | public void ActivateGesture(UUID assetId, UUID gestureId) |
987 | { | 991 | { |
988 | } | 992 | } |
989 | public void DeactivateGesture(UUID assetId, UUID gestureId) | 993 | public void DeactivateGesture(UUID assetId, UUID gestureId) |
990 | { | 994 | { |
991 | } | 995 | } |
996 | |||
997 | // Sound | ||
998 | public void SoundTrigger(UUID soundId, UUID owerid, UUID Objectid,UUID ParentId,float Gain, Vector3 Position,UInt64 Handle) | ||
999 | { | ||
1000 | |||
1001 | } | ||
1002 | |||
992 | #region Scene/Avatar to Client | 1003 | #region Scene/Avatar to Client |
993 | 1004 | ||
994 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) | 1005 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) |
@@ -4384,6 +4395,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4384 | } | 4395 | } |
4385 | } | 4396 | } |
4386 | break; | 4397 | break; |
4398 | case PacketType.SoundTrigger: | ||
4399 | // TODO: handle this packet | ||
4400 | // SM 200811 | ||
4401 | SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack; | ||
4402 | handlerSoundTrigger = OnSoundTrigger; | ||
4403 | if (handlerSoundTrigger != null) | ||
4404 | //UUID ownerID, UUID objectID, UUID parentID | ||
4405 | { | ||
4406 | handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, | ||
4407 | soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID, | ||
4408 | soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position, | ||
4409 | soundTriggerPacket.SoundData.Handle); | ||
4410 | |||
4411 | } | ||
4412 | else | ||
4413 | m_log.Error("Null pointer for Soundtrigger"); | ||
4414 | break; | ||
4387 | case PacketType.AvatarPickerRequest: | 4415 | case PacketType.AvatarPickerRequest: |
4388 | AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; | 4416 | AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; |
4389 | AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; | 4417 | AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; |
@@ -6323,13 +6351,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6323 | // TODO: handle this packet | 6351 | // TODO: handle this packet |
6324 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); | 6352 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); |
6325 | break; | 6353 | break; |
6326 | case PacketType.SoundTrigger: | 6354 | |
6327 | // TODO: handle this packet | ||
6328 | //m_log.Warn("[CLIENT]: unhandled SoundTrigger packet"); | ||
6329 | break; | ||
6330 | case PacketType.InventoryDescendents: | 6355 | case PacketType.InventoryDescendents: |
6331 | // TODO: handle this packet | 6356 | // TODO: handle this packet |
6332 | //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); | 6357 | //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); |
6358 | |||
6333 | break; | 6359 | break; |
6334 | case PacketType.DirPlacesQuery: | 6360 | case PacketType.DirPlacesQuery: |
6335 | DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack; | 6361 | DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack; |
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 3af947f..f243987 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -340,6 +340,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
340 | public event OfferCallingCard OnOfferCallingCard; | 340 | public event OfferCallingCard OnOfferCallingCard; |
341 | public event AcceptCallingCard OnAcceptCallingCard; | 341 | public event AcceptCallingCard OnAcceptCallingCard; |
342 | public event DeclineCallingCard OnDeclineCallingCard; | 342 | public event DeclineCallingCard OnDeclineCallingCard; |
343 | public event SoundTrigger OnSoundTrigger; | ||
343 | 344 | ||
344 | 345 | ||
345 | #pragma warning restore 67 | 346 | #pragma warning restore 67 |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7ea4686..a9014e1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2342,12 +2342,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
2342 | //Gesture | 2342 | //Gesture |
2343 | client.OnActivateGesture += ActivateGesture; | 2343 | client.OnActivateGesture += ActivateGesture; |
2344 | client.OnDeactivateGesture += DeactivateGesture; | 2344 | client.OnDeactivateGesture += DeactivateGesture; |
2345 | //sound | ||
2346 | client.OnSoundTrigger += SoundTrigger; | ||
2345 | 2347 | ||
2346 | client.OnObjectOwner += ObjectOwner; | 2348 | client.OnObjectOwner += ObjectOwner; |
2347 | 2349 | ||
2348 | // EventManager.TriggerOnNewClient(client); | 2350 | // EventManager.TriggerOnNewClient(client); |
2349 | } | 2351 | } |
2350 | 2352 | ||
2353 | // Sound | ||
2354 | public virtual void SoundTrigger( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, | ||
2355 | float gain, Vector3 position, UInt64 handle) | ||
2356 | { | ||
2357 | foreach (ScenePresence p in GetAvatars()) | ||
2358 | { | ||
2359 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); | ||
2360 | if (dis > 100.0) // Max audio distance | ||
2361 | continue; | ||
2362 | |||
2363 | // Scale by distance | ||
2364 | gain = (float)((double)gain*((100.0 - dis) / 100.0)); | ||
2365 | p.ControllingClient.SendTriggeredSound(soundId, ownerID, objectID, parentID, handle, position, (float)gain); | ||
2366 | } | ||
2367 | |||
2368 | } | ||
2369 | |||
2351 | // Gesture | 2370 | // Gesture |
2352 | public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId) | 2371 | public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId) |
2353 | { | 2372 | { |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index d523298..e05ccd1 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -235,6 +235,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
235 | public event OfferCallingCard OnOfferCallingCard; | 235 | public event OfferCallingCard OnOfferCallingCard; |
236 | public event AcceptCallingCard OnAcceptCallingCard; | 236 | public event AcceptCallingCard OnAcceptCallingCard; |
237 | public event DeclineCallingCard OnDeclineCallingCard; | 237 | public event DeclineCallingCard OnDeclineCallingCard; |
238 | public event SoundTrigger OnSoundTrigger; | ||
238 | 239 | ||
239 | 240 | ||
240 | #pragma warning restore 67 | 241 | #pragma warning restore 67 |