예제 #1
0
        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Properties.Settings.Default.midi_path;
            openFileDialog.Multiselect      = false;
            openFileDialog.Filter           = "Midi Files (*.mid;*.midi)|*.mid;*.midi";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                Stop();
                sthread.UnloadSong();
                plist.clearSongs();
                pctrl.updateButtons(SynthWaveProvider.PlayerState.Stopped);

                if (!sthread.SongLoaded() && !sthread.SequencerStarted())
                {
                    plist.addSongs(openFileDialog.FileNames, 0);
                    sthread.LoadSong(openFileDialog.FileNames[0]);

                    lasermuzak.LoadMidi(openFileDialog.FileNames[0]);

                    updatetoolstripdisplay();
                }
                else
                {
                    plist.addSongs(openFileDialog.FileNames);
                }
            }
            try
            {
                if (Directory.Exists(openFileDialog.FileName))
                {
                    Properties.Settings.Default.midi_path = openFileDialog.FileName;
                }
                else if (Directory.Exists(Path.GetDirectoryName(openFileDialog.FileName)))
                {
                    Properties.Settings.Default.midi_path = Path.GetDirectoryName(openFileDialog.FileName);
                }
            }
            catch (ArgumentException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
예제 #2
0
 private void unloadCurrentMidiToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!sthread.SequencerStarted())
     {
         sthread.UnloadSong();
         updatetoolstripdisplay();
     }
     else
     {
         MessageBox.Show("Sequencer must be stopped first!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }