public Facade(string path = @"D:\Music\Egypt Central - Discography\2008 - Egypt Central") { playlist = new Playlist(path); iterator = playlist.CreateIterator(); singleton = SoundSingleton.GetInstance(); command = new PlayerCommand(singleton); }
public static SoundSingleton GetInstance() { if (instance == null) { instance = new SoundSingleton(); instance.waveOut = new WaveOut(); instance.waveOut.DeviceNumber = 0; instance.waveOut.NumberOfBuffers = 1; } return(instance); }
public void Play() { if (singleton.SoundWaveOut.PlaybackState == PlaybackState.Paused) { command.Play(); } else if (singleton.SoundWaveOut.PlaybackState == PlaybackState.Playing) { command.Pause(); } else { SoundSingleton.GetInstance().StopWaveOut(); if (File.Exists(iterator.CurrentItem().Path)) { command.Init(iterator.CurrentItem().Path); command.Play(); string name = Path.GetFileName(iterator.CurrentItem().Path).Split('.')[0]; } } }
public void Prev() { SoundSingleton.GetInstance().StopWaveOut(); command.Init(iterator.Prev().Path); command.Play(); }
public PlayerCommand(SoundSingleton singleton) { Singleton = singleton; }