Search in sources :

Example 36 with INoteClip

use of de.mossgrabers.framework.daw.INoteClip 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 37 with INoteClip

use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.

the class AbstractRaindropsView method getNoteDistanceToTheRight.

protected int getNoteDistanceToTheRight(final int row, final int start, final int length) {
    if (row < 0 || start < 0 || start >= length)
        return -1;
    int step = start;
    int counter = 0;
    final INoteClip clip = this.getClip();
    final int editMidiChannel = this.configuration.getMidiEditChannel();
    do {
        if (clip.getStep(editMidiChannel, step, row).getState() != StepState.OFF)
            return counter;
        step++;
        counter++;
        if (step >= length)
            step = 0;
    } while (step != start);
    return -1;
}
Also used : INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 38 with INoteClip

use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.

the class Drum4View method onGridNoteLongPress.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNoteLongPress(final int note) {
    if (!this.isActive())
        return;
    final int index = note - DRUM_START_KEY;
    this.surface.getButton(ButtonID.get(ButtonID.PAD1, index)).setConsumed();
    final int x = index % 8;
    final int y = index / 8;
    final int sound = y % 4;
    final int stepX = 8 * (1 - y / 4) + x;
    final int stepY = this.scales.getDrumOffset() + sound;
    final int channel = this.configuration.getMidiEditChannel();
    final INoteClip clip = this.getClip();
    this.editNote(clip, channel, stepX, stepY, false);
}
Also used : INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 39 with INoteClip

use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.

the class DrumView method onGridNoteLongPress.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNoteLongPress(final int note) {
    if (!this.isActive() || this.isPlayMode)
        return;
    final int index = note - DRUM_START_KEY;
    this.surface.getButton(ButtonID.get(ButtonID.PAD1, index)).setConsumed();
    final int x = index % this.numColumns;
    final int y = index / this.numColumns;
    final int step = this.numColumns * (1 - y) + x;
    final int row = this.scales.getDrumOffset() + this.getSelectedPad();
    final int channel = this.configuration.getMidiEditChannel();
    final INoteClip clip = this.getClip();
    this.editNote(clip, channel, step, row, false);
}
Also used : INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 40 with INoteClip

use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.

the class DrumView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    final IDrumDevice primary = this.model.getDrumDevice();
    if (this.isPlayMode) {
        for (int y = 0; y < 2; y++) {
            for (int x = 0; x < 8; x++) {
                final int index = 8 * y + x;
                padGrid.lightEx(x, 1 - y, this.getDrumPadColor(index, primary, false));
            }
        }
        return;
    }
    if (!this.isActive()) {
        padGrid.turnOff();
        return;
    }
    // Paint the sequencer steps
    final INoteClip clip = this.getClip();
    final int step = clip.getCurrentStep();
    final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
    final int offsetY = this.scales.getDrumOffset();
    final int editMidiChannel = this.configuration.getMidiEditChannel();
    final int selPad = this.getSelectedPad();
    final List<GridStep> editNotes = this.getEditNotes();
    for (int col = 0; col < DrumView.NUM_DISPLAY_COLS; col++) {
        final int noteRow = offsetY + selPad;
        final IStepInfo stepInfo = clip.getStep(editMidiChannel, col, noteRow);
        final boolean hilite = col == hiStep;
        final int x = col % GRID_COLUMNS;
        final int y = col / GRID_COLUMNS;
        final Optional<ColorEx> rowColor = this.getPadColor(primary, this.selectedPad);
        padGrid.lightEx(x, y, this.getStepColor(stepInfo, hilite, rowColor, editMidiChannel, col, noteRow, editNotes));
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) GridStep(de.mossgrabers.framework.daw.data.GridStep) IStepInfo(de.mossgrabers.framework.daw.IStepInfo) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Aggregations

INoteClip (de.mossgrabers.framework.daw.INoteClip)41 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)13 IStepInfo (de.mossgrabers.framework.daw.IStepInfo)6 StepState (de.mossgrabers.framework.daw.StepState)6 GridStep (de.mossgrabers.framework.daw.data.GridStep)6 IDrumDevice (de.mossgrabers.framework.daw.data.IDrumDevice)6 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)5 ITrack (de.mossgrabers.framework.daw.data.ITrack)3 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)3 NoteMode (de.mossgrabers.controller.akai.apc.mode.NoteMode)2 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)1 ISlot (de.mossgrabers.framework.daw.data.ISlot)1 ISlotBank (de.mossgrabers.framework.daw.data.bank.ISlotBank)1