protected override async Task ProcessRecordAsync() { if (!string.IsNullOrWhiteSpace(Id)) { var port = await MidiOutPort.FromIdAsync(Id); if (port != null) { WriteDebug("Acquired output port: " + port.DeviceId); } else { throw new ArgumentException("No output port available with that Id. You can get the Id through the MidiDeviceInformation returned from Get-Midi[Input|Output]DeviceInformation.", "Id"); } // powershell has problems with some WinRT/UWP objects, so better to wrap it here var outputPort = new MidiOutputPort(port); WriteObject(outputPort); } else { throw new ArgumentException("Parameter required. You can get the Id through the MidiDeviceInformation returned from Get-Midi[Input|Output]DeviceInformation.", "Id"); } }
public static uint midiOutOpen(out IntPtr lphmo, int uDeviceID, MidiWinApi.MidiMessageCallback dwCallback, IntPtr dwInstance, uint dwFlags) { if (s_midiOutPort != null) { lphmo = new IntPtr(uDeviceID); return(MidiWinApi.MMSYSERR_NOERROR); } try { s_midiOutPort = MidiOutPort.FromIdAsync(GetDevices()[uDeviceID].Id).AsTask().Result; lphmo = new IntPtr(uDeviceID); if (s_midiOutPort == null) { return(MidiWinApi.MMSYSERR_ERROR); } } catch (Exception) { lphmo = new IntPtr(uDeviceID); return(MidiWinApi.MMSYSERR_ERROR); } return(MidiWinApi.MMSYSERR_NOERROR); }
private async void midiOutPortListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var deviceInformationCollection = outputDeviceWatcher.DeviceInformationCollection; if (deviceInformationCollection == null) { return; } DeviceInformation devInfo = deviceInformationCollection[midiOutPortListBox.SelectedIndex]; if (devInfo == null) { return; } midiOutPort = await MidiOutPort.FromIdAsync(devInfo.Id); if (midiOutPort == null) { System.Diagnostics.Debug.WriteLine("Unable to create MidiOutPort from output device"); return; } else { byte channel = 0; byte note = 60; byte velocity = 127; IMidiMessage midiMessageToSend = new MidiNoteOnMessage(channel, note, velocity); midiOutPort.SendMessage(midiMessageToSend); } }
public async Task InitOutput(String outputDeviceName) { DeviceInformationCollection midiOutputDevices = await DeviceInformation.FindAllAsync(MidiOutPort.GetDeviceSelector()); DeviceInformation midiOutDevInfo = null; foreach (DeviceInformation device in midiOutputDevices) { if (device.Name.Contains(outputDeviceName) && !device.Name.Contains("CTRL")) { midiOutDevInfo = device; break; } } if (midiOutDevInfo != null) { midiOutPort = await MidiOutPort.FromIdAsync(midiOutDevInfo.Id); } if (midiOutPort == null) { System.Diagnostics.Debug.WriteLine("Unable to create MidiOutPort from output device"); } }
private async void SelectMidiOutputDevices() { _midiClock.OutputPorts.Clear(); IMidiOutPort port = null; foreach (var descriptor in _midiWatcher.OutputPortDescriptors) { System.Diagnostics.Debug.WriteLine(descriptor.Name); if (descriptor.Name.Contains(_midiDeviceName)) { port = await MidiOutPort.FromIdAsync(descriptor.Id); System.Diagnostics.Debug.WriteLine("Found " + _midiDeviceName); break; } } if (port != null) { _midiClock.OutputPorts.Add(port); System.Diagnostics.Debug.WriteLine("Added " + _midiDeviceName); } else { System.Diagnostics.Debug.WriteLine("Cound not open " + _midiDeviceName); } }
// All output ports have been enumerated private async void _watcher_OutputPortsEnumerated(MidiDeviceWatcher sender) { foreach (DeviceInformation info in sender.OutputPortDescriptors) { // This diagnostic info is how you can see the IDs of all the ports. System.Diagnostics.Debug.WriteLine("- Output -----"); System.Diagnostics.Debug.WriteLine(info.Name); System.Diagnostics.Debug.WriteLine(info.Id); System.Diagnostics.Debug.WriteLine("--------------"); var port = (MidiOutPort)await MidiOutPort.FromIdAsync(info.Id); // If you don't want the clock on all ports, here's where you'd change the code if (port != null) { _clock.OutputPorts.Add(port); } else { System.Diagnostics.Debug.WriteLine("Failed to create port with id " + info.Id); } } if (_clock.OutputPorts.Count > 0) { System.Diagnostics.Debug.WriteLine("About to create clock."); _clock.SendMidiStartMessage = true; _clock.SendMidiStopMessage = true; } else { System.Diagnostics.Debug.WriteLine("No output ports to wire up."); } }
// Handler for SelectionChanged on MIDI Output ComboBox private async void MidiOutPortComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var deviceInformationCollection = outputDeviceWatcher.DeviceInformationCollection; if (deviceInformationCollection == null) { return; } DeviceInformation devInfo; if (midiOutPortComboBox.SelectedIndex < 0) { devInfo = null; } else { devInfo = deviceInformationCollection[midiOutPortComboBox.SelectedIndex]; } if (devInfo == null) { return; } midiOutPort = await MidiOutPort.FromIdAsync(devInfo.Id); if (midiOutPort == null) { System.Diagnostics.Debug.WriteLine("Unable to create MidiOutPort from output device"); return; } }
public async void OutputDeviceChanged(Picker DeviceSelector) { try { if (!String.IsNullOrEmpty((String)DeviceSelector.SelectedItem)) { var midiOutDeviceInformationCollection = midiOutputDeviceWatcher.DeviceInformationCollection; if (midiOutDeviceInformationCollection == null) { return; } DeviceInformation midiOutDevInfo = midiOutDeviceInformationCollection[DeviceSelector.SelectedIndex]; if (midiOutDevInfo == null) { return; } midiOutPort = (MidiOutPort)await MidiOutPort.FromIdAsync(midiOutDevInfo.Id); if (midiOutPort == null) { System.Diagnostics.Debug.WriteLine("Unable to create MidiOutPort from output device"); return; } } } catch { } }
public async Task <IMidiOutputPort> OpenOutput(int portNumber) { var port = OutputPortInfos.First(p => p.PortNumber == portNumber); var result = MidiOutPort.FromIdAsync(port.Id); await result; return(new WindowsMidiOutputPort(result.GetResults())); }
/// <summary> /// Method to enumrate all MIDI output devices connected and to setup the the first MIDI output device found. /// </summary> /// <returns></returns> private async Task EnumerateMidiOutputDevices() { // Create the query string for finding all MIDI output devices using MidiOutPort.GetDeviceSelector() string midiOutportQueryString = MidiOutPort.GetDeviceSelector(); // Find all MIDI output devices and collect it in a DeviceInformationCollection using FindAllAsync DeviceInformationCollection midiOutputDevices = await DeviceInformation.FindAllAsync(midiOutportQueryString); // If the size of the midiOutputDevice colloction is xero, // set the StatusTextBlock foreground color to red and the text property to "No MIDI output devices found" // and return. // Else set the StatusTextBlock foreground color to green and the text property to midiOutputdevices[0].Name if (midiOutputDevices.Count == 0) { // Set the StatusTextBlock foreground color to red StatusTextBlock.Foreground = new SolidColorBrush(Colors.Red); // Set the StatusTextBlock text to "No MIDI output devices found" StatusTextBlock.Text = "No MIDI output devices found"; return; } else { // Set the StatusTextBlock foreground color to green StatusTextBlock.Foreground = new SolidColorBrush(Colors.Green); // Set the StatusTextBlock text to the name of the first item in midiOutputDevices collection //StatusTextBlock.Text = midiOutputDevices[0].Name; } // Create an instance of DeviceInformation and set it to the first midi device in DeviceInformationCollection, midiOutputDevices DeviceInformation devInfo = midiOutputDevices[0]; // Return if DeviceInformation, devInfo, is null if (devInfo == null) { // Set the midi status TextBlock StatusTextBlock.Foreground = new SolidColorBrush(Colors.Red); StatusTextBlock.Text = "No device information of MIDI output"; return; } // Set the IMidiOutPort for the output midi device by calling MidiOutPort.FromIdAsync passing the Id property of the DevicInformation midiOutPort = await MidiOutPort.FromIdAsync(devInfo.Id); // Return if midiOutPort is null if (midiOutPort == null) { // Set the midi status TextBlock StatusTextBlock.Foreground = new SolidColorBrush(Colors.Red); StatusTextBlock.Text = "Unable to create MidiOutPort from output device"; return; } // Send the Program Change midi message to port of the output midi device // to set the initial instrument to Acoustic Grand Piano. midiOutPort.SendMessage(instrumentChange); }
public async Task <IMidiOutput> OpenOutputAsync(string portId) { var outputs = await GetOutputsAsync(); var details = outputs.Cast <UwpMidiPortDetails> ().FirstOrDefault(d => d.Id == portId); var output = MidiOutPort.FromIdAsync(portId).GetResults(); return(new UwpMidiOutput(output, details)); }
/// <summary> /// Create a new MidiOutPort for the selected device /// </summary> /// <param name="sender">Element that fired the event</param> /// <param name="e">Event arguments</param> private async void outputDevices_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Get the selected output MIDI device int selectedOutputDeviceIndex = outputDevices.SelectedIndex; messageType.IsEnabled = false; JingleBells.IsEnabled = false; HappyBirthday.IsEnabled = false; resetButton.IsEnabled = false; // Try to create a MidiOutPort if (selectedOutputDeviceIndex < 0) { NotifyUser("Select a MIDI output device to be able to send messages to it"); return; } DeviceInformationCollection devInfoCollection = _midiOutDeviceWatcher.GetDeviceInformationCollection(); if (devInfoCollection == null) { NotifyUser("Device not found!"); return; } DeviceInformation devInfo = devInfoCollection[selectedOutputDeviceIndex]; if (devInfo == null) { NotifyUser("Device not found!"); return; } _currentMidiOutputDevice = await MidiOutPort.FromIdAsync(devInfo.Id); if (_currentMidiOutputDevice == null) { NotifyUser("Unable to create MidiOutPort from output device"); return; } // We have successfully created a MidiOutPort; add the device to the list of active devices if (!_midiOutPorts.Contains(_currentMidiOutputDevice)) { _midiOutPorts.Add(_currentMidiOutputDevice); } // Enable message type list & reset button messageType.IsEnabled = true; JingleBells.IsEnabled = true; HappyBirthday.IsEnabled = true; resetButton.IsEnabled = true; NotifyUser("Output Device selected successfully! Waiting for message type selection..."); }
private async void MidiOutputList_SelectionChanged(object sender, SelectionChangedEventArgs e) { var info = MidiOutputList.SelectedItem as DeviceInformation; if (info != null) { _port = await MidiOutPort.FromIdAsync(info.Id); System.Diagnostics.Debug.WriteLine("MIDI Port Selected: " + info.Name); } }
/// <summary> /// Passes a MIDI output port to the MIDITransmitter /// </summary> /// <param name="portID">the port that is passed</param> /// <returns>task</returns> private async Task SetTransmitter(string portID) { IMidiOutPort transmitting = await MidiOutPort.FromIdAsync(portID); if (transmitting == null) { Debug.WriteLine("Unable to create MIDI-out port."); return; } transmitter = new MIDITransmitter(transmitting); }
private async void MidiDeviceSelected(object sender, SelectionChangedEventArgs e) { var selectedDevice = (MidiDeviceInfo)OutputDevicesList.SelectedItem; if (selectedDevice != null) { _currentDevice?.Dispose(); _currentDevice = await MidiOutPort.FromIdAsync(selectedDevice.Id); KeyboardKeys.IsEnabled = true; } }
public async Task <IMidiOutput> OpenOutputAsync(string portId) { var outputs = Outputs; var details = outputs.Cast <UwpMidiPortDetails>().FirstOrDefault(d => d.Id.Equals(portId)); var output = await MidiOutPort.FromIdAsync(details.Id); if (output != null) { return((IMidiOutput) new UwpMidiOutput(output, details)); } return(null); }
/// <summary> /// Sends the patch change currently being composed. A patch number must be set /// before the sending the event. /// </summary> /// <returns>The currently selected <see cref="IMidiOutputDevice"/>.</returns> /// <exception cref="System.InvalidOperationException">Thrown if the control /// number or value have not been set yet.</exception> public async Task <IMidiOutputDevice> SendAsync() { if (this._patchNumber == null) { throw new InvalidOperationException("A patch number is required"); } IMidiOutPort port = await MidiOutPort.FromIdAsync(this._device.DeviceId); port.SendMessage(new MidiProgramChangeMessage(this._channel, this._patchNumber.Value)); return(this._device); }
/// <summary> /// Sends the control change currently being composed. A control number /// and value must be set before sending the event. /// </summary> /// <returns>The currently selected <see cref="IMidiOutputDevice"/>.</returns> /// <exception cref="System.InvalidOperationException">Thrown if the control /// number or value have not been set yet.</exception> public async Task <IMidiOutputDevice> SendAsync() { if (this._controlNumber == null || this._value == null) { throw new InvalidOperationException("Both a control number and a value are required."); } IMidiOutPort port = await MidiOutPort.FromIdAsync(this._device.DeviceId); port.SendMessage(new MidiControlChangeMessage(this._channel, this._controlNumber.Value, this._value.Value)); return(this._device); }
public async void Init(String deviceName) { DeviceInformationCollection midiOutputDevices = await DeviceInformation.FindAllAsync(MidiOutPort.GetDeviceSelector()); DeviceInformationCollection midiInputDevices = await DeviceInformation.FindAllAsync(MidiInPort.GetDeviceSelector()); DeviceInformation midiOutDevInfo = null; DeviceInformation midiInDevInfo = null; foreach (DeviceInformation device in midiOutputDevices) { if (device.Name.Contains(deviceName)) { midiOutDevInfo = device; break; } } if (midiOutDevInfo != null) { midiOutPort = (MidiOutPort)await MidiOutPort.FromIdAsync(midiOutDevInfo.Id); } foreach (DeviceInformation device in midiInputDevices) { if (device.Name.Contains(deviceName)) { midiInDevInfo = device; break; } } if (midiInDevInfo != null) { midiInPort = await MidiInPort.FromIdAsync(midiInDevInfo.Id); } if (midiOutPort == null) { System.Diagnostics.Debug.WriteLine("Unable to create MidiOutPort from output device"); } if (midiInPort == null) { System.Diagnostics.Debug.WriteLine("Unable to create MidiInPort from output device"); } else { midiInPort.MessageReceived += MidiInPort_MessageReceived; } }
public async void InitializeMidi(string midiInToPCDeviceId, string midiOutToLaunchpadDeviceId) { // acquire the MIDI ports // TODO: Exception handling _midiIn = await MidiInPort.FromIdAsync(midiInToPCDeviceId); _midiIn.MessageReceived += OnMidiInMessageReceived; _midiOut = (MidiOutPort)await MidiOutPort.FromIdAsync(midiOutToLaunchpadDeviceId); SetPadMappingMode(PadMappingMode.XY); }
/// <summary> /// Create a new MidiOutPort for the selected device /// </summary> /// <param name="sender">Element that fired the event</param> /// <param name="e">Event arguments</param> private async void outputDevices_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Get the selected output MIDI device int selectedOutputDeviceIndex = this.outputDevices.SelectedIndex; // Try to create a MidiOutPort if (selectedOutputDeviceIndex < 0) { this.rootPage.NotifyUser("Select a MIDI output device to be able to send messages to it", NotifyType.StatusMessage); return; } DeviceInformationCollection devInfoCollection = this.midiOutDeviceWatcher.GetDeviceInformationCollection(); if (devInfoCollection == null) { this.rootPage.NotifyUser("Device not found!", NotifyType.ErrorMessage); return; } DeviceInformation devInfo = devInfoCollection[selectedOutputDeviceIndex]; if (devInfo == null) { this.rootPage.NotifyUser("Device not found!", NotifyType.ErrorMessage); return; } this.currentMidiOutputDevice = await MidiOutPort.FromIdAsync(devInfo.Id); if (this.currentMidiOutputDevice == null) { this.rootPage.NotifyUser("Unable to create MidiOutPort from output device", NotifyType.ErrorMessage); return; } // We have successfully created a MidiOutPort; add the device to the list of active devices if (!this.midiOutPorts.Contains(this.currentMidiOutputDevice)) { this.midiOutPorts.Add(this.currentMidiOutputDevice); } // Enable message type list & reset button this.messageType.IsEnabled = true; this.resetButton.IsEnabled = true; this.rootPage.NotifyUser("Output Device selected successfully! Waiting for message type selection...", NotifyType.StatusMessage); }
/// <summary> /// Gets a launchpad object for a connected device /// </summary> /// <param name="id">The id of the launchpad</param> /// <returns></returns> public static async Task <Launchpad> Launchpad(string id) { List <DeviceInformation> inputs = (await DeviceInformation.FindAllAsync(MidiInPort.GetDeviceSelector())).ToList(); List <DeviceInformation> outputs = (await DeviceInformation.FindAllAsync(MidiOutPort.GetDeviceSelector())).ToList(); // Find the launchpad input foreach (var inputDeviceInfo in inputs) { try { if (inputDeviceInfo.Id.Contains(id)) { // Find the launchpad output foreach (var outputDeviceInfo in outputs) { // If not a match continue if (!outputDeviceInfo.Id.Contains(id)) { continue; } var inPort = await MidiInPort.FromIdAsync(inputDeviceInfo.Id); var outPort = await MidiOutPort.FromIdAsync(outputDeviceInfo.Id); // Return an MK2 if detected if (outputDeviceInfo.Name.ToLower().Contains("mk2")) { return(new LaunchpadMk2(outputDeviceInfo.Name, inPort, outPort)); } return(null); // Otherwise return Standard //return new LaunchpadS(outputDeviceInfo.Name, inPort, outPort); } } } catch (Exception ex) { Debug.WriteLine(ex); } } // Return null if no devices matched the device name provided return(null); }
private async void midiOutPortListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var deviceInformationCollection = m.outputDeviceWatcher.DeviceInformationCollection; if (deviceInformationCollection == null) { return; } DeviceInformation devInfo = deviceInformationCollection[midiOutPortListBox.SelectedIndex]; if (devInfo == null) { return; } m.midiOutPort = await MidiOutPort.FromIdAsync(devInfo.Id); if (m.midiOutPort == null) { Debug.WriteLine("Unable to create MidiOutPort from output device"); return; } if (midiOutPortListBox.SelectedValue.ToString().Contains("DDJ-XP1")) { m.midiOutPort.SendMessage(new MidiNoteOnMessage(0, 0x1e, 33)); m.midiOutPort.SendMessage(new MidiNoteOnMessage(0, 0x20, 33)); m.midiOutPort.SendMessage(new MidiNoteOnMessage(0, 0x22, 33)); m.midiOutPort.SendMessage(new MidiNoteOnMessage(0, 0x1b, 64)); m.midiOutPort.SendMessage(new MidiNoteOnMessage(1, 0x1e, 33)); m.midiOutPort.SendMessage(new MidiNoteOnMessage(1, 0x20, 33)); m.midiOutPort.SendMessage(new MidiNoteOnMessage(1, 0x22, 33)); m.midiOutPort.SendMessage(new MidiNoteOnMessage(1, 0x1b, 64)); i = 16; v = 33; } else if (midiOutPortListBox.SelectedValue.ToString().Contains("APC MINI")) { i = 0; v = 5; } animation.Start(); }
public async Task InitializeAsync(string deviceName) { var devices = await DeviceInformation.FindAllAsync(MidiOutPort.GetDeviceSelector()).AsTask(); var devInfo = devices?.FirstOrDefault(d => d.Name == deviceName); if (devInfo == null) { throw new Exception($"Device {deviceName} not found."); } currentMidiOutputDevice = await MidiOutPort.FromIdAsync(devInfo.Id).AsTask(); if (currentMidiOutputDevice == null) { throw new Exception($"Midi output port could not be found for device {deviceName}."); } }
private async void DefaultMidiDevices() { string midiOutputQueryString = MidiOutPort.GetDeviceSelector(); string midiInputQueryString = MidiInPort.GetDeviceSelector(); // Find all MIDI output and input devices and collect it DeviceInformationCollection midiOutDevices = await DeviceInformation.FindAllAsync(midiOutputQueryString); DeviceInformationCollection midiInDevices = await DeviceInformation.FindAllAsync(midiInputQueryString); // Set the MIDI device from the found MIDI devices if (midiInDevices.Count > 0) { Settings.midiInPort = await MidiInPort.FromIdAsync(midiInDevices[0].Id); } if (midiOutDevices.Count > 0) { Settings.midiOutPort = await MidiOutPort.FromIdAsync(midiOutDevices[0].Id); } }
public MainPage() { this.InitializeComponent(); App.Current.Suspending += Current_Suspending; mArduino = new ArduinoManager(); mGPIO = new GPIOManager(); mGameNoteIndexs = new int[5] { 0, 0, 0, 0, 0 }; mCurrentGameNote = new MidiGameNote[5]; mIsInited = false; mIsPlaying = false; Task.Run(async() => { SMFReader r = new SMFReader(); mSMF = await r.Read(@"Assets\out.mid"); var w = new MidiDeviceWatcher(MidiOutPort.GetDeviceSelector(), Dispatcher); w.Start(); var col = w.GetDeviceInformationCollection(); var l = await DeviceInformation.FindAllAsync(MidiOutPort.GetDeviceSelector()); MIDIPort = await MidiOutPort.FromIdAsync(l[0].Id); await mArduino.Init(); await mGPIO.Init(GpioController.GetDefault()); mGPIO.MidiButtonChanged += MGPIO_MidiButtonChanged; mGPIO.JoyButtonChanged += MGPIO_JoyButtonChanged; mPlayer = new SMFPlayer(mSMF, MIDIPort); mPlayer.OnLED += Player_OnLED; mPlayer.OnBarBeatChanged += Player_BarBeatChanged; mPlayer.OnTempoChanged += Player_OnTempoChanged; mGPIO.Ack(); mIsInited = true; }); mVolTimer = new DispatcherTimer(); mVolTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); mVolTimer.Tick += MVolTimer_Tick; mVolTimer.Start(); }
/// <summary> /// Handles midi creation on navigated to /// </summary> /// <param name="e"></param> protected override async void OnNavigatedTo(NavigationEventArgs e) { LoadPreset(0); if (e.Parameter is int) { LoadPreset((int)e.Parameter); } // Find Microsoft synth and instantiate midi DeviceInformationCollection deviceInformationCollection = await DeviceInformation.FindAllAsync(MidiOutPort.GetDeviceSelector()); DeviceInformation synthObject = deviceInformationCollection.FirstOrDefault(x => x.Name == "Microsoft GS Wavetable Synth"); this.synth = await MidiOutPort.FromIdAsync(synthObject.Id); if (this.synth == null) { _ = await new MessageDialog("Could not find Microsoft GS Wavetable Synth. Failed to open MIDI port.", "Error Starting App").ShowAsync(); } base.OnNavigatedTo(e); }
public async void SetupMidiPorts() { var inDeviceInformationCollection = inputDeviceWatcher.DeviceInformationCollection; var outDeviceInformationCollection = outputDeviceWatcher.DeviceInformationCollection; if (inDeviceInformationCollection == null || outDeviceInformationCollection == null) { Console.WriteLine("Could not find any MIDI devices."); SetupComplete = true; return; } DeviceInformation inDevInfo = null; string midiControllerName = "X-TOUCH MINI"; foreach (var info in inDeviceInformationCollection) { if (info.Name.Contains(midiControllerName)) { inDevInfo = info; } } DeviceInformation outDevInfo = null; foreach (var info in outDeviceInformationCollection) { if (info.Name.Contains(midiControllerName)) { outDevInfo = info; } } if (inDevInfo == null || outDevInfo == null) { Console.WriteLine("Could not find a MIDI device with name: " + midiControllerName); SetupComplete = true; return; } midiInPort = await MidiInPort.FromIdAsync(inDevInfo.Id); if (midiInPort == null) { Console.WriteLine("Unable to create MidiInPort from input device " + inDevInfo.Name); SetupComplete = true; return; } midiInPort.MessageReceived += MidiInPort_MessageReceived; midiOutPort = await MidiOutPort.FromIdAsync(outDevInfo.Id); if (midiOutPort == null) { Console.WriteLine("Unable to create MidiOutPort from output device " + outDevInfo.Name); SetupComplete = true; return; } Console.WriteLine("Sucessfully found MIDI device with name: " + inDevInfo.Name); // Sending these MIDI messages to reset the knobs on this thread sometimes causes // a cyclic redundacny check error. Solution might be to simply call this reset sometime later... // Maybe from the main thread after setup is complete? // Or maybe this only happens the first time after resuming from sleep? Maybe because I'm not // cleaning up resources properly? for (byte controller = 0; controller < 18; controller++) { ResetKnob(controller); } SetupComplete = true; }
private async void OnMidiDevicesEnumerated(MidiDeviceWatcher sender) { var id = _watcher.OutputPortDescriptors.GetAt(0).Id; _activeOutPort = await MidiOutPort.FromIdAsync(id); }
private async void midiOutPortListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) => m.midiOutPort = await MidiOutPort.FromIdAsync(m.outputDeviceWatcher.DeviceInformationCollection[midiOutPortListBox.SelectedIndex].Id);