using System; using System.Windows; using Commons.Music.Midi; namespace MidiTest { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { this.InitializeComponent(); this.DetectMidi(); } private void DetectMidi() { IMidiAccess access = MidiAccessManager.Default; foreach (IMidiPortDetails item in access.Outputs) { _ = this.MidiSelector.Items.Add(new Tuple(item.Manufacturer + " - " + item.Name, item.Id)); } } private void test(Object sender, System.Windows.Input.MouseButtonEventArgs e) { IMidiOutput outp = MidiAccessManager.Default.OpenOutputAsync(((Tuple)this.MidiSelector.SelectedItem).Item2).Result; outp.Send(new Byte[] { 144, 81, 45 }, 0, 3, 0); outp.Send(new Byte[] { 176, 106, 53 }, 0, 3, 0); outp.Send(new Byte[] { 145, 11, 5 }, 0, 3, 0); outp.Send(new Byte[] { 144, 12, 21 }, 0, 3, 0); outp.Send(new Byte[] { 145, 12, 5 }, 0, 3, 0); outp.Send(new Byte[] { 146, 88, 81 }, 0, 3, 0); } private void ShowPopup(Object sender, System.Windows.Input.MouseButtonEventArgs e) { } } }