Ejemplo n.º 1
0
        /// <summary>
        /// Sends the files to the key
        /// </summary>
        /// <param name="sender">button that had recieved a drop</param>
        /// <param name="e">contains files that were dropped</param>
        private void Btn_Drop(object sender, DragEventArgs e)
        {
            //to-do: add functionality for function files that load a specific function, key files that load a specific key with many functions
            Button       btn = ((Button)sender);
            int          row = (int)btn.GetValue(Grid.RowProperty);
            int          col = (int)btn.GetValue(Grid.ColumnProperty);
            LaunchpadKey key = MidiDeviceEngine.launchpadDevice.launchpadKeyArrays[modeComboBox.SelectedIndex][row, col];

            key.fileDropHandler(e);
            openKeyInfo(row, col);
        }
Ejemplo n.º 2
0
        };                                                                                                      //starts with one mode active

        public LaunchpadDevice()
        {
            #region init all launchpad keys
            for (int x = 0; x < 9; x++)
            {
                for (int y = 0; y < 9; y++)
                {
                    launchpadKeyArrays[0][x, y] = new LaunchpadKey(x, y);
                }
            }
            #endregion
        }
Ejemplo n.º 3
0
        private void refreshButtonUI(int row, int col)
        {
            LaunchpadKey key = MidiDeviceEngine.launchpadDevice.launchpadKeyArrays[modeComboBox.SelectedIndex][row, col];

            if (key.currentKeyColorRed == 0 && key.currentKeyColorGreen == 0)
            {
                launchpadButtonUI[row, col].Background = new SolidColorBrush(Color.FromRgb(180, 180, 180));
            }
            else
            {
                int    redBG   = 255;
                int    rGreenB = 255;
                double power   = key.functions[key.currentFunction].lightControl.greenPressed + key.functions[key.currentFunction].lightControl.redPressed;
                if (key.functions[key.currentFunction].lightControl.greenPressed > key.functions[key.currentFunction].lightControl.redPressed)
                {
                    redBG = 85 * key.functions[key.currentFunction].lightControl.redPressed;
                }
                else if (key.functions[key.currentFunction].lightControl.greenPressed < key.functions[key.currentFunction].lightControl.redPressed)
                {
                    rGreenB = 70 * key.functions[key.currentFunction].lightControl.greenPressed;
                }
                else
                {
                    redBG   = 255;
                    rGreenB = 255;
                }
                if (key.functions[key.currentFunction].lightControl.greenPressed == 3 || key.functions[key.currentFunction].lightControl.redPressed == 3)
                {
                    power = 2;
                }
                else if (key.functions[key.currentFunction].lightControl.greenPressed == 2 || key.functions[key.currentFunction].lightControl.redPressed == 2)
                {
                    power = 1.3;
                }
                else
                {
                    power   = 0.9;
                    rGreenB = 200;
                }
                RadialGradientBrush rad = new RadialGradientBrush();
                rad.GradientStops.Add(new GradientStop(Color.FromRgb((byte)redBG, (byte)rGreenB, 0), 0));
                rad.GradientStops.Add(new GradientStop(Color.FromRgb(180, 180, 180), power));
                launchpadButtonUI[row, col].Background = rad;
            }
        }
Ejemplo n.º 4
0
        public override void midiMessageRecieved(IMidiMessage msg)
        {
            LaunchpadKeySignalInfo sigInfo = convertToLaunchpadKeySignalInfo(msg);
            LaunchpadKey           key     = launchpadKeyArrays[GlobalVariables.currentMode][sigInfo.row, sigInfo.col];

            if (key.functions.Count > 0)
            {
                if (sigInfo.velocity == 127)
                {
                    key.buttonActivated(true);
                    sendMidiMessage(convertToIMidiMessage(sigInfo.row, sigInfo.col, key.functions[key.currentFunction].lightControl.colorPressed));
                }
                else
                {
                    key.buttonActivated(false);
                    sendMidiMessage(convertToIMidiMessage(sigInfo.row, sigInfo.col, key.functions[key.currentFunction].lightControl.colorReleased));
                }
            }
        }