예제 #1
0
        private void MusicThread()
        {
            int sleep = 0;

            while (!stop)
            {
                if (sleep > 0)
                {
                    Thread.Sleep(sleep);
                }

                lock (this)
                {
                    if (music == null)
                    {
                        sleep = 200;

                        string next = GetNextTitle();
                        if (next == null)
                        {
                            continue;
                        }

                        music = new SlimDXOggStreamingSample.MusicPlayer(Burntime.Platform.IO.FileSystem.GetFile(next));
                    }
                    else
                    {
                        if (music.State == SlimDXOggStreamingSample.BufferPlayState.Complete)
                        {
                            music.Dispose();
                            music = null;
                            sleep = 0;
                        }
                        else
                        {
                            sleep = 50;
                        }
                    }
                }
            }

            lock (this)
            {
                if (music != null)
                {
                    music.Dispose();
                }
            }

            SlimDXOggStreamingSample.DirectSoundWrapper.Device.Dispose();
        }
예제 #2
0
        public void Stop()
        {
            playList.Clear();

            lock (this)
            {
                if (music != null)
                {
                    music.Stop();
                    music.Dispose();
                    music = null;
                }
            }
        }