mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 11:57:03 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
This commit is contained in:
@@ -32,9 +32,96 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface ISoundModule
|
||||
{
|
||||
void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius);
|
||||
|
||||
/// <summary>
|
||||
/// Maximum distance between a sound source and a recipient.
|
||||
/// </summary>
|
||||
float MaxDistance { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Play a sound from an object.
|
||||
/// </summary>
|
||||
/// <param name="soundID">Sound asset ID</param>
|
||||
/// <param name="ownerID">Sound source owner</param>
|
||||
/// <param name="objectID">Sound source ID</param>
|
||||
/// <param name="gain">Sound volume</param>
|
||||
/// <param name="position">Sound source position</param>
|
||||
/// <param name="flags">Sound flags</param>
|
||||
/// <param name="radius">
|
||||
/// Radius used to affect gain over distance.
|
||||
/// </param>
|
||||
void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID,
|
||||
double gain, Vector3 position, byte flags, float radius);
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a sound in the scene.
|
||||
/// </summary>
|
||||
/// <param name="soundId">Sound asset ID</param>
|
||||
/// <param name="ownerID">Sound source owner</param>
|
||||
/// <param name="objectID">Sound source ID</param>
|
||||
/// <param name="parentID">Sound source parent.</param>
|
||||
/// <param name="gain">Sound volume</param>
|
||||
/// <param name="position">Sound source position</param>
|
||||
/// <param name="handle"></param>
|
||||
/// <param name="radius">
|
||||
/// Radius used to affect gain over distance.
|
||||
/// </param>
|
||||
void TriggerSound(
|
||||
UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius);
|
||||
UUID soundId, UUID ownerID, UUID objectID, UUID parentID,
|
||||
double gain, Vector3 position, UInt64 handle, float radius);
|
||||
|
||||
/// <summary>
|
||||
/// Stop sounds eminating from an object.
|
||||
/// </summary>
|
||||
/// <param name="objectID">Sound source ID</param>
|
||||
void StopSound(UUID objectID);
|
||||
|
||||
/// <summary>
|
||||
/// Preload sound to viewers within range.
|
||||
/// </summary>
|
||||
/// <param name="objectID">Sound source ID</param>
|
||||
/// <param name="soundID">Sound asset ID</param>
|
||||
/// <param name="radius">
|
||||
/// Radius used to determine which viewers should preload the sound.
|
||||
/// </param>
|
||||
void PreloadSound(UUID objectID, UUID soundID, float radius);
|
||||
|
||||
/// <summary>
|
||||
/// Loop specified sound at specified volume with specified radius,
|
||||
/// optionally declaring object as new sync master.
|
||||
/// </summary>
|
||||
/// <param name="objectID">Sound source ID</param>
|
||||
/// <param name="soundID">Sound asset ID</param>
|
||||
/// <param name="gain">Sound volume</param>
|
||||
/// <param name="radius">Sound radius</param>
|
||||
/// <param name="isMaster">Set object to sync master if true</param>
|
||||
void LoopSound(UUID objectID, UUID soundID, double gain,
|
||||
double radius, bool isMaster);
|
||||
|
||||
/// <summary>
|
||||
/// Trigger or play an attached sound in this part's inventory.
|
||||
/// </summary>
|
||||
/// <param name="objectID">Sound source ID</param>
|
||||
/// <param name="sound">Sound asset ID</param>
|
||||
/// <param name="volume">Sound volume</param>
|
||||
/// <param name="triggered">Triggered or not.</param>
|
||||
/// <param name="flags"></param>
|
||||
/// <param name="radius">Sound radius</param>
|
||||
/// <param name="useMaster">Play using sound master</param>
|
||||
/// <param name="isMaster">Play as sound master</param>
|
||||
void SendSound(UUID objectID, UUID sound, double volume,
|
||||
bool triggered, byte flags, float radius, bool useMaster,
|
||||
bool isMaster);
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a sound to be played to all agents within an axis-aligned
|
||||
/// bounding box.
|
||||
/// </summary>
|
||||
/// <param name="objectID">Sound source ID</param>
|
||||
/// <param name="sound">Sound asset ID</param>
|
||||
/// <param name="volume">Sound volume</param>
|
||||
/// <param name="min">AABB bottom south-west corner</param>
|
||||
/// <param name="max">AABB top north-east corner</param>
|
||||
void TriggerSoundLimited(UUID objectID, UUID sound, double volume,
|
||||
Vector3 min, Vector3 max);
|
||||
}
|
||||
}
|
||||
@@ -3552,9 +3552,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
// We remove the acd up here to avoid later raec conditions if two RemoveClient() calls occurred
|
||||
// We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred
|
||||
// simultaneously.
|
||||
m_authenticateHandler.RemoveCircuit(acd.circuitcode);
|
||||
// We also need to remove by agent ID since NPCs will have no circuit code.
|
||||
m_authenticateHandler.RemoveCircuit(agentID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2895,38 +2895,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScheduleTerseUpdate();
|
||||
}
|
||||
|
||||
public void PreloadSound(string sound)
|
||||
{
|
||||
// UUID ownerID = OwnerID;
|
||||
UUID objectID = ParentGroup.RootPart.UUID;
|
||||
UUID soundID = UUID.Zero;
|
||||
|
||||
if (!UUID.TryParse(sound, out soundID))
|
||||
{
|
||||
//Trys to fetch sound id from prim's inventory.
|
||||
//Prim's inventory doesn't support non script items yet
|
||||
|
||||
TaskInventory.LockItemsForRead(true);
|
||||
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
|
||||
{
|
||||
if (item.Value.Name == sound)
|
||||
{
|
||||
soundID = item.Value.ItemID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TaskInventory.LockItemsForRead(false);
|
||||
}
|
||||
|
||||
ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
|
||||
sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
|
||||
});
|
||||
}
|
||||
|
||||
public void RemFlag(PrimFlags flag)
|
||||
{
|
||||
// PrimFlags prevflag = Flags;
|
||||
@@ -3297,126 +3265,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger or play an attached sound in this part's inventory.
|
||||
/// </summary>
|
||||
/// <param name="sound"></param>
|
||||
/// <param name="volume"></param>
|
||||
/// <param name="triggered"></param>
|
||||
/// <param name="flags"></param>
|
||||
public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
|
||||
{
|
||||
if (volume > 1)
|
||||
volume = 1;
|
||||
if (volume < 0)
|
||||
volume = 0;
|
||||
|
||||
UUID ownerID = OwnerID;
|
||||
UUID objectID = ParentGroup.RootPart.UUID;
|
||||
UUID parentID = ParentGroup.UUID;
|
||||
|
||||
UUID soundID = UUID.Zero;
|
||||
Vector3 position = AbsolutePosition; // region local
|
||||
ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
|
||||
if (!UUID.TryParse(sound, out soundID))
|
||||
{
|
||||
// search sound file from inventory
|
||||
TaskInventory.LockItemsForRead(true);
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
|
||||
{
|
||||
if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
|
||||
{
|
||||
soundID = item.Value.ItemID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
TaskInventory.LockItemsForRead(false);
|
||||
}
|
||||
|
||||
if (soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
|
||||
if (soundModule != null)
|
||||
{
|
||||
if (useMaster)
|
||||
{
|
||||
if (isMaster)
|
||||
{
|
||||
if (triggered)
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
|
||||
else
|
||||
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
|
||||
ParentGroup.PlaySoundMasterPrim = this;
|
||||
ownerID = OwnerID;
|
||||
objectID = ParentGroup.RootPart.UUID;
|
||||
parentID = ParentGroup.UUID;
|
||||
position = AbsolutePosition; // region local
|
||||
regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
if (triggered)
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
|
||||
else
|
||||
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
|
||||
foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
|
||||
{
|
||||
ownerID = prim.OwnerID;
|
||||
objectID = prim.ParentGroup.RootPart.UUID;
|
||||
parentID = prim.ParentGroup.UUID;
|
||||
position = prim.AbsolutePosition; // region local
|
||||
regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
if (triggered)
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
|
||||
else
|
||||
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
|
||||
}
|
||||
ParentGroup.PlaySoundSlavePrims.Clear();
|
||||
ParentGroup.PlaySoundMasterPrim = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentGroup.PlaySoundSlavePrims.Add(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (triggered)
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
|
||||
else
|
||||
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SendCollisionSound(UUID soundID, double volume, Vector3 position)
|
||||
{
|
||||
if (soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
|
||||
if (soundModule == null)
|
||||
return;
|
||||
|
||||
if (volume > 1)
|
||||
volume = 1;
|
||||
if (volume < 0)
|
||||
volume = 0;
|
||||
|
||||
int now = Util.EnvironmentTickCount();
|
||||
if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200)
|
||||
return;
|
||||
|
||||
LastColSoundSentTime = now;
|
||||
|
||||
UUID ownerID = OwnerID;
|
||||
UUID objectID = ParentGroup.RootPart.UUID;
|
||||
UUID parentID = ParentGroup.UUID;
|
||||
ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a terse update to all clients
|
||||
/// </summary>
|
||||
|
||||
@@ -75,8 +75,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
// ~ScenePresence()
|
||||
// {
|
||||
// m_log.Debug("[SCENE PRESENCE] Destructor called");
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
|
||||
// }
|
||||
|
||||
private void TriggerScenePresenceUpdated()
|
||||
{
|
||||
if (m_scene != null)
|
||||
|
||||
Reference in New Issue
Block a user