Exemple #1
0
        // updates

        internal static void Update()
        {
            FrameworkDispatcher.Update();             // to let sound update
            List <int> toKill = new List <int>();

            foreach (var sound in ActiveSounds)
            {
                if (sound.Value == null || sound.Value.Instance.State == SoundState.Stopped)
                {
                    toKill.Add(sound.Key);
                    EffectEnded?.Invoke(null, new SoundEventArgs(sound.Key));
                }
                else if (UsePostionalSound && NeedListenerUpdate)
                {
                    if (sound.Value.Emitter != null)
                    {
                        sound.Value.Instance.Apply3D(Listener, sound.Value.Emitter);
                    }
                }
            }
            NeedListenerUpdate = false;

            foreach (var sound in toKill)
            {
                ActiveSounds.Remove(sound);
            }
        }
Exemple #2
0
 public static void StopSound(int index)
 {
     if (ActiveSounds.ContainsKey(index))
     {
         ActiveSounds[index].Instance.Stop();
         ActiveSounds.Remove(index);
         EffectEnded?.Invoke(null, new SoundEventArgs(index));
     }
 }
Exemple #3
0
 internal void SendEffectEnd()
 {
     EffectEnded?.Invoke(this, EventArgs.Empty);
 }
 protected void RaiseEffectEnded()
 {
     EffectEnded?.SafeInvoke(this, EventArgs.Empty, nameof(EffectEnded));
 }