void Start() { // Setup dropdown menu options and change handler dropdown = GetComponent <Dropdown>(); dropdown.AddOptions(MidiInputCtrl.AvailableMidiDevices()); dropdown.onValueChanged.AddListener(delegate { OnValueChangedHandler(dropdown); }); }
public void ListMidiDevices() { UnityEngine.Debug.unityLogger.logEnabled = true; var devices = MidiInputCtrl.AvailableMidiDevices(); foreach (var d in devices) { UnityEngine.Debug.Log(string.Format("Midi Input Device: {0}", d)); } }
public void Connect(string deviceName) { int midiIndex = MidiInputCtrl.AvailableMidiDevices().IndexOf(deviceName); UnityEngine.Debug.Log("Connecting to " + deviceName); if (midiIndex == -1) { throw new System.ArgumentException("Invalid Midi Input Device Name"); } midiInput = new InputDevice(midiIndex); midiInput.ChannelMessageReceived += HandleChannelMessageReceived; }