aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSignpostMarv2012-10-15 14:28:34 +0100
committerJustin Clark-Casey (justincc)2012-10-29 23:38:59 +0000
commit9df510157e26ffcaf04fd4b85512778fddc08f68 (patch)
treecdbe80ed975bd16cd59416e556fdbb2a4273d4ef
parentremoving superfluous lines from SceneObjectPart.SendSound (diff)
downloadopensim-SC_OLD-9df510157e26ffcaf04fd4b85512778fddc08f68.zip
opensim-SC_OLD-9df510157e26ffcaf04fd4b85512778fddc08f68.tar.gz
opensim-SC_OLD-9df510157e26ffcaf04fd4b85512778fddc08f68.tar.bz2
opensim-SC_OLD-9df510157e26ffcaf04fd4b85512778fddc08f68.tar.xz
deduplicating code into a single LoopSound method
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs13
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
3 files changed, 23 insertions, 27 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
index b4b8e79..6f35a23 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
@@ -248,13 +248,22 @@ namespace OpenSim.Region.CoreModules.World.Sound
248 }); 248 });
249 } 249 }
250 250
251 public virtual void LoopSoundMaster(UUID objectID, UUID soundID, 251 // Xantor 20080528 we should do this differently.
252 double volume, double radius) 252 // 1) apply the sound to the object
253 // 2) schedule full update
254 // just sending the sound out once doesn't work so well when other avatars come in view later on
255 // or when the prim gets moved, changed, sat on, whatever
256 // see large number of mantises (mantes?)
257 // 20080530 Updated to remove code duplication
258 // 20080530 Stop sound if there is one, otherwise volume only changes don't work
259 public void LoopSound(UUID objectID, UUID soundID,
260 double volume, double radius, bool isMaster)
253 { 261 {
254 SceneObjectPart m_host; 262 SceneObjectPart m_host;
255 if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) 263 if (!m_scene.TryGetSceneObjectPart(objectID, out m_host))
256 return; 264 return;
257 265
266 if (isMaster)
258 m_host.ParentGroup.LoopSoundMasterPrim = m_host; 267 m_host.ParentGroup.LoopSoundMasterPrim = m_host;
259 268
260 if (m_host.Sound != UUID.Zero) 269 if (m_host.Sound != UUID.Zero)
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index d34a520..e514a59 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -86,14 +86,15 @@ namespace OpenSim.Region.Framework.Interfaces
86 void PreloadSound(UUID objectID, UUID soundID, float radius); 86 void PreloadSound(UUID objectID, UUID soundID, float radius);
87 87
88 /// <summary> 88 /// <summary>
89 /// Declare object as new sync master, play specified sound at 89 /// Loop specified sound at specified volume with specified radius,
90 /// specified volume with specified radius. 90 /// optionally declaring object as new sync master.
91 /// </summary> 91 /// </summary>
92 /// <param name="objectID">Sound source ID</param> 92 /// <param name="objectID">Sound source ID</param>
93 /// <param name="soundID">Sound asset ID</param> 93 /// <param name="soundID">Sound asset ID</param>
94 /// <param name="gain">Sound volume</param> 94 /// <param name="gain">Sound volume</param>
95 /// <param name="radius">Sound radius</param> 95 /// <param name="radius">Sound radius</param>
96 void LoopSoundMaster(UUID objectID, UUID soundID, double gain, 96 /// <param name="isMaster">Set object to sync master if true</param>
97 double radius); 97 void LoopSound(UUID objectID, UUID soundID, double gain,
98 double radius, bool isMaster);
98 } 99 }
99} \ No newline at end of file 100} \ 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 0252145..c479944 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2370,28 +2370,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2370 m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); 2370 m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false);
2371 } 2371 }
2372 2372
2373 // Xantor 20080528 we should do this differently.
2374 // 1) apply the sound to the object
2375 // 2) schedule full update
2376 // just sending the sound out once doesn't work so well when other avatars come in view later on
2377 // or when the prim gets moved, changed, sat on, whatever
2378 // see large number of mantises (mantes?)
2379 // 20080530 Updated to remove code duplication
2380 // 20080530 Stop sound if there is one, otherwise volume only changes don't work
2381 public void llLoopSound(string sound, double volume) 2373 public void llLoopSound(string sound, double volume)
2382 { 2374 {
2383 m_host.AddScriptLPS(1); 2375 m_host.AddScriptLPS(1);
2384 2376 if (m_SoundModule != null)
2385 if (m_host.Sound != UUID.Zero) 2377 {
2386 llStopSound(); 2378 m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound),
2387 2379 volume, 20, false);
2388 m_host.Sound = KeyOrName(sound); 2380 }
2389 m_host.SoundGain = volume;
2390 m_host.SoundFlags = 1; // looping
2391 m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
2392
2393 m_host.ScheduleFullUpdate();
2394 m_host.SendFullUpdateToAllClients();
2395 } 2381 }
2396 2382
2397 public void llLoopSoundMaster(string sound, double volume) 2383 public void llLoopSoundMaster(string sound, double volume)
@@ -2399,8 +2385,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2399 m_host.AddScriptLPS(1); 2385 m_host.AddScriptLPS(1);
2400 if (m_SoundModule != null) 2386 if (m_SoundModule != null)
2401 { 2387 {
2402 m_SoundModule.LoopSoundMaster(m_host.UUID, KeyOrName(sound), 2388 m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound),
2403 volume, 20); 2389 volume, 20, true);
2404 } 2390 }
2405 } 2391 }
2406 2392