コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                inputDevice = Midi.InputDevice.InstalledDevices[comboBox1.SelectedIndex];
            }
            catch
            {
                MessageBox.Show("Please select a Input Device", "TypeMidi by Azor");
                return;
            }

            if (radioButton1.Checked) // Logitech SDK
            {
                Gmidi.Init();
            }
            else if (radioButton2.Checked)  // Razer SDK
            {
                Rmidi.Init();
            }
            else
            {
                MessageBox.Show("Please select your Keyboard Type", "TypeMidi by Azor");
            }

            if (!inputDevice.IsOpen)
            {
                inputDevice.Open();
                inputDevice.NoteOn  += NoteOn;
                inputDevice.NoteOff += NoteOff;
                inputDevice.StartReceiving(null);
            }
        }
コード例 #2
0
 private void NoteOff(NoteOffMessage msg)
 {
     if (radioButton1.Checked) // Logitech SDK
     {
         Gmidi.palette_led((int)msg.Pitch, 0);
     }
     else if (radioButton2.Checked)  // Razer SDK
     {
         Rmidi.palette_led((int)msg.Pitch, 0);
     }
 }