public PortEnvoi(MidiManager m, MainActivity act) { manager = m; activity = act; texte = (TextView)activity.FindViewById <TextView>(Resource.Id.textViewDevice); manager.RegisterDeviceCallback(this, new Android.OS.Handler()); MidiDeviceInfo[] infos = manager.GetDevices(); foreach (MidiDeviceInfo info in infos) { onDeviceAdded(info); } manager.OpenDevice(portInfo, this, null); }
internal async Task OpenAsync() { if (this.Log().IsEnabled(LogLevel.Debug)) { this.Log().LogDebug($"Opening the MIDI out port, port number {_portInfo.PortNumber}"); } var completionSource = new TaskCompletionSource <MidiDevice>(); using (var deviceOpenListener = new MidiDeviceOpenedListener(completionSource)) { _midiManager.OpenDevice(_deviceInfo, deviceOpenListener, null); _midiDevice = await completionSource.Task; // This is not a bug, Android uses "input" for output. _midiPort = _midiDevice.OpenInputPort(_portInfo.PortNumber); } }