Search in sources :

Example 1 with NoteMode

use of de.mossgrabers.controller.akai.apc.mode.NoteMode 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) {
    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 mappedNote = this.keyManager.map(y);
        final int editMidiChannel = this.configuration.getMidiEditChannel();
        final StepState state = cursorClip.getStep(editMidiChannel, x, mappedNote).getState();
        if (state == StepState.START) {
            final NoteMode noteMode = (NoteMode) modeManager.get(Modes.NOTE);
            noteMode.setValues(cursorClip, editMidiChannel, x, mappedNote);
            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, 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 2 with NoteMode

use of de.mossgrabers.controller.akai.apc.mode.NoteMode 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)

Aggregations

NoteMode (de.mossgrabers.controller.akai.apc.mode.NoteMode)2 INoteClip (de.mossgrabers.framework.daw.INoteClip)2 StepState (de.mossgrabers.framework.daw.StepState)2 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)2