Ejemplo n.º 1
0
 private void SaveAsButton_Click(object sender, EventArgs e)
 {
     if (DialogResult.OK == SaveMidiFile.ShowDialog())
     {
         var file = _CreateMidiFile();
         file.WriteTo(SaveMidiFile.FileName);
     }
 }
Ejemplo n.º 2
0
        private void SaveAsButton_Click(object sender, EventArgs e)
        {
            var res = SaveMidiFile.ShowDialog(this);

            if (DialogResult.OK == res)
            {
                var mf = _ProcessFile();
                using (var stm = File.OpenWrite(SaveMidiFile.FileName))
                {
                    stm.SetLength(0);
                    mf.WriteTo(stm);
                }
            }
        }
Ejemplo n.º 3
0
        private void SaveAsButton_Click(object sender, EventArgs e)
        {
            var res = SaveMidiFile.ShowDialog(this);

            if (DialogResult.OK == res)
            {
                var f = _file;
                if (ResampleUpDown.Value != _file.TimeBase)
                {
                    f = f.Resample(unchecked ((short)ResampleUpDown.Value));
                }
                var trks = new List <MidiSequence>(f.Tracks.Count);
                for (int ic = TrackList.Items.Count, i = 0; i < ic; ++i)
                {
                    if (TrackList.CheckedItems.Contains(TrackList.Items[i]))
                    {
                        trks.Add(f.Tracks[i]);
                    }
                }

                var mf = new MidiFile(1, f.TimeBase);
                if (!MergeTracksCheckBox.Checked)
                {
                    foreach (var tr in trks)
                    {
                        mf.Tracks.Add(_ProcessTrack(tr));
                    }
                }
                else
                {
                    mf.Tracks.Add(_ProcessTrack(MidiSequence.Merge(trks)));
                }
                using (var stm = File.OpenWrite(SaveMidiFile.FileName))
                {
                    mf.WriteTo(stm);
                }
            }
        }