Exemplo n.º 1
0
        public MidiPage()
        {
            this.InitializeComponent();

            // Set up the MIDI output device watcher
            _midiOutDeviceWatcher         = new MidiDeviceWatcher(MidiOutPort.GetDeviceSelector(), Dispatcher, OutputDevicesList, OutputDevices);
            OutputDevicesList.ItemsSource = OutputDevices;

            // Start watching for devices
            _midiOutDeviceWatcher.Start();

            Unloaded += MidiDeviceOutputTests_Unloaded;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor: Start the device watcher
        /// </summary>
        public MidiDeviceInput()
        {
            InitializeComponent();

            rootGrid.DataContext = this;

            // Initialize the list of active MIDI input devices
            _midiInPorts = new List <MidiInPort>();

            // Set up the MIDI input device watcher
            _midiInDeviceWatcher = new MidiDeviceWatcher(MidiInPort.GetDeviceSelector(), Dispatcher, inputDevices, InputDevices);

            // Start watching for devices
            _midiInDeviceWatcher.Start();

            Unloaded += MidiDeviceInput_Unloaded;
        }
Exemplo n.º 3
0
        public MainPage()
        {
            this.InitializeComponent();
            App.Current.Suspending += Current_Suspending;
            mArduino        = new ArduinoManager();
            mGPIO           = new GPIOManager();
            mGameNoteIndexs = new int[5] {
                0, 0, 0, 0, 0
            };
            mCurrentGameNote = new MidiGameNote[5];
            mIsInited        = false;
            mIsPlaying       = false;


            Task.Run(async() =>
            {
                SMFReader r = new SMFReader();
                mSMF        = await r.Read(@"Assets\out.mid");
                var w       = new MidiDeviceWatcher(MidiOutPort.GetDeviceSelector(), Dispatcher);
                w.Start();
                var col  = w.GetDeviceInformationCollection();
                var l    = await DeviceInformation.FindAllAsync(MidiOutPort.GetDeviceSelector());
                MIDIPort = await MidiOutPort.FromIdAsync(l[0].Id);
                await mArduino.Init();
                await mGPIO.Init(GpioController.GetDefault());
                mGPIO.MidiButtonChanged += MGPIO_MidiButtonChanged;
                mGPIO.JoyButtonChanged  += MGPIO_JoyButtonChanged;
                mPlayer                   = new SMFPlayer(mSMF, MIDIPort);
                mPlayer.OnLED            += Player_OnLED;
                mPlayer.OnBarBeatChanged += Player_BarBeatChanged;
                mPlayer.OnTempoChanged   += Player_OnTempoChanged;
                mGPIO.Ack();
                mIsInited = true;
            });
            mVolTimer          = new DispatcherTimer();
            mVolTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            mVolTimer.Tick    += MVolTimer_Tick;
            mVolTimer.Start();
        }