public void llLoopSoundMaster(string sound, double volume)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;
m_host.ParentEntity.LoopSoundMasterPrim = m_host;
lock (m_host.ParentEntity.LoopSoundSlavePrims)
{
foreach (ISceneChildEntity prim in m_host.ParentEntity.LoopSoundSlavePrims)
{
if (prim.Sound != UUID.Zero)
llStopSound();
prim.Sound = KeyOrName(sound, true);
prim.SoundGain = volume;
prim.SoundFlags = (byte)SoundFlags.Loop; // looping
if (prim.SoundRadius == 0)
prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
prim.ScheduleUpdate(PrimUpdateFlags.FindBest);
}
}
if (m_host.Sound != UUID.Zero)
llStopSound();
m_host.Sound = KeyOrName(sound, true);
m_host.SoundGain = volume;
m_host.SoundFlags = (byte)SoundFlags.Loop; // looping
if (m_host.SoundRadius == 0)
m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
m_host.ScheduleUpdate(PrimUpdateFlags.FindBest);
}