private void stopCurrentSong() { if (currentSongItem != null) { currentSongItem.Selected = true; currentSongItem.EnsureVisible(); } if (currentSong != null) { currentSong.Stop(); currentSong.ProcessLoadOccurred -= CurrentSong_ProcessLoadOccurred; currentSong.PlayStatusChanged -= CurrentSong_PlayStatusChanged; currentSong.SpeedChanged -= CurrentSong_SpeedChanged; currentSong.Finished -= CurrentSong_Finished; currentSong.Dispose(); currentSong = null; textBoxTitle.Text = string.Empty; } }
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()); } }