private SongItem GetNext() { if (Queue.Count < 1) { return(null); } switch (PlayMode) { case 0: if (Queue.Count > 1) { // since .Move cannot move to the last index // (learned this the hard way) SongItem tmp = Queue[0]; Queue.RemoveAt(0); Queue.Add(tmp); } return(Queue[0]); case 1: int rnd = new Random().Next(0, Queue.Count()); return(Queue.ElementAt(rnd)); case 2: return(Queue[0]); } return(null); }
public void PlayNext() { if (Queue.Count() < 1) { return; } SongItem song = GetNext(); WavePlay(song); }
public void AddNext(SongItem song) { if (Queue.Contains(song)) { Queue.Move(Queue.IndexOf(song), 1); } else { Queue.Insert(1, song); } }
public void Add(SongItem song) { if (Queue.Contains(song)) { Queue.Move(Queue.IndexOf(song), 0); } else { Queue.Add(song); } }
private void WavePlay(SongItem song) { StopPlayBack(); AddHistory(song); AudioFile = new AudioFileReader(song.Path); WavePlayer.Init(AudioFile); WavePlayer.Play(); timer.Start(); }
private void AddHistory(SongItem item) { if (History.Count == MaxHistory) { History.RemoveAt(MaxHistory - 1); } if (History.Contains(item)) { History.Remove(item); } History.Insert(0, item); }
public void PlayNow(SongItem song) { WavePlay(song); // make the new song as the first one if (Queue.Contains(song)) { Queue.Move(Queue.IndexOf(song), 0); } else { Queue.Insert(0, song); } for (int i = 0; i < Queue.Count; i++) { Console.WriteLine(i + " - " + Queue[i].Name); } Console.WriteLine(" -- "); }