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