Search in sources :

Example 16 with PadGrid

use of de.mossgrabers.framework.controller.grid.PadGrid in project DrivenByMoss by git-moss.

the class ShiftView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final PadGrid padGrid = this.surface.getPadGrid();
    for (int i = 7; i < 64; i++) padGrid.light(36 + i, APCColors.APC_COLOR_BLACK);
    // Add tracks
    for (int i = 0; i < 3; i++) padGrid.light(36 + 32 + i, APCColors.COLOR_KEY_WHITE);
    padGrid.light(36 + 35, APCColors.COLOR_KEY_SELECTED);
    padGrid.light(36 + 36, APCColors.COLOR_KEY_SELECTED);
    padGrid.light(36 + 38, APCColors.COLOR_KEY_BLACK);
    padGrid.light(36 + 39, APCColors.COLOR_KEY_BLACK);
    // Draw the keyboard
    final int scaleOffset = this.model.getScales().getScaleOffset();
    // 0'C', 1'G', 2'D', 3'A', 4'E', 5'B', 6'F', 7'Bb', 8'Eb', 9'Ab', 10'Db', 11'Gb'
    padGrid.light(36, scaleOffset == 0 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_WHITE);
    padGrid.light(36 + 1, scaleOffset == 2 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_WHITE);
    padGrid.light(36 + 2, scaleOffset == 4 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_WHITE);
    padGrid.light(36 + 3, scaleOffset == 6 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_WHITE);
    padGrid.light(36 + 4, scaleOffset == 1 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_WHITE);
    padGrid.light(36 + 5, scaleOffset == 3 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_WHITE);
    padGrid.light(36 + 6, scaleOffset == 5 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_WHITE);
    padGrid.light(36 + 9, scaleOffset == 10 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_BLACK);
    padGrid.light(36 + 10, scaleOffset == 8 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_BLACK);
    padGrid.light(36 + 12, scaleOffset == 11 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_BLACK);
    padGrid.light(36 + 13, scaleOffset == 9 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_BLACK);
    padGrid.light(36 + 14, scaleOffset == 7 ? APCColors.COLOR_KEY_SELECTED : APCColors.COLOR_KEY_BLACK);
}
Also used : PadGrid(de.mossgrabers.framework.controller.grid.PadGrid)

Example 17 with PadGrid

use of de.mossgrabers.framework.controller.grid.PadGrid in project DrivenByMoss by git-moss.

the class ShiftView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    // Draw the keyboard
    final int scaleOffset = this.scales.getScaleOffset();
    // 0'C', 1'G', 2'D', 3'A', 4'E', 5'B', 6'F', 7'Bb', 8'Eb', 9'Ab', 10'Db', 11'Gb'
    final PadGrid padGrid = this.surface.getPadGrid();
    for (int i = 7; i < 64; i++) padGrid.light(36 + i, APCminiColors.APC_COLOR_BLACK);
    padGrid.light(36 + 0, scaleOffset == 0 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 1, scaleOffset == 2 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 2, scaleOffset == 4 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 3, scaleOffset == 6 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 4, scaleOffset == 1 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 5, scaleOffset == 3 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 6, scaleOffset == 5 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 9, scaleOffset == 10 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_RED);
    padGrid.light(36 + 10, scaleOffset == 8 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_RED);
    padGrid.light(36 + 12, scaleOffset == 11 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_RED);
    padGrid.light(36 + 13, scaleOffset == 9 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_RED);
    padGrid.light(36 + 14, scaleOffset == 7 ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_RED);
    // Device Parameters up/down
    padGrid.light(36 + 24, APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 25, APCminiColors.APC_COLOR_YELLOW);
    // Device up/down
    padGrid.light(36 + 32, APCminiColors.APC_COLOR_GREEN);
    padGrid.light(36 + 33, APCminiColors.APC_COLOR_GREEN);
    // Change the scale
    padGrid.light(36 + 35, APCminiColors.APC_COLOR_RED);
    padGrid.light(36 + 36, APCminiColors.APC_COLOR_RED);
    padGrid.light(36 + 27, APCminiColors.APC_COLOR_GREEN);
    // Draw the view selection: Session, Note, Drum, Sequencer
    final Integer previousViewId = this.surface.getViewManager().getPreviousViewId();
    padGrid.light(36 + 56, previousViewId == Views.VIEW_SESSION ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 57, previousViewId == Views.VIEW_PLAY ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 58, previousViewId == Views.VIEW_DRUM ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 59, previousViewId == Views.VIEW_SEQUENCER ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 60, previousViewId == Views.VIEW_RAINDROPS ? APCminiColors.APC_COLOR_GREEN : APCminiColors.APC_COLOR_YELLOW);
    // Draw transport
    final ITransport transport = this.model.getTransport();
    padGrid.light(36 + 63, transport.isPlaying() ? APCminiColors.APC_COLOR_GREEN_BLINK : APCminiColors.APC_COLOR_GREEN);
    padGrid.light(36 + 55, transport.isRecording() ? APCminiColors.APC_COLOR_RED_BLINK : APCminiColors.APC_COLOR_RED);
    padGrid.light(36 + 47, APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 39, APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 62, APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 54, transport.isLauncherOverdub() ? APCminiColors.APC_COLOR_RED_BLINK : APCminiColors.APC_COLOR_RED);
    padGrid.light(36 + 46, APCminiColors.APC_COLOR_YELLOW);
    padGrid.light(36 + 38, APCminiColors.APC_COLOR_YELLOW);
}
Also used : PadGrid(de.mossgrabers.framework.controller.grid.PadGrid) ITransport(de.mossgrabers.framework.daw.ITransport)

