aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSignpostMarv2012-10-05 13:50:12 +0100
committerJustin Clark-Casey (justincc)2012-10-29 23:38:57 +0000
commited162a10beaa8bcab1c51f03a51acf5a9537eaae (patch)
tree0c531ec58c13aedcaa7e329c0bfdab594405edf4 /OpenSim
parentImmediately setting gain to zero as a workaround for code not stopping sound ... (diff)
downloadopensim-SC_OLD-ed162a10beaa8bcab1c51f03a51acf5a9537eaae.zip
opensim-SC_OLD-ed162a10beaa8bcab1c51f03a51acf5a9537eaae.tar.gz
opensim-SC_OLD-ed162a10beaa8bcab1c51f03a51acf5a9537eaae.tar.bz2
opensim-SC_OLD-ed162a10beaa8bcab1c51f03a51acf5a9537eaae.tar.xz
Converting the ISoundModule implementation from an IRegionModule to an INonSharedRegionModule
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs (renamed from OpenSim/Region/CoreModules/World/Sound/SoundModule.cs)78
1 files changed, 58 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
index a2f0950..9fd0a36 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -24,43 +24,79 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
28using System; 27using System;
28using System.Reflection;
29
29using Nini.Config; 30using Nini.Config;
30using OpenMetaverse; 31using OpenMetaverse;
32using log4net;
33using Mono.Addins;
34
31using OpenSim.Framework; 35using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
34using System.Reflection;
35using log4net;
36 38
37namespace OpenSim.Region.CoreModules.World.Sound 39namespace OpenSim.Region.CoreModules.World.Sound
38{ 40{
39 public class SoundModule : IRegionModule, ISoundModule 41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SoundModuleNonShared")]
42 public class SoundModuleNonShared : INonSharedRegionModule, ISoundModule
40 { 43 {
41// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(
42 45 MethodBase.GetCurrentMethod().DeclaringType);
43 protected Scene m_scene; 46
44 47 private Scene m_scene;
45 public void Initialise(Scene scene, IConfigSource source) 48
49 public bool Enabled { get; private set; }
50
51 #region INonSharedRegionModule
52
53 public void Initialise(IConfigSource configSource)
46 { 54 {
55 IConfig config = configSource.Configs["Sounds"];
56
57 Enabled = (config != null && config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared");
58 }
59
60 public void AddRegion(Scene scene) { }
61
62 public void RemoveRegion(Scene scene)
63 {
64 m_scene.EventManager.OnClientLogin -= OnNewClient;
65 }
66
67 public void RegionLoaded(Scene scene)
68 {
69 if (!Enabled)
70 return;
71
47 m_scene = scene; 72 m_scene = scene;
48 73 m_scene.EventManager.OnClientLogin += OnNewClient;
49 m_scene.EventManager.OnNewClient += OnNewClient; 74
50
51 m_scene.RegisterModuleInterface<ISoundModule>(this); 75 m_scene.RegisterModuleInterface<ISoundModule>(this);
52 } 76 }
53 77
54 public void PostInitialise() {} 78 public void Close() { }
55 public void Close() {} 79
80 public Type ReplaceableInterface
81 {
82 get { return typeof(ISoundModule); }
83 }
84
56 public string Name { get { return "Sound Module"; } } 85 public string Name { get { return "Sound Module"; } }
57 public bool IsSharedModule { get { return false; } } 86
58 87 #endregion
88
89 #region Event Handlers
90
59 private void OnNewClient(IClientAPI client) 91 private void OnNewClient(IClientAPI client)
60 { 92 {
61 client.OnSoundTrigger += TriggerSound; 93 client.OnSoundTrigger += TriggerSound;
62 } 94 }
63 95
96 #endregion
97
98 #region ISoundModule
99
64 public virtual void PlayAttachedSound( 100 public virtual void PlayAttachedSound(
65 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) 101 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
66 { 102 {
@@ -96,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
96 sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); 132 sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags);
97 }); 133 });
98 } 134 }
99 135
100 public virtual void TriggerSound( 136 public virtual void TriggerSound(
101 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) 137 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
102 { 138 {
@@ -137,5 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
137 soundId, ownerID, objectID, parentID, handle, position, thisSpGain); 173 soundId, ownerID, objectID, parentID, handle, position, thisSpGain);
138 }); 174 });
139 } 175 }
176
177 #endregion
140 } 178 }
141} 179}