Ejemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     access        = MidiAccessManager.Default;
     output        = access.OpenOutputAsync(access.Outputs.Last().Id).Result;
     this.KeyDown += new KeyEventHandler(OnButtonKeyDown);
 }
Ejemplo n.º 2
0
 public IMidiOutput GetMidiOutput(Context context)
 {
     if (acc == null)
     {
         SetupMidiAccess(context);
         output = acc.OpenOutputAsync(acc.Outputs.First().Id).Result;
     }
     return(output);
 }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        void SwitchToDevice(string deviceId, bool withUI)
        {
            if (output != null)
            {
                output.Dispose();
                output = null;
            }
            output = access.OpenOutputAsync(deviceId).Result;

            if (withUI)
            {
                SetupBankSelector(deviceId);
            }
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
 public MidiPlayer(MidiMusic music, IMidiAccess access, IMidiPlayerTimeManager timeManager)
     : this(music, access.OpenOutputAsync(access.Outputs.First().Id).Result, timeManager)
 {
     should_dispose_output = true;
 }
Ejemplo n.º 10
0
 public RawMidiProcessor(IMidiAccess access)
     : this(access.OpenOutputAsync(access.Outputs.First().Id).Result)
 {
 }
Ejemplo n.º 11
0
 public MidiPlayer(SmfMusic music, IMidiAccess access, IMidiTimeManager timeManager)
     : this(music, access.OpenOutputAsync (access.Outputs.First ().Id).Result, timeManager)
 {
     should_dispose_output = true;
 }