transposing LoopSoundMaster to Sound Module
parent
a68e2fe169
commit
29a8ae48b5
|
@ -243,6 +243,42 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
});
|
||||
}
|
||||
|
||||
public virtual void LoopSoundMaster(UUID objectID, UUID soundID,
|
||||
double volume, double radius)
|
||||
{
|
||||
SceneObjectPart m_host;
|
||||
if (!m_scene.TryGetSceneObjectPart(objectID, out m_host))
|
||||
return;
|
||||
|
||||
m_host.ParentGroup.LoopSoundMasterPrim = m_host;
|
||||
lock (m_host.ParentGroup.LoopSoundSlavePrims)
|
||||
{
|
||||
foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims)
|
||||
{
|
||||
if (prim.Sound != UUID.Zero)
|
||||
StopSound(objectID);
|
||||
|
||||
prim.Sound = soundID;
|
||||
prim.SoundGain = volume;
|
||||
prim.SoundFlags = 1; // looping
|
||||
prim.SoundRadius = radius;
|
||||
|
||||
prim.ScheduleFullUpdate();
|
||||
prim.SendFullUpdateToAllClients();
|
||||
}
|
||||
}
|
||||
if (m_host.Sound != UUID.Zero)
|
||||
StopSound(objectID);
|
||||
|
||||
m_host.Sound = soundID;
|
||||
m_host.SoundGain = volume;
|
||||
m_host.SoundFlags = 1; // looping
|
||||
m_host.SoundRadius = radius;
|
||||
|
||||
m_host.ScheduleFullUpdate();
|
||||
m_host.SendFullUpdateToAllClients();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,5 +84,16 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// Radius used to determine which viewers should preload the sound.
|
||||
/// </param>
|
||||
void PreloadSound(UUID soundID, UUID objectID, float radius);
|
||||
|
||||
/// <summary>
|
||||
/// Declare object as new sync master, play specified sound at
|
||||
/// specified volume with specified radius.
|
||||
/// </summary>
|
||||
/// <param name="objectID">Sound source ID</param>
|
||||
/// <param name="soundID">Sound asset ID</param>
|
||||
/// <param name="gain">Sound volume</param>
|
||||
/// <param name="radius">Sound radius</param>
|
||||
void LoopSoundMaster(UUID objectID, UUID soundID, double gain,
|
||||
double radius);
|
||||
}
|
||||
}
|
|
@ -2397,33 +2397,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public void llLoopSoundMaster(string sound, double volume)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
m_host.ParentGroup.LoopSoundMasterPrim = m_host;
|
||||
lock (m_host.ParentGroup.LoopSoundSlavePrims)
|
||||
if (m_SoundModule != null)
|
||||
{
|
||||
foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims)
|
||||
{
|
||||
if (prim.Sound != UUID.Zero)
|
||||
llStopSound();
|
||||
|
||||
prim.Sound = KeyOrName(sound);
|
||||
prim.SoundGain = volume;
|
||||
prim.SoundFlags = 1; // looping
|
||||
prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
|
||||
|
||||
prim.ScheduleFullUpdate();
|
||||
prim.SendFullUpdateToAllClients();
|
||||
}
|
||||
m_SoundModule.LoopSoundMaster(m_host.UUID, KeyOrName(sound),
|
||||
volume, 20);
|
||||
}
|
||||
if (m_host.Sound != UUID.Zero)
|
||||
llStopSound();
|
||||
|
||||
m_host.Sound = KeyOrName(sound);
|
||||
m_host.SoundGain = volume;
|
||||
m_host.SoundFlags = 1; // looping
|
||||
m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
|
||||
|
||||
m_host.ScheduleFullUpdate();
|
||||
m_host.SendFullUpdateToAllClients();
|
||||
}
|
||||
|
||||
public void llLoopSoundSlave(string sound, double volume)
|
||||
|
|
Loading…
Reference in New Issue