Пример #1
0
 private void comboBoxMidiInSelect_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Device != null)
     {
         Trace.WriteLine("Opening MIDI-IN: " + comboBoxMidiInSelect.Items[comboBoxMidiInSelect.SelectedIndex]);
         Device.OpenIn(comboBoxMidiInSelect.SelectedIndex);
         try { Config.lastSelectedMidiIn = MidiIn.GetDeviceNames()[comboBoxMidiInSelect.SelectedIndex]; }
         catch { }
     }
 }
Пример #2
0
        public void SetDevice(XGMidiIODevice device)
        {
            Debug.Assert(this.Device == null);
            this.Device = device;

            comboBoxMidiInSelect.Items.AddRange(MidiIn.GetDeviceNames());
            comboBoxMidiOutSelect.Items.AddRange(MidiOut.GetDeviceNames());

            int inIndex = Array.IndexOf(MidiIn.GetDeviceNames(), Config.lastSelectedMidiIn);

            if (inIndex < 0)
            {
                inIndex = 0;
            }
            if (comboBoxMidiInSelect.Items.Count > 0)
            {
                comboBoxMidiInSelect.SelectedIndex = inIndex;
            }

            int outIndex = Array.IndexOf(MidiOut.GetDeviceNames(), Config.lastSelectedMidiOut);

            if (outIndex < 0)
            {
                outIndex = 0;
            }
            if (comboBoxMidiOutSelect.Items.Count > 0)
            {
                comboBoxMidiOutSelect.SelectedIndex = outIndex;
            }

            pictureBox1.Height = pictureBox1.Width;

            timer1.Interval = 10;
            timer1.Tick    += Timer1_Tick;
            timer1.Enabled  = true;

            CreateXGPControls();
        }