sound radius is a prim prop only set by llSetSoundRadius, fix it in case viewers do fix its use (ignored for now)
parent
dc35ce26d0
commit
ca7bd13dee
|
@ -7515,8 +7515,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, AgentId,
|
||||
AgentId, AgentId,
|
||||
soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position,
|
||||
soundTriggerPacket.SoundData.Handle, 0);
|
||||
|
||||
soundTriggerPacket.SoundData.Handle);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -125,22 +125,23 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
#region ISoundModule
|
||||
|
||||
public virtual void PlayAttachedSound(
|
||||
UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
|
||||
UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags)
|
||||
{
|
||||
SceneObjectPart part;
|
||||
if (!m_scene.TryGetSceneObjectPart(objectID, out part))
|
||||
return;
|
||||
|
||||
if (part.SoundRadius == 0)
|
||||
part.SoundRadius = MaxDistance;
|
||||
part.SoundFlags = 0;
|
||||
|
||||
SceneObjectGroup grp = part.ParentGroup;
|
||||
|
||||
if (radius == 0)
|
||||
radius = MaxDistance;
|
||||
|
||||
if (part.SoundQueueing)
|
||||
flags |= (byte)SoundFlags.QUEUE;
|
||||
|
||||
SceneObjectGroup grp = part.ParentGroup;
|
||||
if(grp == null | grp.IsDeleted)
|
||||
return;
|
||||
|
||||
if (grp.IsAttachment)
|
||||
{
|
||||
ScenePresence ssp = null;
|
||||
|
@ -166,7 +167,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
}
|
||||
|
||||
public virtual 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)
|
||||
{
|
||||
SceneObjectPart part;
|
||||
ScenePresence ssp = null;
|
||||
|
@ -188,28 +189,21 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
|
||||
if (!ssp.ParcelAllowThisAvatarSounds)
|
||||
return;
|
||||
|
||||
/* mantis 7942: coment out to allow trigger in HUDs to send sounds to all
|
||||
if (grp.HasPrivateAttachmentPoint)
|
||||
{
|
||||
ssp.ControllingClient.SendTriggeredSound(soundId, ownerID,
|
||||
objectID, parentID, handle, position,
|
||||
(float)gain);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
float radius = (float)part.SoundRadius;
|
||||
if (radius == 0)
|
||||
{
|
||||
radius = MaxDistance;
|
||||
part.SoundRadius = MaxDistance;
|
||||
}
|
||||
part.SoundFlags = 0;
|
||||
|
||||
if (radius == 0)
|
||||
radius = MaxDistance;
|
||||
|
||||
radius *= radius;
|
||||
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
|
||||
if (dis > radius) // Max audio distance
|
||||
if (Vector3.DistanceSquared(sp.AbsolutePosition, position) > radius) // Max audio distance
|
||||
return;
|
||||
|
||||
sp.ControllingClient.SendTriggeredSound(soundId, ownerID,
|
||||
|
@ -231,13 +225,12 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
{
|
||||
m_host.Sound = UUID.Zero;
|
||||
m_host.SoundFlags = (byte)SoundFlags.STOP;
|
||||
m_host.SoundRadius = 0;
|
||||
m_host.SoundGain = 0;
|
||||
m_host.ScheduleFullUpdate();
|
||||
m_host.SendFullUpdateToAllClients();
|
||||
}
|
||||
|
||||
public virtual void PreloadSound(UUID objectID, UUID soundID, float radius)
|
||||
public virtual void PreloadSound(UUID objectID, UUID soundID)
|
||||
{
|
||||
SceneObjectPart part;
|
||||
if (soundID == UUID.Zero
|
||||
|
@ -246,12 +239,17 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
return;
|
||||
}
|
||||
|
||||
float radius = (float)part.SoundRadius;
|
||||
if (radius == 0)
|
||||
{
|
||||
radius = MaxDistance;
|
||||
part.SoundRadius = radius;
|
||||
}
|
||||
|
||||
radius *= 4.0f * radius; // avatars and prims do move
|
||||
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
if (Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) < radius)
|
||||
if (Vector3.DistanceSquared(sp.AbsolutePosition, part.AbsolutePosition) < radius)
|
||||
sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
|
||||
});
|
||||
}
|
||||
|
@ -265,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
// 20080530 Updated to remove code duplication
|
||||
// 20080530 Stop sound if there is one, otherwise volume only changes don't work
|
||||
public void LoopSound(UUID objectID, UUID soundID,
|
||||
double volume, double radius, bool isMaster, bool isSlave)
|
||||
double volume, bool isMaster, bool isSlave)
|
||||
{
|
||||
SceneObjectPart m_host;
|
||||
if (!m_scene.TryGetSceneObjectPart(objectID, out m_host))
|
||||
|
@ -283,14 +281,15 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
m_host.Sound = soundID;
|
||||
m_host.SoundGain = volume;
|
||||
m_host.SoundFlags = iflags;
|
||||
m_host.SoundRadius = radius;
|
||||
if (m_host.SoundRadius == 0)
|
||||
m_host.SoundRadius = MaxDistance;
|
||||
|
||||
m_host.ScheduleFullUpdate();
|
||||
m_host.SendFullUpdateToAllClients();
|
||||
}
|
||||
|
||||
public void SendSound(UUID objectID, UUID soundID, double volume,
|
||||
bool triggered, byte flags, float radius, bool useMaster,
|
||||
bool triggered, byte flags, bool useMaster,
|
||||
bool isMaster)
|
||||
{
|
||||
if (soundID == UUID.Zero)
|
||||
|
@ -308,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
ulong regionHandle = m_scene.RegionInfo.RegionHandle;
|
||||
|
||||
if(triggered)
|
||||
TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius);
|
||||
TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle);
|
||||
else
|
||||
{
|
||||
byte bflags = 0;
|
||||
|
@ -318,7 +317,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
// TODO check viewer seems to accept both
|
||||
if (useMaster)
|
||||
bflags |= (byte)SoundFlags.SYNC_SLAVE;
|
||||
PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, bflags, radius);
|
||||
PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, bflags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,6 +338,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
|
||||
if (dis > MaxDistance) // Max audio distance
|
||||
return;
|
||||
|
||||
else if (!Util.IsInsideBox(sp.AbsolutePosition, min, max))
|
||||
return;
|
||||
|
||||
|
|
|
@ -46,11 +46,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <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);
|
||||
double gain, Vector3 position, byte flags);
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a sound in the scene.
|
||||
|
@ -67,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// </param>
|
||||
void TriggerSound(
|
||||
UUID soundId, UUID ownerID, UUID objectID, UUID parentID,
|
||||
double gain, Vector3 position, UInt64 handle, float radius);
|
||||
double gain, Vector3 position, UInt64 handle);
|
||||
|
||||
/// <summary>
|
||||
/// Stop sounds eminating from an object.
|
||||
|
@ -80,10 +78,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// </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);
|
||||
void PreloadSound(UUID objectID, UUID soundID);
|
||||
|
||||
/// <summary>
|
||||
/// Loop specified sound at specified volume with specified radius,
|
||||
|
@ -92,10 +88,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <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, bool isSlave);
|
||||
bool isMaster, bool isSlave);
|
||||
|
||||
/// <summary>
|
||||
/// Trigger or play an attached sound in this part's inventory.
|
||||
|
@ -104,11 +99,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="sound">Sound asset ID</param>
|
||||
/// <param name="volume">Sound volume</param>
|
||||
/// <param name="triggered">Triggered or not.</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 triggered, byte flags, bool useMaster,
|
||||
bool isMaster);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -3077,7 +3077,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
UUID parentID = ParentGroup.UUID;
|
||||
ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 );
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle);
|
||||
}
|
||||
|
||||
public void PhysicsOutOfBounds(Vector3 pos)
|
||||
|
|
|
@ -824,7 +824,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
ISoundModule module = m_rootScene.RequestModuleInterface<ISoundModule>();
|
||||
if (module != null)
|
||||
{
|
||||
module.SendSound(GetSOP().UUID, asset, volume, true, 0, 0, false, false);
|
||||
module.SendSound(GetSOP().UUID, asset, volume, true, 0, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
if (soundModule != null)
|
||||
{
|
||||
soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, volume, position,
|
||||
m_internalScene.RegionInfo.RegionHandle, 0);
|
||||
m_internalScene.RegionInfo.RegionHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
if (soundModule != null)
|
||||
{
|
||||
soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, 1.0, position,
|
||||
m_internalScene.RegionInfo.RegionHandle, 0);
|
||||
m_internalScene.RegionInfo.RegionHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3178,7 +3178,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return;
|
||||
|
||||
// send the sound, once, to all clients in range
|
||||
m_SoundModule.SendSound(m_host.UUID, soundID, volume, false, 0, 0, false, false);
|
||||
m_SoundModule.SendSound(m_host.UUID, soundID, volume, false, 0, false, false);
|
||||
}
|
||||
|
||||
public void llLoopSound(string sound, double volume)
|
||||
|
@ -3192,7 +3192,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_SoundModule.LoopSound(m_host.UUID, soundID, volume, 20, false,false);
|
||||
m_SoundModule.LoopSound(m_host.UUID, soundID, volume, false,false);
|
||||
}
|
||||
|
||||
public void llLoopSoundMaster(string sound, double volume)
|
||||
|
@ -3206,7 +3206,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_SoundModule.LoopSound(m_host.UUID, soundID, volume, 20, true, false);
|
||||
m_SoundModule.LoopSound(m_host.UUID, soundID, volume, true, false);
|
||||
}
|
||||
|
||||
public void llLoopSoundSlave(string sound, double volume)
|
||||
|
@ -3220,7 +3220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_SoundModule.LoopSound(m_host.UUID, soundID, volume, 20, false, true);
|
||||
m_SoundModule.LoopSound(m_host.UUID, soundID, volume, false, true);
|
||||
}
|
||||
|
||||
public void llPlaySoundSlave(string sound, double volume)
|
||||
|
@ -3235,7 +3235,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return;
|
||||
|
||||
// send the sound, once, to all clients in range
|
||||
m_SoundModule.SendSound(m_host.UUID, soundID, volume, false, 0, 0, true, false);
|
||||
m_SoundModule.SendSound(m_host.UUID, soundID, volume, false, 0, true, false);
|
||||
}
|
||||
|
||||
public void llTriggerSound(string sound, double volume)
|
||||
|
@ -3250,7 +3250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return;
|
||||
|
||||
// send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory.
|
||||
m_SoundModule.SendSound(m_host.UUID, soundID, volume, true, 0, 0, false, false);
|
||||
m_SoundModule.SendSound(m_host.UUID, soundID, volume, true, 0, false, false);
|
||||
}
|
||||
|
||||
public void llStopSound()
|
||||
|
@ -3272,7 +3272,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_SoundModule.PreloadSound(m_host.UUID, soundID, 0);
|
||||
m_SoundModule.PreloadSound(m_host.UUID, soundID);
|
||||
ScriptSleep(m_sleepMsOnPreloadSound);
|
||||
}
|
||||
|
||||
|
|
|
@ -4873,7 +4873,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return;
|
||||
|
||||
// send the sound, once, to all clients in range
|
||||
m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, 0, false, false);
|
||||
m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, false, false);
|
||||
}
|
||||
|
||||
public void osLoopSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
|
||||
|
@ -4891,7 +4891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_SoundModule.LoopSound(sop.UUID, soundID, volume, 20, false,false);
|
||||
m_SoundModule.LoopSound(sop.UUID, soundID, volume, false,false);
|
||||
}
|
||||
|
||||
public void osLoopSoundMaster(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
|
||||
|
@ -4906,7 +4906,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_SoundModule.LoopSound(sop.UUID, soundID, volume, 20, true, false);
|
||||
m_SoundModule.LoopSound(sop.UUID, soundID, volume, true, false);
|
||||
}
|
||||
|
||||
public void osLoopSoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
|
||||
|
@ -4924,7 +4924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_SoundModule.LoopSound(sop.UUID, soundID, volume, 20, false, true);
|
||||
m_SoundModule.LoopSound(sop.UUID, soundID, volume, false, true);
|
||||
}
|
||||
|
||||
public void osPlaySoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
|
||||
|
@ -4943,7 +4943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return;
|
||||
|
||||
// send the sound, once, to all clients in range
|
||||
m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, 0, true, false);
|
||||
m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, true, false);
|
||||
}
|
||||
|
||||
public void osTriggerSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
|
||||
|
@ -4962,7 +4962,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return;
|
||||
|
||||
// send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory.
|
||||
m_SoundModule.SendSound(sop.UUID, soundID, volume, true, 0, 0, false, false);
|
||||
m_SoundModule.SendSound(sop.UUID, soundID, volume, true, 0, false, false);
|
||||
}
|
||||
|
||||
public void osTriggerSoundLimited(LSL_Integer linknum, LSL_String sound, LSL_Float volume,
|
||||
|
@ -5014,7 +5014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
m_SoundModule.PreloadSound(sop.UUID, soundID, 0);
|
||||
m_SoundModule.PreloadSound(sop.UUID, soundID);
|
||||
ScriptSleep(1000);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue