private void bgWorker_Play_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = sender as BackgroundWorker; PlayOpts opts = (PlayOpts)e.Argument; MusicNoteLib.PlayMusicStringWithOptsCB(opts.strNotes, opts.nMidiOutPort, opts.nTimerRes, new MusicNoteLib.ParserTraceDelegate(OnParseTrace), new MusicNoteLib.ParserErrorDelegate(OnParseError), IntPtr.Zero); }
private void button_ToMIDI_Click(object sender, EventArgs e) { if (textBox_Notes.Text.Length != 0) { SaveFileDialog dlg = new SaveFileDialog(); dlg.DefaultExt = "mid"; dlg.FileName = "Output.mid"; if (dlg.ShowDialog() != DialogResult.OK) { return; } this.Cursor = Cursors.WaitCursor; MusicNoteLib.SaveAsMidiFile(textBox_Notes.Text, dlg.FileName); this.Cursor = Cursors.Default; } else { MessageBox.Show("Text box is empty !! Enter few notes and then use this option to save them to MIDI output file"); } }