Example 18 with PadGrid

use of de.mossgrabers.framework.controller.grid.PadGrid in project DrivenByMoss by git-moss.

the class AbstractDrumView method drawSequencer.

/**
 * Draw the clip loop and sequencer steps area.
 */
private void drawSequencer() {
    final ICursorClip clip = this.getClip();
    // Clip length/loop area
    final int step = clip.getCurrentStep();
    final int lengthOfOnePad = this.getLengthOfOnePage(this.sequencerSteps);
    final double loopStart = clip.getLoopStart();
    final int loopStartPad = (int) Math.ceil(loopStart / lengthOfOnePad);
    final int loopEndPad = (int) Math.ceil((loopStart + clip.getLoopLength()) / lengthOfOnePad);
    final int currentPage = step / this.sequencerSteps;
    final int numOfPages = this.halfColumns * this.playLines;
    final PadGrid padGrid = this.surface.getPadGrid();
    for (int pad = 0; pad < numOfPages; pad++) {
        final int x = this.halfColumns + pad % this.halfColumns;
        final int y = this.sequencerLines + pad / this.halfColumns;
        padGrid.lightEx(x, y, this.getPageColor(loopStartPad, loopEndPad, currentPage, clip.getEditPage(), pad));
    }
    // Paint the sequencer steps
    final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
    for (int col = 0; col < this.sequencerSteps; col++) {
        final int isSet = clip.getStep(col, this.offsetY + this.selectedPad);
        final boolean hilite = col == hiStep;
        final int x = col % GRID_COLUMNS;
        final int y = col / GRID_COLUMNS;
        padGrid.lightEx(x, y, this.getStepColor(isSet, hilite));
    }
}
Also used : PadGrid(de.mossgrabers.framework.controller.grid.PadGrid) ICursorClip(de.mossgrabers.framework.daw.ICursorClip)

Example 19 with PadGrid

use of de.mossgrabers.framework.controller.grid.PadGrid in project DrivenByMoss by git-moss.

the class AbstractPlayView method getMidiNoteFromGrid.

/**
 * Get the midi note from the grid.
 *
 * @param note The note on the grid
 * @return The translated note depending on applied scales, etc.
 */
public int getMidiNoteFromGrid(final int note) {
    final PadGrid padGrid = this.surface.getPadGrid();
    if (padGrid == null)
        return -1;
    final int translated = padGrid.translateToGrid(note);
    return translated < 0 ? -1 : this.noteMap[translated];
}
Also used : PadGrid(de.mossgrabers.framework.controller.grid.PadGrid)

Example 20 with PadGrid

use of de.mossgrabers.framework.controller.grid.PadGrid in project DrivenByMoss by git-moss.

the class PianoView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final PadGrid gridPad = this.surface.getPadGrid();
    if (!this.model.canSelectedTrackHoldNotes()) {
        gridPad.turnOff();
        return;
    }
    final boolean isPush2 = this.surface.getConfiguration().isPush2();
    final int red = isPush2 ? PushColors.PUSH2_COLOR2_RED_HI : PushColors.PUSH1_COLOR2_RED_HI;
    final int green = isPush2 ? PushColors.PUSH2_COLOR2_GREEN_HI : PushColors.PUSH1_COLOR2_GREEN_HI;
    final int white = isPush2 ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH1_COLOR2_WHITE;
    final int off = isPush2 ? PushColors.PUSH2_COLOR2_BLACK : PushColors.PUSH1_COLOR2_BLACK;
    final ITrack selectedTrack = this.model.getCurrentTrackBank().getSelectedTrack();
    final double[] color = selectedTrack.getColor();
    final int trackColor = this.model.getColorManager().getColor(BitwigColors.getColorIndex(color[0], color[1], color[2]));
    final boolean isRecording = this.model.hasRecordingState();
    for (int i = 0; i < 8; i++) {
        if (i % 2 == 0) {
            for (int j = 0; j < 8; j++) {
                final int n = 36 + 8 * i + j;
                gridPad.light(n, this.pressedKeys[n] > 0 ? isRecording ? red : green : white, -1, false);
            }
        } else {
            for (int j = 0; j < 8; j++) {
                final int n = 36 + 8 * i + j;
                if (j == 0 || j == 3 || j == 7)
                    gridPad.light(n, off, -1, false);
                else
                    gridPad.light(n, this.pressedKeys[n] > 0 ? isRecording ? red : green : trackColor, -1, false);
            }
        }
    }
}
Also used : PadGrid(de.mossgrabers.framework.controller.grid.PadGrid) ITrack(de.mossgrabers.framework.daw.data.ITrack)

Aggregations

PadGrid (de.mossgrabers.framework.controller.grid.PadGrid)20 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)5 ITrack (de.mossgrabers.framework.daw.data.ITrack)4 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)3 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)2 ITransport (de.mossgrabers.framework.daw.ITransport)2 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)1 ModeManager (de.mossgrabers.framework.mode.ModeManager)1