예제 #1
0
        public void UpdateSoundObjects()
        {
            int k = 0;

            while (true)
            {
                try
                {
                    lock (LockSync)
                    {
                        if (killUpdater)
                        {
                            updaterRunning = false;
                            killUpdater    = false;
                            return;
                        }
                    }

                    lock (LockSync)
                    {
                        if (updaterRunning)
                        {
                            //updaterRunning = true;
                            if (!_initSound)
                            {
                                return;
                            }
                            _listener.Update();

                            try
                            {
                                for (int i = 0; i < SoundObjectVector.Count; i++)
                                {
                                    if (SoundObjectVector[i] != null)
                                    {
                                        SoundObjectVector[i].Update();
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                //LogManager.Singleton.LogMessage(LogMessageLevel.LML_CRITICAL, "Error in sound loop:"+ e.Message+ e.StackTrace);
                            }
                            try
                            {
                                if (SoundObjectVector.Count > 0)
                                {
                                    FreeSL.fslUpdate();
                                }
                            }
                            catch (Exception)
                            {
                                // LogManager.Singleton.LogMessage(LogMessageLevel.LML_CRITICAL, "YEAH THATS RIGHT");
                                // throw;
                            }


                            // Console.WriteLine("Running");
                        }
                    }
                    FreeSL.fslSleep(0.01f);

                    /* k++;
                     * if(k == 2000) {
                     *       k = 0;
                     *       LogManager.Singleton.LogMessage(LogMessageLevel.LML_CRITICAL, "SLEEEEEEP");
                     *       Thread.Sleep(10000);
                     * }
                     */
                }
                catch (Exception ex)
                {
                    //	LogManager.Singleton.LogMessage(LogMessageLevel.LML_CRITICAL, "Exception in sound updater: "+ex);
                }
            }
        }