diff options
author | SignpostMarv | 2012-10-05 13:50:12 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-29 23:38:57 +0000 |
commit | ed162a10beaa8bcab1c51f03a51acf5a9537eaae (patch) | |
tree | 0c531ec58c13aedcaa7e329c0bfdab594405edf4 /OpenSim | |
parent | Immediately setting gain to zero as a workaround for code not stopping sound ... (diff) | |
download | opensim-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 | |||
28 | using System; | 27 | using System; |
28 | using System.Reflection; | ||
29 | |||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using log4net; | ||
33 | using Mono.Addins; | ||
34 | |||
31 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
33 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
34 | using System.Reflection; | ||
35 | using log4net; | ||
36 | 38 | ||
37 | namespace OpenSim.Region.CoreModules.World.Sound | 39 | namespace 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 | } |