示例#1
0
        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <value>The instance.</value>

        /* public static FSLSoundManager Instance
         * {
         *   get { return SingletonCreator.instance; }
         * }
         *
         * private class SingletonCreator
         * {
         *   // Explicit static constructor to tell C# compiler
         *   // not to mark type as beforefieldinit
         *   static SingletonCreator()
         *   {
         *   }
         *
         *   internal static readonly FSLSoundManager instance = new FSLSoundManager();
         * }*/

        #endregion

        #region Private Members

        private FSLSoundObject AddSound(FSLSoundObject sound)
        {
            lock (this)
            {
                SoundObjectVector.Add(sound);
                return(sound);
            }
        }
示例#2
0
 public void RemoveSound(string name)
 {
     lock (LockSync)
     {
         FSLSoundObject sound = GetSound(name);
         if (sound == null)
         {
             return;
         }
         else
         {
             SoundObjectVector.Remove(sound); // zmiana
             sound.Destroy();
             sound = null;
         }
     }
 }
示例#3
0
        public virtual void Destroy()
        {
            lock (LockSync)
            {
                updaterRunning = false;
                killUpdater    = true;
            }

            if (updaterThread != null)
            {
                while (updaterThread.ThreadState != ThreadState.Stopped && updaterThread.ThreadState != ThreadState.Unstarted)
                {
                    Thread.Sleep(100);
                }
            }



            killUpdater   = false;
            updaterThread = new Thread(UpdateSoundObjects);

            if (SoundObjectVector.Count != 0)
            {
                for (int i = 0; i < SoundObjectVector.Count; i++)
                {
                    LogManager.Singleton.LogMessage(LogMessageLevel.LML_NORMAL, "Disposing sound object: " + SoundObjectVector[i].Name);

                    SoundObjectVector[i].Destroy();
                }
                SoundObjectVector.Clear();
            }
            if (_listener != null)
            {
                _listener = null;
            }
            if (_initSound)
            {
                ShutDown();
            }
            _initSound = false;
        }