Ejemplo n.º 1
0
 void Start()
 {
     // Setup dropdown menu options and change handler
     dropdown = GetComponent <Dropdown>();
     dropdown.AddOptions(MidiInputCtrl.AvailableMidiDevices());
     dropdown.onValueChanged.AddListener(delegate { OnValueChangedHandler(dropdown); });
 }
Ejemplo n.º 2
0
    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));
        }
    }
Ejemplo n.º 3
0
    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;
    }