Search in sources :

Example 6 with INoteClip

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

the class DrumView method handleSequencerArea.

/**
 * {@inheritDoc}
 */
@Override
protected void handleSequencerArea(final int index, final int x, final int y, final int offsetY, final int velocity) {
    if (!this.isActive())
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    if (velocity > 0) {
        // Turn on Note mode if an existing note is pressed
        final INoteClip cursorClip = this.getClip();
        final int channel = this.configuration.getMidiEditChannel();
        final int step = this.numColumns * (this.allRows - 1 - y) + x;
        final int note = offsetY + this.selectedPad;
        final StepState state = cursorClip.getStep(channel, step, note).getState();
        if (state == StepState.START) {
            final NoteMode noteMode = (NoteMode) modeManager.get(Modes.NOTE);
            noteMode.setValues(cursorClip, channel, step, note);
            modeManager.setActive(Modes.NOTE);
        }
    } else {
        // Turn off Note mode
        if (modeManager.isActive(Modes.NOTE))
            modeManager.restore();
        if (this.isNoteEdited) {
            this.isNoteEdited = false;
            return;
        }
    }
    super.handleSequencerArea(index, x, y, offsetY, velocity);
}
Also used : NoteMode(de.mossgrabers.controller.akai.apc.mode.NoteMode) StepState(de.mossgrabers.framework.daw.StepState) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 7 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)

Example 8 with INoteClip

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

the class Drum8View 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 stepX = index % this.numColumns;
    final int stepY = this.scales.getDrumOffset() + index / this.numColumns;
    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 9 with INoteClip

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

the class ClipView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final INoteClip clip = this.getClip();
    // Clip length/loop area
    final int step = clip.getCurrentStep();
    final double quartersPerPad = this.getQuartersPerPad();
    final int stepsPerMeasure = (int) Math.round(quartersPerPad / Resolution.getValueAt(this.selectedResolutionIndex));
    final int currentMeasure = step / stepsPerMeasure;
    final double maxQuarters = quartersPerPad * 64;
    final double start = clip.getLoopStart();
    final int loopStartPad = (int) Math.floor(Math.max(0, start) / quartersPerPad);
    final int loopEndPad = (int) Math.ceil(Math.min(maxQuarters, start + clip.getLoopLength()) / quartersPerPad);
    final boolean isPush2 = this.surface.getConfiguration().isPush2();
    final int white = isPush2 ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH1_COLOR2_WHITE;
    final int green = isPush2 ? PushColorManager.PUSH2_COLOR2_GREEN : PushColorManager.PUSH1_COLOR2_GREEN;
    final int off = isPush2 ? PushColorManager.PUSH2_COLOR_BLACK : PushColorManager.PUSH1_COLOR_BLACK;
    for (int pad = 0; pad < 64; pad++) {
        final int color;
        if (pad >= loopStartPad && pad < loopEndPad)
            color = pad == currentMeasure ? green : white;
        else
            color = off;
        this.surface.getPadGrid().lightEx(pad % 8, pad / 8, color, -1, false);
    }
}
Also used : INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 10 with INoteClip

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

the class PolySequencerView method onGridNoteLongPress.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNoteLongPress(final int note) {
    if (!this.isActive())
        return;
    final int index = note - 36;
    this.surface.getButton(ButtonID.get(ButtonID.PAD1, index)).setConsumed();
    final int x = index % this.numColumns;
    final int y = index / this.numColumns;
    if (y < this.numRows - this.numSequencerRows)
        return;
    final INoteClip clip = this.getClip();
    final int step = this.numColumns * (this.numRows - 1 - y) + x;
    final int channel = this.configuration.getMidiEditChannel();
    this.clearEditNotes();
    for (int row = 0; row < 128; row++) {
        if (clip.getStep(channel, step, row).getState() == StepState.START)
            this.editNote(clip, channel, step, row, true);
    }
}
Also used : 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