コード例 #1
0
        partial void Execute_MidiOnCommand()
        {
            _MidiDevices.Clear();
            for (var device = 0; device < NAudio.Midi.MidiIn.NumberOfDevices; device++)
            {
                _MidiDevices.Add(NAudio.Midi.MidiIn.DeviceInfo(device).ProductName);
            }
            if (_MidiDevices.Count > 0)
            {
                MidiDevice = MidiDevices[0];
            }
            var selectedMidiDevice = MidiDevices.IndexOf(MidiDevice);

            try {
                if (selectedMidiDevice >= 0)
                {
                    MidiEnabled = true;

                    midiIn = new MidiIn(selectedMidiDevice);
                    midiIn.MessageReceived += MidiMessageReceived;

                    midiIn.Start();
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #2
0
        partial void Execute_MidiOnCommand()
        {
            var selectedMidiDevice = MidiDevices.IndexOf(MidiDevice);

            if (selectedMidiDevice >= 0)
            {
                MidiEnabled             = true;
                midiIn                  = new MidiIn(selectedMidiDevice);
                midiIn.MessageReceived += MidiMessageReceived;
                // midiIn.ErrorReceived += MidiErrorReceived;
                midiIn.Start();
                ResetCanExecute();
            }
        }