Exemplo n.º 1
0
        ///<summary>Raises the AttachedSound Event</summary>
        /// <param name="e">A AttachedSoundEventArgs object containing
        /// the data sent from the simulator</param>
        protected virtual void OnAttachedSound(AttachedSoundEventArgs e)
        {
            EventHandler <AttachedSoundEventArgs> handler = m_AttachedSound;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handle sound attached to an object
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Sound_AttachedSound(object sender, AttachedSoundEventArgs e)
        {
            // This event tells us the Object ID, but not the Prim info directly.
            // So we look it up in our internal Object memory.
            Simulator sim = e.Simulator;
            Primitive p = sim.ObjectsPrimitives.Find((Primitive p2) => { return p2.ID == e.ObjectID; });
            if (p == null) return;

            // Only one attached sound per prim, so we kill any previous
            BufferSound.Kill(p.ID);

            // If this is stop sound, we're done since we've already killed sound for this object
            if ((e.Flags & SoundFlags.Stop) == SoundFlags.Stop)
            {
                return;
            }

            // We seem to get a lot of these zero sounds.
            if (e.SoundID == UUID.Zero) return;

            // If this is a child prim, its position is relative to the root.
            Vector3 fullPosition = p.Position;

            while (p != null && p.ParentID != 0)
            {
                Avatar av;
                if (sim.ObjectsAvatars.TryGetValue(p.ParentID, out av))
                {
                    p = av;
                    fullPosition += p.Position;
                }
                else
                {
                    if (sim.ObjectsPrimitives.TryGetValue(p.ParentID, out p))
                    {
                        fullPosition += p.Position;
                    }
                }
            }

            // Didn't find root prim
            if (p == null) return;

            new BufferSound(
                e.ObjectID,
                e.SoundID,
                (e.Flags & SoundFlags.Loop) == SoundFlags.Loop,
                true,
                fullPosition,
                e.Gain * ObjectVolume);
        }
Exemplo n.º 3
0
 ///<summary>Raises the AttachedSound Event</summary>
 /// <param name="e">A AttachedSoundEventArgs object containing
 /// the data sent from the simulator</param>
 protected virtual void OnAttachedSound(AttachedSoundEventArgs e)
 {
     EventHandler<AttachedSoundEventArgs> handler = m_AttachedSound;
     if (handler != null)
         handler(this, e);
 }
Exemplo n.º 4
0
        ///<summary>Raises the AttachedSound Event</summary>
        /// <param name="e">A AttachedSoundEventArgs object containing
        /// the data sent from the simulator</param>
        protected virtual void OnAttachedSound(AttachedSoundEventArgs e)
        {
            EventHandler <AttachedSoundEventArgs> handler = _mAttachedSound;

            handler?.Invoke(this, e);
        }
Exemplo n.º 5
0
 public override void Sound_OnAttachSound(object sender, AttachedSoundEventArgs e)
 {
     var soundID = e.SoundID;
     var gain = e.Gain;
     var objectID = e.ObjectID;
     if (!MaintainSounds) return;
     EnqueueRequestAsset(soundID, AssetType.Sound, true);                
     EventQueue.Enqueue(() => OnObjectSound(objectID, soundID, gain));
     //SendNewEvent("On-Attach-Sound", soundID, ownerID, objectID, gain, flags);
     //base.Sound_OnAttachSound(soundID, ownerID, objectID, gain, flags);
 }
Exemplo n.º 6
0
 public virtual void Sound_OnAttachSound(object sender, AttachedSoundEventArgs e) { OnEvent("On-Attach-Sound", paramNamesOnAttachSound, paramTypesOnAttachSound, e); }