Search in sources :

Example 31 with ModeManager

use of de.mossgrabers.framework.featuregroup.ModeManager 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 32 with ModeManager

use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.

the class SendModeCommand method handleExecute.

private void handleExecute(final ButtonEvent event, final int index) {
    // No Sends on FX tracks
    if (event != ButtonEvent.DOWN || this.model.isEffectTrackBankActive())
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    modeManager.setActive(Modes.get(Modes.SEND1, index));
    String modeName = "Send " + (index + 1) + ": ";
    final ITrackBank trackBank = this.model.getTrackBank();
    Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
    if (selectedTrack.isEmpty()) {
        final ITrack item = trackBank.getItem(0);
        selectedTrack = item.doesExist() ? Optional.of(item) : Optional.empty();
    }
    if (selectedTrack.isPresent())
        modeName += selectedTrack.get().getSendBank().getItem(index).getName();
    else
        modeName += "-";
    this.model.getHost().showNotification(modeName);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 33 with ModeManager

use of de.mossgrabers.framework.featuregroup.ModeManager 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 34 with ModeManager

use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.

the class DrumSequencerSelectCommand method executeNormal.

/**
 * {@inheritDoc}}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    final ModeManager modeManager = this.surface.getModeManager();
    // Toggle note mode
    if (this.surface.isPressed(ButtonID.ALT)) {
        if (event == ButtonEvent.DOWN) {
            this.surface.setTriggerConsumed(ButtonID.ALT);
            if (modeManager.isActive(Modes.NOTE))
                modeManager.restore();
            else
                modeManager.setActive(Modes.NOTE);
            this.surface.getDisplay().notify("Edit Notes: " + (modeManager.isActive(Modes.NOTE) ? "On" : "Off"));
            ((INoteMode) modeManager.get(Modes.NOTE)).clearNotes();
        }
        return;
    }
    super.executeNormal(event);
    if (event == ButtonEvent.UP) {
        ((INoteMode) modeManager.get(Modes.NOTE)).clearNotes();
        final ITrack cursorTrack = this.model.getCursorTrack();
        if (cursorTrack.doesExist()) {
            final ViewManager viewManager = this.surface.getViewManager();
            viewManager.setPreferredView(cursorTrack.getPosition(), viewManager.getActiveID());
        }
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) INoteMode(de.mossgrabers.framework.mode.INoteMode) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 35 with ModeManager

use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.

the class FireSelectButtonCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (velocity > 0)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActive(Modes.NOTE)) {
        ((NoteMode) modeManager.get(Modes.NOTE)).resetTranspose();
        return;
    }
    if (modeManager.isActive(Modes.BROWSER)) {
        ((FireBrowserCommand) this.surface.getButton(ButtonID.BROWSE).getCommand()).discardBrowser(true);
        return;
    }
    final FireConfiguration configuration = this.surface.getConfiguration();
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (modeManager.isActive(Modes.DEVICE_PARAMS) && configuration.isDeleteModeActive()) {
        cursorDevice.remove();
        configuration.toggleDeleteModeActive();
        return;
    }
    cursorDevice.toggleWindowOpen();
}
Also used : NoteMode(de.mossgrabers.controller.akai.fire.mode.NoteMode) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) FireConfiguration(de.mossgrabers.controller.akai.fire.FireConfiguration)

Aggregations

ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)90 Modes (de.mossgrabers.framework.mode.Modes)22 ITrack (de.mossgrabers.framework.daw.data.ITrack)15 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)15 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)11 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)10 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)6 MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)4 StudioEncoderModeManager (de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)4 EditNoteMode (de.mossgrabers.controller.ni.maschine.mk3.mode.EditNoteMode)4 StepState (de.mossgrabers.framework.daw.StepState)4 INoteMode (de.mossgrabers.framework.mode.INoteMode)4 IMode (de.mossgrabers.framework.featuregroup.IMode)3 NoteMode (de.mossgrabers.controller.akai.apc.mode.NoteMode)2 MCUConfiguration (de.mossgrabers.controller.mackie.mcu.MCUConfiguration)2 SLControlSurface (de.mossgrabers.controller.novation.sl.controller.SLControlSurface)2 SLMkIIIControlSurface (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)2 IHwRelativeKnob (de.mossgrabers.framework.controller.hardware.IHwRelativeKnob)2 INoteClip (de.mossgrabers.framework.daw.INoteClip)2