Example #1
0
 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);
 }
Example #2
0
 public static SoundSingleton GetInstance()
 {
     if (instance == null)
     {
         instance         = new SoundSingleton();
         instance.waveOut = new WaveOut();
         instance.waveOut.DeviceNumber    = 0;
         instance.waveOut.NumberOfBuffers = 1;
     }
     return(instance);
 }
Example #3
0
 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];
         }
     }
 }
Example #4
0
 public void Prev()
 {
     SoundSingleton.GetInstance().StopWaveOut();
     command.Init(iterator.Prev().Path);
     command.Play();
 }
Example #5
0
 public PlayerCommand(SoundSingleton singleton)
 {
     Singleton = singleton;
 }