MediaPlayer is perfect for UIs, as it implements INotifyPropertyChanged.
Also, unlike normal, Properties/Effects/DSP set on a MediaPlayer persist through subsequent loads.
public MusicPlayer(IEnumerable <Track> tracks) { musicPlayer = new MediaPlayer(); musicPlayer.MediaEnded += TrackPlayEnded; Queue = new List <Track>(tracks); CurrentTrack = Queue.Count >= 1 ? Queue[0] : null; }
/// <summary> /// Applies the DSP on a <see cref="MediaPlayer"/>. /// </summary> /// <param name="Player"><see cref="MediaPlayer"/> to apply the DSP on.</param> /// <param name="Priority">Priority of the DSP in the DSP chain.</param> public void ApplyOn(MediaPlayer Player, int Priority = 0) { _priority = Priority; Reassign(Player.Handle); Player.MediaLoaded += Reassign; }