private static async Task <MidiInPort> FromIdInternalAsync(DeviceIdentifier identifier) { var provider = new MidiInDeviceClassProvider(); var nativeDeviceInfo = provider.GetNativeEndpoint(identifier.Id); if (nativeDeviceInfo == null) { throw new InvalidOperationException( "Given MIDI out device does not exist or is no longer connected"); } return(new MidiInPort(identifier.ToString(), nativeDeviceInfo)); }
private static async Task <MidiInPort> FromIdInternalAsync(DeviceIdentifier identifier) { var provider = new MidiInDeviceClassProvider(); var nativeDeviceInfo = provider.GetNativeDeviceInfo(identifier.Id); if (nativeDeviceInfo == (null, null)) { throw new InvalidOperationException("Given MIDI out device does not exist"); } var port = new MidiInPort(identifier.ToString(), nativeDeviceInfo.device, nativeDeviceInfo.port); await port.InitializeAsync(); return(port); }