public static double GetSongLength(ent::Song song) { TimeSpan timeSpan = new Mp3FileReader(song.Uri).TotalTime; double time = timeSpan.TotalSeconds; return(time); }
public int GetIndexOfSong(ent::Song song) { return (this.GetAll() .Select(x => x.Uri) .ToList() .IndexOf(song.Uri)); }
public Play ( ent::Song songToPlay ) { songToPlay.Should().NotBeNull(); this.songToPlay = songToPlay; }
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; }
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; } }
public int GetIndexOfSong(ent::Song song) => this.GetAll().IndexOf(song);