Пример #1
0
        private void InitialiseButtons()
        {
            for (int i = 0; i < 8; i++)
            {
                mToolbar[i] = new LaunchpadButton(this, ButtonType.Toolbar, 104 + i);
                mSide[i]    = new LaunchpadButton(this, ButtonType.Side, i * 16 + 8);
            }

            for (int y = 0; y < 8; y++)
            {
                for (int x = 0; x < 8; x++)
                {
                    mGrid[x, y] = new LaunchpadButton(this, ButtonType.Grid, y * 16 + x);
                }
            }
        }
Пример #2
0
        private void mInputDevice_ControlChange(ControlChangeMessage msg)
        {
            ToolbarButton toolbarButton = (ToolbarButton)((int)msg.Control - 104);

            LaunchpadButton button = GetButton(toolbarButton);

            if (button == null)
            {
                return;
            }

            button.State = (ButtonPressState)msg.Value;
            if (ButtonPressed != null && button.State == ButtonPressState.Down)
            {
                ButtonPressed.Invoke(this, new ButtonPressEventArgs(toolbarButton));
            }
        }
Пример #3
0
        private void mInputDevice_NoteOn(NoteOnMessage msg)
        {
            LaunchpadButton button = GetButton(msg.Pitch);

            if (button == null)
            {
                return;
            }

            button.State = (ButtonPressState)msg.Velocity;

            if (ButtonPressed != null && button.State == ButtonPressState.Down)
            {
                if ((int)msg.Pitch % 16 == 8)
                {
                    ButtonPressed.Invoke(this, new ButtonPressEventArgs((SideButton)((int)msg.Pitch / 16)));
                }
                else
                {
                    ButtonPressed.Invoke(this, new ButtonPressEventArgs((int)msg.Pitch % 16, (int)msg.Pitch / 16));
                }
            }
        }
Пример #4
0
 public async void visualizeButtonPress(LaunchpadButton button, ButtonPressEventArgs e, string name) {
     string targetName = "";
     switch (e.Type) {
         case ButtonType.Grid:
             targetName = "_" + name;
             break;
         case ButtonType.Side:
             targetName = "side" + name;
             break;
         case ButtonType.Toolbar:
             targetName = "top" + name;
             break;
     }
     button.SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
     Application.Current.Dispatcher.Invoke(() => {
         var topBtn = (Button)this.FindName(targetName);
         topBtn.Background = Brushes.Green;
     });
     await Task.Delay(500);
     button.SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full);
     Application.Current.Dispatcher.Invoke(() => {
         var topBtn = (Button)this.FindName(targetName);
         topBtn.Background = Brushes.Orange;
     });
 }
Пример #5
0
 private void toggleButton( LaunchpadButton button, ButtonType btype, String name) {
     string targetName;
     if (btype == ButtonType.Side) {
         targetName = "side" + name;   
     } else {
         targetName = "_" + name;
     }
     var toggleOn = false;
     if (button != null) {
         if (button.RedBrightness == ButtonBrightness.Full && button.GreenBrightness == ButtonBrightness.Full) {
             button.SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
             toggleOn = true;
         } else if (button.RedBrightness == ButtonBrightness.Off &&
                    button.GreenBrightness == ButtonBrightness.Full) {
             button.SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full);
         }
     }
     toggleGui(targetName, toggleOn);
 }
Пример #6
0
        private void InitialiseButtons()
        {
            for (int i = 0; i < 8; i++) {
                mToolbar[i] = new LaunchpadButton(this, ButtonType.Toolbar, 104 + i);
                mSide[i] = new LaunchpadButton(this, ButtonType.Side, i * 16 + 8);
            }

            for (int y = 0; y < 8; y++)
                for (int x = 0; x < 8; x++)
                    mGrid[x, y] = new LaunchpadButton(this, ButtonType.Grid, y * 16 + x);
        }