Merge branch 'master' of /var/git/opensim/
commit
3711f956a6
|
@ -31,12 +31,14 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Sound
|
namespace OpenSim.Region.CoreModules.World.Sound
|
||||||
{
|
{
|
||||||
public class SoundModule : IRegionModule, ISoundModule
|
public class SoundModule : IRegionModule, ISoundModule
|
||||||
{
|
{
|
||||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
|
|
||||||
|
@ -62,6 +64,12 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
||||||
public virtual void PlayAttachedSound(
|
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, float radius)
|
||||||
{
|
{
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
|
||||||
|
if (part == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SceneObjectGroup grp = part.ParentGroup;
|
||||||
|
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
|
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
|
||||||
{
|
{
|
||||||
if (sp.IsChildAgent)
|
if (sp.IsChildAgent)
|
||||||
|
@ -71,12 +79,25 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
||||||
if (dis > 100.0) // Max audio distance
|
if (dis > 100.0) // Max audio distance
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (grp.IsAttachment)
|
||||||
|
{
|
||||||
|
if (grp.GetAttachmentPoint() > 30) // HUD
|
||||||
|
{
|
||||||
|
if (sp.ControllingClient.AgentId != grp.OwnerID)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sp.ControllingClient.AgentId == grp.OwnerID)
|
||||||
|
dis = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Scale by distance
|
// Scale by distance
|
||||||
if (radius == 0)
|
if (radius == 0)
|
||||||
gain = (float)((double)gain * ((100.0 - dis) / 100.0));
|
gain = (float)((double)gain * ((100.0 - dis) / 100.0));
|
||||||
else
|
else
|
||||||
gain = (float)((double)gain * ((radius - dis) / radius));
|
gain = (float)((double)gain * ((radius - dis) / radius));
|
||||||
|
|
||||||
|
m_log.DebugFormat("Play sound, gain {0}", gain);
|
||||||
sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
|
sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -84,6 +105,18 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
||||||
public virtual void TriggerSound(
|
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, float radius)
|
||||||
{
|
{
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
|
||||||
|
if (part == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SceneObjectGroup grp = part.ParentGroup;
|
||||||
|
|
||||||
|
if (grp.IsAttachment && grp.GetAttachmentPoint() > 30)
|
||||||
|
{
|
||||||
|
objectID = ownerID;
|
||||||
|
parentID = ownerID;
|
||||||
|
}
|
||||||
|
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
|
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
|
||||||
{
|
{
|
||||||
if (sp.IsChildAgent)
|
if (sp.IsChildAgent)
|
||||||
|
|
|
@ -3100,6 +3100,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UUID ownerID = _ownerID;
|
UUID ownerID = _ownerID;
|
||||||
UUID objectID = ParentGroup.RootPart.UUID;
|
UUID objectID = ParentGroup.RootPart.UUID;
|
||||||
UUID parentID = GetRootPartUUID();
|
UUID parentID = GetRootPartUUID();
|
||||||
|
|
||||||
UUID soundID = UUID.Zero;
|
UUID soundID = UUID.Zero;
|
||||||
Vector3 position = AbsolutePosition; // region local
|
Vector3 position = AbsolutePosition; // region local
|
||||||
ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle;
|
ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle;
|
||||||
|
|
Loading…
Reference in New Issue