Search in sources :

Example 16 with ICursorClip

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

the class AbstractSequencerView method isInXRange.

/**
 * Checks if the given number is in the current display.
 *
 * @param x The index to check
 * @return True if it should be displayed
 */
protected boolean isInXRange(final int x) {
    final ICursorClip clip = this.getClip();
    final int stepSize = clip.getNumSteps();
    final int start = clip.getEditPage() * stepSize;
    return x >= start && x < start + stepSize;
}
Also used : ICursorClip(de.mossgrabers.framework.daw.ICursorClip)

Example 17 with ICursorClip

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

the class AbstractSequencerView method onActivate.

/**
 * {@inheritDoc}
 */
@Override
public void onActivate() {
    super.onActivate();
    final ICursorClip clip = this.getClip();
    clip.enableObservers(true);
    clip.setStepLength(RESOLUTIONS[this.selectedIndex]);
}
Also used : ICursorClip(de.mossgrabers.framework.daw.ICursorClip)

Example 18 with ICursorClip

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

the class PlayView method drawDrumGrid.

/**
 * 'Draw' the drum grid sequencer.
 */
public void drawDrumGrid() {
    if (!this.model.canSelectedTrackHoldNotes()) {
        for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
        for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
        return;
    }
    if (this.isPlayMode) {
        final ICursorDevice primary = this.model.getPrimaryDevice();
        final boolean hasDrumPads = primary.hasDrumPads();
        boolean isSoloed = false;
        if (hasDrumPads) {
            for (int i = 0; i < 16; i++) {
                if (primary.getDrumPad(i).isSolo()) {
                    isSoloed = true;
                    break;
                }
            }
        }
        for (int y = 0; y < 2; y++) {
            for (int x = 0; x < 8; x++) {
                final int index = 8 * y + x;
                final int color = this.getPadColor(index, primary, isSoloed);
                if (y == 0)
                    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + x, color);
                else
                    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + x, color);
            }
        }
    } else {
        final ICursorClip clip = this.getClip();
        // Paint the sequencer steps
        final int step = clip.getCurrentStep();
        final int hiStep = this.isInXRange(step) ? step % PlayView.NUM_DISPLAY_COLS : -1;
        for (int col = 0; col < PlayView.NUM_DISPLAY_COLS; col++) {
            final int isSet = clip.getStep(col, this.offsetY + this.selectedPad);
            final boolean hilite = col == hiStep;
            final int x = col % 8;
            final double y = col / 8.0;
            final int color = isSet > 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : hilite ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            if (y == 0)
                this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + x, color);
            else
                this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + x, color);
        }
    }
}
Also used : ICursorClip(de.mossgrabers.framework.daw.ICursorClip) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 19 with ICursorClip

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

the class SequencerView method onGridNoteLongPress.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNoteLongPress(final int note) {
    if (!this.model.canSelectedTrackHoldNotes())
        return;
    this.surface.setGridNoteConsumed(note);
    final int index = note - 36;
    final int y = index / 8;
    if (y >= this.numSequencerRows)
        return;
    // TODO Bugfix required - setStep makes Bitwig hang
    // https://github.com/teotigraphix/Framework4Bitwig/issues/124
    final int x = index % 8;
    final ICursorClip cursorClip = this.model.getCursorClip(8, 128);
    final int state = cursorClip.getStep(x, this.noteMap[y]);
    final ModeManager modeManager = this.surface.getModeManager();
    final NoteMode noteMode = (NoteMode) modeManager.getMode(Modes.MODE_NOTE);
    noteMode.setValues(cursorClip, x, note, state == 2 ? 1.0 : 0, 127);
    modeManager.setActiveMode(Modes.MODE_NOTE);
}
Also used : NoteMode(de.mossgrabers.push.mode.NoteMode) ICursorClip(de.mossgrabers.framework.daw.ICursorClip) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

ICursorClip (de.mossgrabers.framework.daw.ICursorClip)19 PadGrid (de.mossgrabers.framework.controller.grid.PadGrid)5 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)4 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)3 ITrack (de.mossgrabers.framework.daw.data.ITrack)3 IChannel (de.mossgrabers.framework.daw.data.IChannel)2 ModeManager (de.mossgrabers.framework.mode.ModeManager)2 PushDisplay (de.mossgrabers.push.controller.PushDisplay)2 Display (de.mossgrabers.framework.controller.display.Display)1 ITransport (de.mossgrabers.framework.daw.ITransport)1 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)1 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)1 SceneView (de.mossgrabers.framework.view.SceneView)1 View (de.mossgrabers.framework.view.View)1 ViewManager (de.mossgrabers.framework.view.ViewManager)1 PushCursorCommand (de.mossgrabers.push.command.trigger.PushCursorCommand)1 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)1 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)1 NoteMode (de.mossgrabers.push.mode.NoteMode)1 ClipView (de.mossgrabers.push.view.ClipView)1