diff options
author | SignpostMarv | 2012-10-06 22:23:14 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-29 23:38:59 +0000 |
commit | 29a8ae48b51de55a02f839b6e4566054ad3f7f58 (patch) | |
tree | a9b27473da15d2aa16102322fcfe7f0d42bacb9d | |
parent | transposing preload sound onto sound module (diff) | |
download | opensim-SC-29a8ae48b51de55a02f839b6e4566054ad3f7f58.zip opensim-SC-29a8ae48b51de55a02f839b6e4566054ad3f7f58.tar.gz opensim-SC-29a8ae48b51de55a02f839b6e4566054ad3f7f58.tar.bz2 opensim-SC-29a8ae48b51de55a02f839b6e4566054ad3f7f58.tar.xz |
transposing LoopSoundMaster to Sound Module
3 files changed, 50 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 0225d6f..4912ed8 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | |||
@@ -243,6 +243,42 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
243 | }); | 243 | }); |
244 | } | 244 | } |
245 | 245 | ||
246 | public virtual void LoopSoundMaster(UUID objectID, UUID soundID, | ||
247 | double volume, double radius) | ||
248 | { | ||
249 | SceneObjectPart m_host; | ||
250 | if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) | ||
251 | return; | ||
252 | |||
253 | m_host.ParentGroup.LoopSoundMasterPrim = m_host; | ||
254 | lock (m_host.ParentGroup.LoopSoundSlavePrims) | ||
255 | { | ||
256 | foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) | ||
257 | { | ||
258 | if (prim.Sound != UUID.Zero) | ||
259 | StopSound(objectID); | ||
260 | |||
261 | prim.Sound = soundID; | ||
262 | prim.SoundGain = volume; | ||
263 | prim.SoundFlags = 1; // looping | ||
264 | prim.SoundRadius = radius; | ||
265 | |||
266 | prim.ScheduleFullUpdate(); | ||
267 | prim.SendFullUpdateToAllClients(); | ||
268 | } | ||
269 | } | ||
270 | if (m_host.Sound != UUID.Zero) | ||
271 | StopSound(objectID); | ||
272 | |||
273 | m_host.Sound = soundID; | ||
274 | m_host.SoundGain = volume; | ||
275 | m_host.SoundFlags = 1; // looping | ||
276 | m_host.SoundRadius = radius; | ||
277 | |||
278 | m_host.ScheduleFullUpdate(); | ||
279 | m_host.SendFullUpdateToAllClients(); | ||
280 | } | ||
281 | |||
246 | #endregion | 282 | #endregion |
247 | } | 283 | } |
248 | } | 284 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 0f65763..d2557b5 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs | |||
@@ -84,5 +84,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
84 | /// Radius used to determine which viewers should preload the sound. | 84 | /// Radius used to determine which viewers should preload the sound. |
85 | /// </param> | 85 | /// </param> |
86 | void PreloadSound(UUID soundID, UUID objectID, float radius); | 86 | void PreloadSound(UUID soundID, UUID objectID, float radius); |
87 | |||
88 | /// <summary> | ||
89 | /// Declare object as new sync master, play specified sound at | ||
90 | /// specified volume with specified radius. | ||
91 | /// </summary> | ||
92 | /// <param name="objectID">Sound source ID</param> | ||
93 | /// <param name="soundID">Sound asset ID</param> | ||
94 | /// <param name="gain">Sound volume</param> | ||
95 | /// <param name="radius">Sound radius</param> | ||
96 | void LoopSoundMaster(UUID objectID, UUID soundID, double gain, | ||
97 | double radius); | ||
87 | } | 98 | } |
88 | } \ No newline at end of file | 99 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 61fd1aa..2669add 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2397,33 +2397,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2397 | public void llLoopSoundMaster(string sound, double volume) | 2397 | public void llLoopSoundMaster(string sound, double volume) |
2398 | { | 2398 | { |
2399 | m_host.AddScriptLPS(1); | 2399 | m_host.AddScriptLPS(1); |
2400 | m_host.ParentGroup.LoopSoundMasterPrim = m_host; | 2400 | if (m_SoundModule != null) |
2401 | lock (m_host.ParentGroup.LoopSoundSlavePrims) | ||
2402 | { | 2401 | { |
2403 | foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) | 2402 | m_SoundModule.LoopSoundMaster(m_host.UUID, KeyOrName(sound), |
2404 | { | 2403 | volume, 20); |
2405 | if (prim.Sound != UUID.Zero) | ||
2406 | llStopSound(); | ||
2407 | |||
2408 | prim.Sound = KeyOrName(sound); | ||
2409 | prim.SoundGain = volume; | ||
2410 | prim.SoundFlags = 1; // looping | ||
2411 | prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | ||
2412 | |||
2413 | prim.ScheduleFullUpdate(); | ||
2414 | prim.SendFullUpdateToAllClients(); | ||
2415 | } | ||
2416 | } | 2404 | } |
2417 | if (m_host.Sound != UUID.Zero) | ||
2418 | llStopSound(); | ||
2419 | |||
2420 | m_host.Sound = KeyOrName(sound); | ||
2421 | m_host.SoundGain = volume; | ||
2422 | m_host.SoundFlags = 1; // looping | ||
2423 | m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | ||
2424 | |||
2425 | m_host.ScheduleFullUpdate(); | ||
2426 | m_host.SendFullUpdateToAllClients(); | ||
2427 | } | 2405 | } |
2428 | 2406 | ||
2429 | public void llLoopSoundSlave(string sound, double volume) | 2407 | public void llLoopSoundSlave(string sound, double volume) |