static IEnumerator InitMidiIO() { if (!MidiINPlugin.initialized) { MidiINPlugin.Init(); } yield return(new WaitUntil(() => MidiINPlugin.Initialized() )); if (!MidiOUTPlugin.initialized) { MidiOUTPlugin.Init(); } yield return(new WaitUntil(() => MidiOUTPlugin.Initialized() )); forceDefaultMidiIn = settings.forceDefaultMidiIn; defaultMidiIn = settings.defaultMidiIn; forceDefaultMidiOut = settings.forceDefaultMidiOut; defaultMidiOut = settings.defaultMidiOut; if (forceDefaultMidiIn) { if (defaultMidiIn >= 0 && defaultMidiIn < MidiINPlugin.GetDeviceCount()) { MidiINPlugin.ConnectDevice(defaultMidiIn); } } else { MidiINPlugin.RestoreConnections(); if (MidiINPlugin.connectedDevices.Count == 0) { if (defaultMidiIn >= 0 && defaultMidiIn < MidiINPlugin.GetDeviceCount()) { MidiINPlugin.ConnectDevice(defaultMidiIn); } } } if (forceDefaultMidiOut) { if (defaultMidiOut >= 0 && defaultMidiOut < MidiOUTPlugin.GetDeviceCount()) { MidiOUTPlugin.ConnectDevice(defaultMidiOut); } } else { MidiOUTPlugin.RestoreConnections(); if (MidiOUTPlugin.connectedDevices.Count == 0) { if (defaultMidiOut >= 0 && defaultMidiOut < MidiOUTPlugin.GetDeviceCount()) { MidiOUTPlugin.ConnectDevice(defaultMidiOut); } } } }