Exemplo n.º 1
0
        private void playFile(string fileName)
        {
            string ext = Path.GetExtension(fileName);

            try
            {
                switch (ext.ToUpper())
                {
                case ".VGM":
                case ".VGZ":
                    currentSong = new VGMSong(fileName);
                    break;

                case ".XGM":
                    currentSong = new XGMSong(fileName);
                    break;

                case ".KSS":
                case ".MGS":
                    currentSong = new MGSSong(fileName, checkBoxLoop.Checked ? (int)numericUpDown1.Value : 0);
                    break;
                }
                currentSong.Looped               = checkBoxLoop.Checked;
                currentSong.LoopCount            = (int)numericUpDown1.Value;
                currentSong.ProcessLoadOccurred += CurrentSong_ProcessLoadOccurred;
                currentSong.PlayStatusChanged   += CurrentSong_PlayStatusChanged;
                currentSong.SpeedChanged        += CurrentSong_SpeedChanged;
                currentSong.Finished            += CurrentSong_Finished;
                labelSpeed.Text   = currentSong.PlaybackSpeed.ToString("0.00");
                textBoxTitle.Text = currentSong.FileName;
                currentSong.Play();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 2
0
 private void buttonPlay_Click(object sender, EventArgs e)
 {
     if (currentSong == null ||
         listViewList.SelectedItems.Count != 0 &&
         listViewList.SelectedItems[0] != currentSongItem)
     {
         playSelectedItem();
     }
     else
     {
         if (currentSong?.State == SoundState.Paused)
         {
             currentSong?.Resume();
         }
         else if (currentSong?.State == SoundState.Playing)
         {
             currentSong?.Pause();
         }
         else
         {
             currentSong?.Play();
         }
     }
 }