private void Connect_Click(object sender, RoutedEventArgs e) { if (OutputDevices.SelectedItem != null && InputDevices.SelectedItem != null) { if (_launchpad != null) { _launchpad.Dispose(); _launchpad = null; } _launchpad = new LaunchpadInterface(); _launchpad.PadPressed += _launchpad_PadPressed; _launchpad.PadReleased += _launchpad_PadReleased; _launchpad.TextScrollingComplete += _launchpad_TextScrollingComplete; _launchpad.InitializeMidi( (MidiDeviceInformation)InputDevices.SelectedItem, (MidiDeviceInformation)OutputDevices.SelectedItem); } else { var msg = new MessageDialog("Please select the appropriate input and output MIDI interfaces."); msg.ShowAsync(); } }
private void _launchpad_TextScrollingComplete(object sender, EventArgs e) { for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { _launchpad.TurnOnPad((byte)(row * 16 + col), LaunchpadInterface.RedGreenToColorByte((byte)(row % 4), (byte)(col % 4))); } } }