예제 #1
0
        /// <summary>
        /// Pauses the current song.
        /// </summary>
        public void Pause()
        {
            if (CurrentSong == null || !CurrentSong.IsPlaying)
                return;

            if (pausedSongName != null)
            {
                pausedSong.Stop();
                pausedSong.Destroy();
                pausedSong = null;
                pausedSongName = null;
            }

            pausedSongName = CurrentSongName;
            pausedSong = CurrentSong;

            CurrentSong.Volume = 0;
            CurrentSong.Pause();

            currentSongPosition = 0;
            CurrentSong = null;
            CurrentSongName = null;
        }
예제 #2
0
        /// <summary>
        /// Resumes the previously paused song.
        /// </summary>
        public void Resume()
        {
            if (pausedSong == null)
                return;

            if (!Playlist.Contains(pausedSongName))
            {
                pausedSong.Stop();
                pausedSong.Destroy();
                pausedSong = null;
                pausedSongName = null;
                return;
            }

            if (CurrentSong != null)
                CurrentSong.Stop();

            CurrentSong = pausedSong;
            CurrentSongName = pausedSongName;
            currentSongPosition = Playlist.IndexOf(CurrentSongName);

            if (Active)
                CurrentSong.Resume();

            CurrentSong.Volume = Volume;

            pausedSong = null;
            pausedSongName = null;

            UnloadMusic();
        }
예제 #3
0
 /// <summary>
 /// Disposes of all resources used by the MusicPlaylist.
 /// </summary>
 public void Destroy()
 {
     Playlist.Clear();
     foreach (var k in availableSounds)
         k.Value.Destroy();
     availableSounds.Clear();
     assets.Clear();
     CurrentSong = pausedSong = null;
     CurrentSongName = pausedSongName = null;
     currentSongPosition = 0;
 }