private string PlayPlayback(string playlistName, string displayName)
        {
            // todo: do we need our own file reader????

            currentPlayback = MainForm.currentPreference.PlaybackPlaylists.First(x => x.PlaylistName == playlistName).Playlist.First(y => y.DisplayName == displayName);

            string filePath = currentPlayback.FilePath;

            playbackPlaylist = playlistName;

            if (File.Exists(filePath))
            {
                liveVoice = true;

                FadeOutSound();

                MainForm.StatusText = $"Playing {displayName}";

                audioFileReader = new AudioFileReader(filePath);

                voiceOut = new WaveOutEvent();

                voiceOut.PlaybackStopped += voiceOut_PlaybackStopped;

                voiceOut.Init(audioFileReader);

                voiceOut.Play();

                return("Playing");
            }

            return("Could not find");
        }
        private string PlayLiveVoice(string filePath)
        {
            if (File.Exists(filePath))
            {
                WACAudioFile liveVoiceFile = new WACAudioFile(filePath, "Live Voice");

                currentPlayback = liveVoiceFile;

                liveVoice = true;

                FadeOutSound();

                MainForm.StatusText = $"Playing {liveVoiceFile.DisplayName}";

                audioFileReader = new AudioFileReader(filePath);

                voiceOut = new WaveOutEvent();

                voiceOut.PlaybackStopped += voiceOut_PlaybackStopped;

                voiceOut.Init(audioFileReader);

                voiceOut.Play();

                return("Playing");
            }

            return("Error Playing Live Voice");
        }
예제 #3
0
 public void MoveFileDown(int index)
 {
     if (index != Playlist.Length - 1)
     {
         WACAudioFile temp = Playlist[index + 1];
         Playlist[index + 1] = Playlist[index];
         Playlist[index]     = temp;
     }
 }
예제 #4
0
 public void MoveFileUp(int index)
 {
     if (index != 0)
     {
         WACAudioFile temp = Playlist[index - 1];
         Playlist[index - 1] = Playlist[index];
         Playlist[index]     = temp;
     }
 }
예제 #5
0
 public void MoveFileToEnd(int index)
 {
     if (index != 0)
     {
         WACAudioFile temp = Playlist[Playlist.Length - 1];
         Playlist[Playlist.Length - 1] = Playlist[index];
         Playlist[index] = temp;
     }
 }
예제 #6
0
 public void MoveFileToFront(int index)
 {
     if (index != 0)
     {
         WACAudioFile temp = Playlist[0];
         Playlist[0]     = Playlist[index];
         Playlist[index] = temp;
     }
 }
예제 #7
0
        public void AddFile(string displayName, string filePath, string iconPath = "")
        {
            WACAudioFile[] tempSongArray = new WACAudioFile[Playlist.Length + 1];

            Playlist.CopyTo(tempSongArray, 0);

            tempSongArray[Playlist.Length] = new WACAudioFile(filePath, displayName, iconPath);

            Playlist = tempSongArray;
        }
        private string PlayAudio(string playlistName, string songName)
        {
            currentSong = MainForm.currentPreference.AudioPlaylists.First(x => x.PlaylistName == playlistName).Playlist.First(y => y.DisplayName == songName);

            string filePath = currentSong.FilePath;

            audioPlaylist = playlistName;

            if (File.Exists(filePath))
            {
                audioFileReader = new AudioFileReader(filePath);

                nextOutputMode = OutputMode.audio;

                FadeOutSound();

                return("Playing");
            }

            return("Could not find");
        }
예제 #9
0
 public WACPlaylist()
 {
     Playlist = new WACAudioFile[0];
 }
        private void PlayNextSong()
        {
            if (nextOutputMode != OutputMode.audio)
            {
                return;
            }

            var currentPlaylist  = MainForm.currentPreference.AudioPlaylists.First(x => x.PlaylistName == audioPlaylist).Playlist;
            var currentSongIndex = Array.FindIndex(currentPlaylist, x => x == currentSong);

            // todo: remove this hack once the app is set up!
            audioPlayMode = AudioPlayMode.random;

            if (audioPlayMode == AudioPlayMode.repeat)
            {
                if (File.Exists(currentSong.FilePath))
                {
                    audioFileReader = new AudioFileReader(currentSong.FilePath);

                    nextOutputMode = OutputMode.audio;

                    FadeOutSound();

                    return;
                }
            }

            if (audioPlayMode == AudioPlayMode.random)
            {
                if (!string.IsNullOrEmpty(currentSong.FilePath) && MainForm.currentPreference.AudioPlaylists.First(x => x.PlaylistName == audioPlaylist).Playlist.Length > 1)
                {
                    Random rand = new Random();

                    var songIndex = rand.Next(0, currentPlaylist.Length - 1);

                    if (currentSongIndex == songIndex)
                    {
                        songIndex = rand.Next(0, currentPlaylist.Length - 1);
                    }

                    var song = currentPlaylist[songIndex];

                    if (File.Exists(song.FilePath))
                    {
                        currentSong = song;

                        audioFileReader = new AudioFileReader(song.FilePath);

                        nextOutputMode = OutputMode.audio;

                        FadeOutSound();
                    }
                }
            }

            if (!string.IsNullOrEmpty(currentSong.FilePath) && currentPlaylist.Length > 1)
            {
                var songIndex = Array.FindIndex(currentPlaylist, x => x == currentSong);

                songIndex++;

                if (songIndex >= currentPlaylist.Length)
                {
                    songIndex = 0;
                }

                var song = currentPlaylist[songIndex];

                if (File.Exists(song.FilePath))
                {
                    currentSong = song;

                    audioFileReader = new AudioFileReader(song.FilePath);

                    nextOutputMode = OutputMode.audio;

                    FadeOutSound();
                }
            }
        }