示例#1
0
        public static double GetSongLength(ent::Song song)
        {
            TimeSpan timeSpan = new Mp3FileReader(song.Uri).TotalTime;
            double   time     = timeSpan.TotalSeconds;

            return(time);
        }
示例#2
0
 public int GetIndexOfSong(ent::Song song)
 {
     return
         (this.GetAll()
          .Select(x => x.Uri)
          .ToList()
          .IndexOf(song.Uri));
 }
示例#3
0
文件: Commands.cs 项目: jipyana/Tempo
            public Play
            (
                ent::Song songToPlay
            )
            {
                songToPlay.Should().NotBeNull();

                this.songToPlay = songToPlay;
            }
示例#4
0
 public void Stop()
 {
     if (waveOut != null)
     {
         waveOut.Stop();
         waveOut.Dispose();
         waveOut = null;
     }
     if (reader != null)
     {
         reader.Close();
         reader.Dispose();
     }
     this.IsPlaying   = false;
     this.PlayingSong = null;
 }
示例#5
0
        public void Play(ent::Song song)
        {
            if (IsPaused)
            {
                waveOut.Resume();
                IsPaused = false;
            }
            else
            {
                //MessageBox.Show("" + new Mp3FileReader(song.Uri).TotalTime);
                song.Should().NotBeNull();
                this.Stop();

                waveOut = new WaveOut();
                var mp3FileReader = new Mp3FileReader(song.Uri);
                waveOut.Init(mp3FileReader);
                waveOut.Play();
                waveOut.PlaybackStopped += (sender, args) => OnPlaybackEnded?.Invoke();

                this.IsPaused    = false;
                this.IsPlaying   = true;
                this.PlayingSong = song;
            }
        }
示例#6
0
 public int GetIndexOfSong(ent::Song song) => this.GetAll().IndexOf(song);