Search in sources :

Example 31 with IPadGrid

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

the class AbstractDrumView method drawSequencerSteps.

/**
 * Draw the sequencer steps.
 *
 * @param clip The clip
 * @param isActive Is there an active clip?
 * @param noteRow The note for which to draw the row
 * @param rowColor The color to use the notes of the row
 * @param yModifier Flips the Y order if true
 */
protected void drawSequencerSteps(final INoteClip clip, final boolean isActive, final int noteRow, final Optional<ColorEx> rowColor, final IntUnaryOperator yModifier) {
    final int step = clip.getCurrentStep();
    final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
    final int editMidiChannel = this.configuration.getMidiEditChannel();
    final IPadGrid padGrid = this.surface.getPadGrid();
    final List<GridStep> editNotes = this.getEditNotes();
    for (int col = 0; col < this.sequencerSteps; col++) {
        final IStepInfo stepInfo = clip.getStep(editMidiChannel, col, noteRow);
        final boolean hilite = col == hiStep;
        final int x = col % this.numColumns;
        int y = col / this.numColumns;
        if (yModifier != null)
            y = yModifier.applyAsInt(y);
        padGrid.lightEx(x, y, isActive ? this.getStepColor(stepInfo, hilite, rowColor, editMidiChannel, col, noteRow, editNotes) : AbstractSequencerView.COLOR_NO_CONTENT);
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) GridStep(de.mossgrabers.framework.daw.data.GridStep) IStepInfo(de.mossgrabers.framework.daw.IStepInfo)

Example 32 with IPadGrid

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

the class AbstractPolySequencerView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    final boolean isKeyboardEnabled = this.model.canSelectedTrackHoldNotes();
    if (!isKeyboardEnabled) {
        padGrid.turnOff();
        return;
    }
    final INoteClip clip = this.getClip();
    final boolean isActive = this.isActive();
    final int step = clip.getCurrentStep();
    // Paint the sequencer steps
    final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
    final List<GridStep> editNotes = this.getEditNotes();
    for (int col = 0; col < this.sequencerSteps; col++) {
        final IStepInfo stepInfo = this.getStep(clip, col);
        final boolean hilite = col == hiStep;
        final int x = col % this.numColumns;
        final int y = col / this.numColumns;
        padGrid.lightEx(x, y, isActive ? this.getStepColor(stepInfo, hilite, col, editNotes) : AbstractSequencerView.COLOR_NO_CONTENT);
    }
    // Paint the play part
    final boolean isRecording = this.model.hasRecordingState();
    final ITrack cursorTrack = this.model.getCursorTrack();
    final int startNote = this.scales.getStartNote();
    for (int i = startNote; i < startNote + this.sequencerSteps; i++) padGrid.light(i, this.getGridColor(isKeyboardEnabled, isRecording, cursorTrack, i));
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) ITrack(de.mossgrabers.framework.daw.data.ITrack) GridStep(de.mossgrabers.framework.daw.data.GridStep) IStepInfo(de.mossgrabers.framework.daw.IStepInfo) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 33 with IPadGrid

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

the class BrowserView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    padGrid.light(36, DISCARD);
    padGrid.light(37, OFF);
    for (int i = 38; i < 42; i++) padGrid.light(i, PLAY);
    padGrid.light(42, OFF);
    padGrid.light(43, CONFIRM);
    for (int i = 44; i < 52; i++) padGrid.light(i, OFF);
    for (int i = 52; i < 60; i++) padGrid.light(i, COLUMNS[i - 52]);
    for (int i = 60; i < 68; i++) padGrid.light(i, COLUMNS[i - 60]);
    for (int i = 68; i < 76; i++) padGrid.light(i, COLUMNS[i - 68]);
    for (int i = 76; i < 84; i++) padGrid.light(i, COLUMNS[i - 76]);
    for (int i = 84; i < 100; i++) padGrid.light(i, OFF);
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid)

Example 34 with IPadGrid

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

the class AbstractDrum64View method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    if (!this.model.canSelectedTrackHoldNotes()) {
        padGrid.turnOff();
        return;
    }
    final IDrumDevice drumDevice64 = this.model.getDrumDevice64();
    final boolean isRecording = this.model.hasRecordingState();
    int blockOffset = 0;
    // Draw all blocks
    for (int xblock = 0; xblock < this.xblocks; xblock++) {
        for (int yblock = 0; yblock < this.yblocks; yblock++) {
            // Draw a 4x4 square
            for (int blockX = 0; blockX < 4; blockX++) {
                for (int blockY = 0; blockY < 4; blockY++) {
                    final int index = blockOffset + blockY * 4 + blockX;
                    final int x = xblock * 4 + blockX;
                    final int y = yblock * 4 + blockY;
                    padGrid.lightEx(x, this.rows - 1 - y, this.getDrumPadColor(index, drumDevice64, isRecording));
                }
            }
            blockOffset += 16;
        }
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice)

Example 35 with IPadGrid

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

the class PrgChangeView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final int[] colors = this.isToggled ? this.yellows : this.greens;
    final int selPad;
    if (this.isToggled)
        selPad = this.programNumber >= 64 ? this.programNumber - 64 : -1;
    else
        selPad = this.programNumber < 64 ? this.programNumber : -1;
    final IPadGrid gridPad = this.surface.getPadGrid();
    final boolean isPush2 = this.surface.getConfiguration().isPush2();
    final int red = isPush2 ? PushColorManager.PUSH2_COLOR2_RED : PushColorManager.PUSH1_COLOR2_RED;
    for (int i = 36; i < 100; i++) {
        final int pad = i - 36;
        final int row = pad / 8;
        gridPad.light(i, selPad == pad ? red : colors[row], -1, false);
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid)

Aggregations

IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)50 INoteClip (de.mossgrabers.framework.daw.INoteClip)13 ITrack (de.mossgrabers.framework.daw.data.ITrack)11 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)10 IStepInfo (de.mossgrabers.framework.daw.IStepInfo)7 GridStep (de.mossgrabers.framework.daw.data.GridStep)7 IDrumDevice (de.mossgrabers.framework.daw.data.IDrumDevice)7 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)4 ITransport (de.mossgrabers.framework.daw.ITransport)3 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)3 INoteRepeat (de.mossgrabers.framework.daw.midi.INoteRepeat)3 StepState (de.mossgrabers.framework.daw.StepState)2 IScene (de.mossgrabers.framework.daw.data.IScene)2 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)2 ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)2 Views (de.mossgrabers.framework.view.Views)2 LaunchpadConfiguration (de.mossgrabers.controller.novation.launchpad.LaunchpadConfiguration)1 LightInfo (de.mossgrabers.framework.controller.grid.LightInfo)1 DAWColor (de.mossgrabers.framework.daw.DAWColor)1 IHost (de.mossgrabers.framework.daw.IHost)1