Mantis#2638. Thank you kindly, Sacha Magne for a patch that:
Implementing "Play sound inworld". Currently a WIP .0.6.1-post-fixes
parent
9babdb1095
commit
164ed57ad3
|
@ -409,6 +409,9 @@ namespace OpenSim.Framework
|
|||
|
||||
public delegate void DeclineCallingCard(IClientAPI remoteClient, UUID transactionID);
|
||||
|
||||
|
||||
public delegate void SoundTrigger(UUID soundId,UUID ownerid,UUID objid, UUID parentid,float Gain, Vector3 Position,UInt64 Handle);
|
||||
|
||||
#endregion
|
||||
|
||||
public struct DirPlacesReplyData
|
||||
|
@ -711,6 +714,7 @@ namespace OpenSim.Framework
|
|||
event OfferCallingCard OnOfferCallingCard;
|
||||
event AcceptCallingCard OnAcceptCallingCard;
|
||||
event DeclineCallingCard OnDeclineCallingCard;
|
||||
event SoundTrigger OnSoundTrigger;
|
||||
|
||||
// void ActivateGesture(UUID assetId, UUID gestureId);
|
||||
|
||||
|
|
|
@ -255,6 +255,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
//Gesture
|
||||
private ActivateGesture handlerActivateGesture;
|
||||
private DeactivateGesture handlerDeactivateGesture;
|
||||
//Sound
|
||||
private SoundTrigger handlerSoundTrigger;
|
||||
private ObjectOwner handlerObjectOwner;
|
||||
|
||||
private DirPlacesQuery handlerDirPlacesQuery;
|
||||
|
@ -981,14 +983,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public event OfferCallingCard OnOfferCallingCard;
|
||||
public event AcceptCallingCard OnAcceptCallingCard;
|
||||
public event DeclineCallingCard OnDeclineCallingCard;
|
||||
public event SoundTrigger OnSoundTrigger;
|
||||
|
||||
// voire si c'est necessaire
|
||||
|
||||
|
||||
public void ActivateGesture(UUID assetId, UUID gestureId)
|
||||
{
|
||||
}
|
||||
public void DeactivateGesture(UUID assetId, UUID gestureId)
|
||||
{
|
||||
}
|
||||
|
||||
// Sound
|
||||
public void SoundTrigger(UUID soundId, UUID owerid, UUID Objectid,UUID ParentId,float Gain, Vector3 Position,UInt64 Handle)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region Scene/Avatar to Client
|
||||
|
||||
public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
|
||||
|
@ -4384,6 +4395,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
break;
|
||||
case PacketType.SoundTrigger:
|
||||
// TODO: handle this packet
|
||||
// SM 200811
|
||||
SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack;
|
||||
handlerSoundTrigger = OnSoundTrigger;
|
||||
if (handlerSoundTrigger != null)
|
||||
//UUID ownerID, UUID objectID, UUID parentID
|
||||
{
|
||||
handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID,
|
||||
soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID,
|
||||
soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position,
|
||||
soundTriggerPacket.SoundData.Handle);
|
||||
|
||||
}
|
||||
else
|
||||
m_log.Error("Null pointer for Soundtrigger");
|
||||
break;
|
||||
case PacketType.AvatarPickerRequest:
|
||||
AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack;
|
||||
AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData;
|
||||
|
@ -6323,13 +6351,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// TODO: handle this packet
|
||||
//m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet");
|
||||
break;
|
||||
case PacketType.SoundTrigger:
|
||||
// TODO: handle this packet
|
||||
//m_log.Warn("[CLIENT]: unhandled SoundTrigger packet");
|
||||
break;
|
||||
|
||||
case PacketType.InventoryDescendents:
|
||||
// TODO: handle this packet
|
||||
//m_log.Warn("[CLIENT]: unhandled InventoryDescent packet");
|
||||
|
||||
break;
|
||||
case PacketType.DirPlacesQuery:
|
||||
DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack;
|
||||
|
|
|
@ -340,6 +340,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
|
|||
public event OfferCallingCard OnOfferCallingCard;
|
||||
public event AcceptCallingCard OnAcceptCallingCard;
|
||||
public event DeclineCallingCard OnDeclineCallingCard;
|
||||
public event SoundTrigger OnSoundTrigger;
|
||||
|
||||
|
||||
#pragma warning restore 67
|
||||
|
|
|
@ -2342,12 +2342,31 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//Gesture
|
||||
client.OnActivateGesture += ActivateGesture;
|
||||
client.OnDeactivateGesture += DeactivateGesture;
|
||||
//sound
|
||||
client.OnSoundTrigger += SoundTrigger;
|
||||
|
||||
client.OnObjectOwner += ObjectOwner;
|
||||
|
||||
// EventManager.TriggerOnNewClient(client);
|
||||
}
|
||||
|
||||
// Sound
|
||||
public virtual void SoundTrigger( UUID soundId, UUID ownerID, UUID objectID, UUID parentID,
|
||||
float gain, Vector3 position, UInt64 handle)
|
||||
{
|
||||
foreach (ScenePresence p in GetAvatars())
|
||||
{
|
||||
double dis = Util.GetDistanceTo(p.AbsolutePosition, position);
|
||||
if (dis > 100.0) // Max audio distance
|
||||
continue;
|
||||
|
||||
// Scale by distance
|
||||
gain = (float)((double)gain*((100.0 - dis) / 100.0));
|
||||
p.ControllingClient.SendTriggeredSound(soundId, ownerID, objectID, parentID, handle, position, (float)gain);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Gesture
|
||||
public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId)
|
||||
{
|
||||
|
|
|
@ -235,6 +235,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
public event OfferCallingCard OnOfferCallingCard;
|
||||
public event AcceptCallingCard OnAcceptCallingCard;
|
||||
public event DeclineCallingCard OnDeclineCallingCard;
|
||||
public event SoundTrigger OnSoundTrigger;
|
||||
|
||||
|
||||
#pragma warning restore 67
|
||||
|
|
Loading…
Reference in New Issue