示例#1
0
 public RBMidPlayer(MotorController controller, RBMid.GEMTRACK.GEM[] track)
 {
     this.controller = controller;
     states          = ButtonState.Convert(track);
     Time            = 0.0;
     player          = new Thread(BackgroundThread);
     player.Start();
 }
示例#2
0
文件: MainForm.cs 项目: maxton/rb-bot
        //public GuitarPlayer()
        //{
        //  InitializeComponent();
        //}



        private void Port_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.controller?.Dispose();
            flowLayoutPanel1.Controls.Clear();

            var controller = new MotorController((string)portSelector.SelectedItem);

            flowLayoutPanel1.SuspendLayout();
            var tab = 0;

            foreach (var x in controller.Offsets)
            {
                var p = new DetectorPoint();
                p.midiNote = tab;
                var pc = new PointControllerGuitar(p);
                pc.offsetUpDown.Tag           = tab;
                pc.offsetUpDown.TabIndex      = tab;
                pc.offsetUpDown.Maximum       = 32767;
                pc.offsetUpDown.Minimum       = -32768;
                pc.offsetUpDown.Value         = x;
                pc.offsetUpDown.ValueChanged += UpDown_ValueChanged;
                var t = tab;
                pc.toggleButton.Click += (o, ea) =>
                {
                    if (controller.State[t])
                    {
                        pc.toggleButton.Checked    = false;
                        pc.toggleButton.CheckState = CheckState.Unchecked;
                    }
                    else
                    {
                        pc.toggleButton.Checked    = true;
                        pc.toggleButton.CheckState = CheckState.Checked;
                    }
                    controller.State[t] = pc.toggleButton.Checked;
                    controller.SendState();
                };
                flowLayoutPanel1.Controls.Add(pc);
                tab++;
            }
            flowLayoutPanel1.ResumeLayout(false);
            flowLayoutPanel1.PerformLayout();

            try
            {
                downPosInput.Value = controller.DownPos;
                upPosInput.Value   = controller.UpPos;
            }
            catch (Exception) { }
            this.controller = controller;
        }
示例#3
0
文件: MainForm.cs 项目: maxton/rb-bot
        private void MainForm_Load(object sender, EventArgs e)
        {
            var winEnum = new WindowEnumerator();

            winEnum.LoadWindows();
            foreach (var i in winEnum.windows)
            {
                var win = new Window(i);
                if (win.name == "")
                {
                    continue;
                }
                if (win.Rec.right - win.Rec.left > 0 && win.Rec.bottom - win.Rec.top > 0)
                {
                    windowSelector.Items.Add(win);
                }
            }
            windowSelector.SelectedIndex         = 0;
            windowSelector.SelectedIndexChanged += ComboBox1_SelectedIndexChanged;

            points = new List <PointControllerDrums>();

            foreach (var d in Midi.Devices.DeviceManager.OutputDevices)
            {
                deviceSelector.Items.Add(d.Name);
            }
            deviceSelector.SelectedIndexChanged += DeviceSelector_SelectedIndexChanged;


            windowBox.MouseDown += PictureBox1_MouseDown;
            windowBox.MouseMove += PictureBox1_MouseMove;
            windowBox.MouseUp   += PictureBox1_MouseUp;

            foreach (var p in MotorController.GetPorts())
            {
                portSelector.Items.Add(p);
            }
            portSelector.SelectedIndexChanged += Port_SelectedIndexChanged;
        }
示例#4
0
文件: MainForm.cs 项目: maxton/rb-bot
 private void disconnectBtn_Click(object sender, EventArgs e)
 {
     flowLayoutPanel1.Controls.Clear();
     controller?.Dispose();
     controller = null;
 }