internal static async Task <RolandMidiClient> CreateAsync(MidiInputDevice inputDevice, MidiOutputDevice outputDevice, byte rawDeviceId, ModuleIdentifier identifier)
        {
            // This is all a bit nasty... we can't create a RolandMidiClient instance until we have the raw client, and we can't
            // create the raw client until we've got a method to call. LocalHandleMessage acts as a sort of trampoline.
            // If we could make the constructor asynchronous, it wouldn't be a problem.
            RolandMidiClient?ret = null;
            var rawClient        = await RawMidiClient.CreateAsync(inputDevice, outputDevice, LocalHandleMessage);

            ret = new RolandMidiClient(rawClient, rawDeviceId, identifier);
            return(ret);

            void LocalHandleMessage(RawMidiMessage message) => ret?.HandleMessage(message);
        }
Beispiel #2
0
 public static Task <RolandMidiClient> CreateRolandMidiClientAsync(MidiInputDevice input, MidiOutputDevice output, DeviceIdentity deviceIdentity, ModuleIdentifier identifier) =>
 RolandMidiClient.CreateAsync(input, output, deviceIdentity.RawDeviceId, identifier);
 private RolandMidiClient(RawMidiClient rawClient, byte rawDeviceId, ModuleIdentifier identifier)
 {
     this.rawClient   = rawClient;
     this.rawDeviceId = rawDeviceId;
     this.Identifier  = identifier;
 }