// Xantor 20080528: Clear prim data of sound instead
        public void llStopSound()
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            m_host.AdjustSoundGain(0);
            lock (m_host.ParentEntity.LoopSoundSlavePrims) {
                if (m_host.ParentEntity.LoopSoundMasterPrim == m_host.UUID)
                {
                    foreach (UUID child in m_host.ParentEntity.LoopSoundSlavePrims)
                    {
                        ISceneChildEntity part = m_host.ParentEntity.GetChildPart(child);
                        if (part == null)
                        {
                            continue;
                        }
                        part.Sound      = UUID.Zero;
                        part.SoundGain  = 0;
                        part.SoundFlags = (byte)SoundFlags.None;
                        part.AdjustSoundGain(0);
                        part.ScheduleUpdate(PrimUpdateFlags.FindBest);
                    }
                    m_host.ParentEntity.LoopSoundMasterPrim = UUID.Zero;
                    m_host.ParentEntity.LoopSoundSlavePrims.Clear();
                }
                else
                {
                    if (m_host.ParentEntity.LoopSoundSlavePrims.Contains(m_host.UUID))
                    {
                        m_host.Sound      = UUID.Zero;
                        m_host.SoundGain  = 0;
                        m_host.SoundFlags = (byte)SoundFlags.None;
                        m_host.ScheduleUpdate(PrimUpdateFlags.FindBest);
                    }
                    else
                    {
                        m_host.Sound      = UUID.Zero;
                        m_host.SoundGain  = 0;
                        m_host.SoundFlags = (byte)SoundFlags.Stop | (byte)SoundFlags.None;
                        m_host.ScheduleUpdate(PrimUpdateFlags.FindBest);
                    }
                }
            }
        }
        public void llLoopSoundMaster(string sound, double volume)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            lock (m_host.ParentEntity.LoopSoundSlavePrims) {
                m_host.ParentEntity.LoopSoundMasterPrim = m_host.UUID;
                foreach (UUID child in m_host.ParentEntity.LoopSoundSlavePrims)
                {
                    ISceneChildEntity part = m_host.ParentEntity.GetChildPart(child);
                    if (part == null)
                    {
                        continue;
                    }
                    part.Sound     = KeyOrName(sound, AssetType.Sound, true);
                    part.SoundGain = volume;
                    part.AdjustSoundGain(volume);
                    part.SoundFlags = (byte)SoundFlags.Loop; // looping
                    if (FloatAlmostEqual(part.SoundRadius, 0))
                    {
                        part.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
                    }
                    part.ScheduleUpdate(PrimUpdateFlags.FindBest);
                }
            }
            //if (m_host.Sound != UUID.Zero)
            //    llStopSound();

            m_host.AdjustSoundGain(volume);
            m_host.Sound      = KeyOrName(sound, AssetType.Sound, true);
            m_host.SoundGain  = volume;
            m_host.SoundFlags = (byte)SoundFlags.Loop; // looping
            if (FloatAlmostEqual(m_host.SoundRadius, 0))
            {
                m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
            }
            m_host.ScheduleUpdate(PrimUpdateFlags.ForcedFullUpdate);
        }