From 375fb6658909f619f3210590743c228834d0d2c0 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:01:29 +0100 Subject: [PATCH] making the max distance for sounds to be heard from their origin a configurable option exposed via a public field on ISoundModule (with private setter in the implementation) --- .../CoreModules/World/Sound/SoundModuleNonShared.cs | 12 +++++++++--- OpenSim/Region/Framework/Interfaces/ISoundModule.cs | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 9fd0a36561..ff052baaaa 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs @@ -48,13 +48,19 @@ namespace OpenSim.Region.CoreModules.World.Sound public bool Enabled { get; private set; } + public float MaxDistance { get; private set; } + #region INonSharedRegionModule public void Initialise(IConfigSource configSource) { IConfig config = configSource.Configs["Sounds"]; - Enabled = (config != null && config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared"); + if (config == null) + return; + + Enabled = config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared"; + MaxDistance = config.GetFloat("MaxDistance", 100.0f); } public void AddRegion(Scene scene) { } @@ -109,7 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Sound m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) { double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); - if (dis > 100.0) // Max audio distance + if (dis > MaxDistance) // Max audio distance return; if (grp.IsAttachment) @@ -158,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Sound { double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); - if (dis > 100.0) // Max audio distance + if (dis > MaxDistance) // Max audio distance return; float thisSpGain; diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 6117a80d9e..4c558ccea1 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -32,6 +32,8 @@ namespace OpenSim.Region.Framework.Interfaces { public interface ISoundModule { + float MaxDistance { get; } + void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); void TriggerSound(