예제 #1
0
 public async void Send(byte[] midiData, int start, int length, long timestamp)
 {
     if (await MidiManager.EnsureOutputReady(MidiOutput.Details.Name))
     {
         MidiOutput.Send(midiData, start, length, timestamp);
     }
 }
예제 #2
0
        public static async Task <bool> Forward(string inputDeviceName, string outputDeviceName)
        {
            if (!await MidiManager.EnsureInputReady(inputDeviceName))
            {
                return(false);
            }
            if (!await MidiManager.EnsureOutputReady(outputDeviceName))
            {
                return(false);
            }

            // Forward all messages received to the output device
            MidiManager.ActiveInputDevices[inputDeviceName].MessageReceived += (MidiReceivedEventArgs e) =>
                                                                               MidiManager.ActiveOutputDevices[outputDeviceName].Send(e.Data, e.Start, e.Length, e.Timestamp);

            Logger.WriteLine("Successfully attached {0} to {1} for message forwarding.", inputDeviceName, outputDeviceName);

            return(true);
        }