public MainWindow() { InitializeComponent(); access = MidiAccessManager.Default; output = access.OpenOutputAsync(access.Outputs.Last().Id).Result; this.KeyDown += new KeyEventHandler(OnButtonKeyDown); }
public IMidiOutput GetMidiOutput(Context context) { if (acc == null) { SetupMidiAccess(context); output = acc.OpenOutputAsync(acc.Outputs.First().Id).Result; } return(output); }
private async void OnOutputItemSelected(object sender, SelectedItemChangedEventArgs e) { _device = e.SelectedItem as IMidiPortDetails; if (_device != null) { this.MessageType.IsEnabled = true; this.ResetButton.IsEnabled = true; _synthesizer = await _access.OpenOutputAsync(_device.Id); } }
void SwitchToDevice(string deviceId) { if (output != null) { output.Dispose(); output = null; } output = access.OpenOutputAsync(deviceId).Result; output.Send(new byte[] { (byte)(0xC0 + channel), 0, 0 }, 0, 0, 0); SetupBankSelector(deviceId); }
void SwitchToDevice(string deviceId, bool withUI) { if (output != null) { output.Dispose(); output = null; } output = access.OpenOutputAsync(deviceId).Result; if (withUI) { SetupBankSelector(deviceId); } }
void SwitchToDevice(string deviceId, bool withUI) { if (output != null) { output.Dispose(); output = null; } output = access.OpenOutputAsync(deviceId).Result; output.Send(new byte [] { (byte)(MidiEvent.Program + channel), GeneralMidi.Instruments.AcousticGrandPiano }, 0, 2, 0); if (withUI) { SetupBankSelector(deviceId); } }
private void ConfirmButtonPressed(object sender, RoutedEventArgs e) { input = access.OpenInputAsync(LaunchPadInputs.SelectedValue.ToString()).Result; output = access.OpenOutputAsync(LaunchPadOutputs.SelectedValue.ToString()).Result; try { lpmngr = new LaunchPadManager(access, input, output); InitMacroGrid(); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "LaunchPad Macros", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public static IMidiOutput MidiOutDevice(string name = null) { if (string.IsNullOrEmpty(name)) { name = Midi.MidiOutDeviceName; } try { if (!D_midiOut.ContainsKey(name)) { D_midiOut.TryAdd(name, access.OpenOutputAsync(access.Outputs.Where(x => x.Name == name).First().Id).Result); } return(D_midiOut[name]); } catch (Exception ex) { Debug.WriteLine(ex); ClearMidiDevices(); } return(null); }
public MidiPlayer(MidiMusic music, IMidiAccess access, IMidiPlayerTimeManager timeManager) : this(music, access.OpenOutputAsync(access.Outputs.First().Id).Result, timeManager) { should_dispose_output = true; }
public RawMidiProcessor(IMidiAccess access) : this(access.OpenOutputAsync(access.Outputs.First().Id).Result) { }
public MidiPlayer(SmfMusic music, IMidiAccess access, IMidiTimeManager timeManager) : this(music, access.OpenOutputAsync (access.Outputs.First ().Id).Result, timeManager) { should_dispose_output = true; }