Search in sources :

Example 31 with INoteClip

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

the class SequencerView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    if (!this.model.canSelectedTrackHoldNotes()) {
        padGrid.turnOff();
        return;
    }
    if (this.isPlayMode) {
        for (int i = 36; i < 52; i++) {
            padGrid.light(i, this.keyManager.isKeyPressed(i) || this.selectedPad == i - 36 ? BeatstepColorManager.BEATSTEP_BUTTON_STATE_PINK : this.colorManager.getColorIndex(this.keyManager.getColor(i)));
        }
    } else {
        final INoteClip clip = this.getClip();
        // Paint the sequencer steps
        final int step = clip.getCurrentStep();
        final int hiStep = this.isInXRange(step) ? step % SequencerView.NUM_DISPLAY_COLS : -1;
        final int editMidiChannel = this.configuration.getMidiEditChannel();
        for (int col = 0; col < SequencerView.NUM_DISPLAY_COLS; col++) {
            final int y = this.offsetY + this.selectedPad;
            final int map = this.scales.getNoteMatrix()[y];
            final StepState stepState = clip.getStep(editMidiChannel, col, map).getState();
            padGrid.lightEx(col % 8, 1 - col / 8, getSequencerColor(stepState, col == hiStep));
        }
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) StepState(de.mossgrabers.framework.daw.StepState) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 32 with INoteClip

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

the class ClipModule method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final String command, final LinkedList<String> path, final Object value) throws IllegalParameterException, UnknownCommandException, MissingCommandException {
    if (!"clip".equals(command))
        throw new UnknownCommandException(command);
    final String subCommand = getSubCommand(path);
    if ("stopall".equals(subCommand)) {
        this.model.getTrackBank().stop();
        return;
    }
    // Cursor clip related commands
    final INoteClip cursorClip = this.model.getCursorClip();
    switch(subCommand) {
        case "pinned":
            if (value == null)
                cursorClip.togglePinned();
            else
                cursorClip.setPinned(isTrigger(value));
            return;
        case "quantize":
            if (cursorClip.doesExist())
                cursorClip.quantize(1);
            return;
        default:
            // Fall through
            break;
    }
    // Slot bank related commands
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    if (!cursorTrack.doesExist())
        return;
    if ("stop".equals(subCommand)) {
        cursorTrack.stop();
        return;
    }
    final ISlotBank slotBank = cursorTrack.getSlotBank();
    switch(subCommand) {
        case "+":
            slotBank.selectNextItem();
            return;
        case "-":
            slotBank.selectPreviousItem();
            return;
        default:
            // Fall through
            break;
    }
    final Optional<ISlot> selectedSlotOptional = slotBank.getSelectedItem();
    if (selectedSlotOptional.isEmpty())
        return;
    final ISlot selectedSlot = selectedSlotOptional.get();
    switch(subCommand) {
        case "launch":
            selectedSlot.launch();
            return;
        case "record":
            this.model.recordNoteClip(cursorTrack, selectedSlot);
            return;
        case "create":
            this.model.createNoteClip(cursorTrack, selectedSlot, toInteger(value), true);
            return;
        default:
            throw new UnknownCommandException(command);
    }
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) UnknownCommandException(de.mossgrabers.controller.osc.exception.UnknownCommandException) ISlot(de.mossgrabers.framework.daw.data.ISlot) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 33 with INoteClip

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

the class ClipModule method flush.

/**
 * {@inheritDoc}
 */
@Override
public void flush(final boolean dump) {
    final INoteClip cursorClip = this.model.getCursorClip();
    this.writer.sendOSC("/clip/exists", cursorClip.doesExist(), dump);
    this.writer.sendOSC("/clip/pinned", cursorClip.isPinned(), dump);
    ColorEx color = cursorClip.getColor();
    if (color == null)
        color = ColorEx.BLACK;
    this.writer.sendOSCColor("/clip/color", color.getRed(), color.getGreen(), color.getBlue(), dump);
}
Also used : ColorEx(de.mossgrabers.framework.controller.color.ColorEx) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 34 with INoteClip

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

the class AbstractDrumView method handleSequencerArea.

/**
 * Handle button presses in the sequencer area of the note sequencer.
 *
 * @param index The index of the pad
 * @param x The x position of the pad in the sequencer grid
 * @param y The y position of the pad in the sequencer grid
 * @param offsetY The drum offset
 * @param velocity The velocity
 */
protected void handleSequencerArea(final int index, final int x, final int y, final int offsetY, final int velocity) {
    // Toggle the note on up, so we can intercept the long presses
    if (velocity != 0)
        return;
    final INoteClip clip = 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 int vel = this.getVelocity(index);
    if (this.handleSequencerAreaButtonCombinations(clip, channel, step, note, vel))
        return;
    clip.toggleStep(channel, step, note, vel);
}
Also used : INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 35 with INoteClip

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

the class AbstractPolySequencerView method handleSequencerArea.

/**
 * Handle pads pressed in the sequencer area.
 *
 * @param x The x position of the pad
 * @param y The y position of the pad
 */
protected void handleSequencerArea(final int x, final int y) {
    final INoteClip clip = this.getClip();
    final int step = this.numColumns * (this.numRows - 1 - y) + x;
    final int channel = this.configuration.getMidiEditChannel();
    if (this.handleSequencerAreaButtonCombinations(clip, channel, step))
        return;
    if (this.getStep(clip, step).getState() != StepState.OFF) {
        for (int row = 0; row < 128; row++) {
            if (clip.getStep(channel, step, row).getState() != StepState.OFF)
                clip.clearStep(channel, step, row);
        }
    } else {
        for (int row = 0; row < 128; row++) {
            final Integer k = Integer.valueOf(row);
            if (this.noteMemory.containsKey(k)) {
                final Integer vel = this.noteMemory.get(k);
                clip.toggleStep(channel, step, row, this.configuration.isAccentActive() ? this.configuration.getFixedAccentValue() : vel.intValue());
            }
        }
    }
}
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