Search in sources :

Example 26 with INoteClip

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

the class SequencerView method getTrackButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getTrackButtonColor(final int index) {
    final int octave = this.scales.getOctave();
    final INoteClip clip = this.getClip();
    switch(index) {
        case 0:
            return octave < Scales.OCTAVE_RANGE ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 1:
            return octave > -Scales.OCTAVE_RANGE ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 2:
            return clip.doesExist() && clip.canScrollStepsBackwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 3:
            return clip.doesExist() && clip.canScrollStepsForwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        default:
            return APCminiControlSurface.APC_BUTTON_STATE_OFF;
    }
}
Also used : INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 27 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())
        return;
    final int index = note - DRUM_START_KEY;
    this.surface.getButton(ButtonID.get(ButtonID.PAD1, index)).setConsumed();
    final int y = index / GRID_COLUMNS;
    // Sequencer steps?
    if (y < this.playRows)
        return;
    final int x = index % GRID_COLUMNS;
    final int stepX = GRID_COLUMNS * (this.allRows - 1 - y) + x;
    final int stepY = this.scales.getDrumOffset() + this.getSelectedPad();
    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 28 with INoteClip

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

the class SequencerView 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 y = index / 8;
    if (y >= this.numSequencerRows)
        return;
    final int step = index % 8;
    final INoteClip clip = this.getClip();
    final int mappedNote = this.keyManager.map(y);
    final int channel = this.configuration.getMidiEditChannel();
    this.editNote(clip, channel, step, mappedNote, false);
}
Also used : INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 29 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();
    if (!this.model.canSelectedTrackHoldNotes()) {
        padGrid.turnOff();
        return;
    }
    if (this.isPlayMode) {
        final IDrumDevice primary = this.model.getDrumDevice();
        for (int y = 0; y < 2; y++) {
            for (int x = 0; x < 8; x++) {
                final int index = 8 * y + x;
                padGrid.lightEx(x, y, this.getDrumPadColor(index, primary));
            }
        }
        return;
    }
    final INoteClip clip = this.getClip();
    // Paint the sequencer steps
    final int step = clip.getCurrentStep();
    final int hiStep = this.isInXRange(step) ? step % DrumView.NUM_DISPLAY_COLS : -1;
    final int offsetY = this.scales.getDrumOffset();
    final int editMidiChannel = this.configuration.getMidiEditChannel();
    for (int col = 0; col < DrumView.NUM_DISPLAY_COLS; col++) {
        final StepState stepState = clip.getStep(editMidiChannel, col, offsetY + this.selectedPad).getState();
        final boolean hilite = col == hiStep;
        final int x = col % 8;
        final int y = col / 8;
        padGrid.lightEx(x, 1 - y, getSequencerPadColor(stepState, hilite));
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) StepState(de.mossgrabers.framework.daw.StepState) IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 30 with INoteClip

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

the class SequencerView method handleSequencerArea.

/**
 * {@inheritDoc}
 */
@Override
protected void handleSequencerArea(final int index, final int x, final int y, final int velocity) {
    // Handle note editor mode
    final ModeManager modeManager = this.surface.getModeManager();
    if (velocity > 0) {
        if (modeManager.isActive(Modes.NOTE)) {
            // Store existing note for editing
            final INoteClip clip = this.getClip();
            final int channel = this.configuration.getMidiEditChannel();
            final int mappedY = this.keyManager.map(y);
            final StepState state = clip.getStep(channel, x, mappedY).getState();
            if (state == StepState.START)
                this.editNote(clip, channel, x, mappedY, true);
            return;
        }
    } else {
        if (this.isNoteEdited)
            this.isNoteEdited = false;
        if (modeManager.isActive(Modes.NOTE))
            return;
    }
    super.handleSequencerArea(index, x, y, velocity);
}
Also used : StepState(de.mossgrabers.framework.daw.StepState) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) 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