Search in sources :

Example 1 with P2ButtonCommand

use of de.mossgrabers.controller.novation.sl.command.trigger.P2ButtonCommand in project DrivenByMoss by git-moss.

the class SLControllerSetup method registerTriggerCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerTriggerCommands() {
    final SLControlSurface surface = this.getSurface();
    // Needs to be before the switch to Automap to catch the success response
    this.addButton(ButtonID.CONTROL, "DAW Online", (event, velocity) -> surface.setDAWConnected(velocity > 0), SLControlSurface.MKI_CC_OFF_ONLINE_MESSAGE, surface::isDAWConnected);
    surface.sendStartup();
    for (int i = 0; i < 8; i++) {
        final int index = i + 1;
        final ButtonID buttonID1 = ButtonID.get(ButtonID.ROW1_1, i);
        final ButtonID buttonID2 = ButtonID.get(ButtonID.ROW2_1, i);
        final ButtonID buttonID3 = ButtonID.get(ButtonID.ROW3_1, i);
        final ButtonID buttonID4 = ButtonID.get(ButtonID.ROW4_1, i);
        final ButtonID buttonID5 = ButtonID.get(ButtonID.ROW_SELECT_1, i);
        this.addButton(buttonID1, "Row 1-" + index, new ButtonRowViewCommand<>(0, i, this.model, surface), SLControlSurface.MKII_BUTTON_ROW1_1 + i, () -> this.getViewButtonColor(buttonID1));
        this.addButton(buttonID2, "Row 2-" + index, new ButtonRowViewCommand<>(1, i, this.model, surface), SLControlSurface.MKII_BUTTON_ROW2_1 + i, () -> this.getViewButtonColor(buttonID2));
        this.addButton(buttonID3, "Row 3-" + index, new ButtonRowViewCommand<>(2, i, this.model, surface), SLControlSurface.MKII_BUTTON_ROW3_1 + i, () -> this.getViewButtonColor(buttonID3));
        this.addButton(buttonID4, "Row 4-" + index, new ButtonRowViewCommand<>(3, i, this.model, surface), SLControlSurface.MKII_BUTTON_ROW4_1 + i, () -> this.getViewButtonColor(buttonID4));
        this.addButton(buttonID5, "Select " + index, new ButtonRowSelectCommand<>(i, this.model, surface), SLControlSurface.MKII_BUTTON_ROWSEL1 + i, () -> this.getViewButtonColor(buttonID5));
    }
    this.addButton(ButtonID.REWIND, "<<", new ButtonRowViewCommand<>(4, 0, this.model, surface), SLControlSurface.MKII_BUTTON_REWIND);
    this.addButton(ButtonID.FORWARD, ">>", new ButtonRowViewCommand<>(4, 1, this.model, surface), SLControlSurface.MKII_BUTTON_FORWARD);
    this.addButton(ButtonID.STOP, "Stop", new ButtonRowViewCommand<>(4, 2, this.model, surface), SLControlSurface.MKII_BUTTON_STOP);
    this.addButton(ButtonID.PLAY, "Play", new ButtonRowViewCommand<>(4, 3, this.model, surface), SLControlSurface.MKII_BUTTON_PLAY);
    this.addButton(ButtonID.LOOP, "Loop", new ButtonRowViewCommand<>(4, 4, this.model, surface), SLControlSurface.MKII_BUTTON_LOOP);
    this.addButton(ButtonID.RECORD, "Record", new ButtonRowViewCommand<>(4, 6, this.model, surface), SLControlSurface.MKII_BUTTON_RECORD);
    this.addButton(ButtonID.ARROW_LEFT, "Left", new P1ButtonCommand(true, this.model, surface), SLControlSurface.MKII_BUTTON_P1_UP);
    this.addButton(ButtonID.ARROW_RIGHT, "Right", new P1ButtonCommand(false, this.model, surface), SLControlSurface.MKII_BUTTON_P1_DOWN);
    this.addButton(ButtonID.ARROW_UP, "Up", new P2ButtonCommand(true, this.model, surface), SLControlSurface.MKII_BUTTON_P2_UP);
    this.addButton(ButtonID.ARROW_DOWN, "Down", new P2ButtonCommand(false, this.model, surface), SLControlSurface.MKII_BUTTON_P2_DOWN);
    this.addButton(ButtonID.NOTE, "Play View", new TransportButtonCommand(this.model, surface), SLControlSurface.MKII_BUTTON_TRANSPORT);
}
Also used : TransportButtonCommand(de.mossgrabers.controller.novation.sl.command.trigger.TransportButtonCommand) ButtonID(de.mossgrabers.framework.controller.ButtonID) P1ButtonCommand(de.mossgrabers.controller.novation.sl.command.trigger.P1ButtonCommand) P2ButtonCommand(de.mossgrabers.controller.novation.sl.command.trigger.P2ButtonCommand) SLControlSurface(de.mossgrabers.controller.novation.sl.controller.SLControlSurface)

Example 2 with P2ButtonCommand

use of de.mossgrabers.controller.novation.sl.command.trigger.P2ButtonCommand in project DrivenByMoss by git-moss.

the class PlayView method onButtonP1.

/**
 * {@inheritDoc}
 */
@Override
public void onButtonP1(final boolean isUp, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final Modes activeModeId = this.surface.getModeManager().getActiveID();
    if (Modes.SESSION == activeModeId) {
        if (isUp)
            this.model.getSceneBank().selectNextPage();
        else
            this.model.getSceneBank().selectPreviousPage();
        return;
    }
    if (Modes.VOLUME.equals(activeModeId)) {
        new P2ButtonCommand(isUp, this.model, this.surface).execute(ButtonEvent.DOWN, 127);
        return;
    }
    if (Modes.TRACK.equals(activeModeId)) {
        new ButtonRowSelectCommand<>(3, this.model, this.surface).execute(ButtonEvent.DOWN, 127);
        return;
    }
    if (Modes.PLAY_OPTIONS.equals(activeModeId))
        return;
    final SLParameterMode mode = (SLParameterMode) this.surface.getModeManager().get(Modes.DEVICE_PARAMS);
    if (isUp)
        mode.selectNextItemPage();
    else
        mode.selectPreviousItemPage();
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) P2ButtonCommand(de.mossgrabers.controller.novation.sl.command.trigger.P2ButtonCommand) SLParameterMode(de.mossgrabers.controller.novation.sl.mode.device.SLParameterMode)

Aggregations

P2ButtonCommand (de.mossgrabers.controller.novation.sl.command.trigger.P2ButtonCommand)2 P1ButtonCommand (de.mossgrabers.controller.novation.sl.command.trigger.P1ButtonCommand)1 TransportButtonCommand (de.mossgrabers.controller.novation.sl.command.trigger.TransportButtonCommand)1 SLControlSurface (de.mossgrabers.controller.novation.sl.controller.SLControlSurface)1 SLParameterMode (de.mossgrabers.controller.novation.sl.mode.device.SLParameterMode)1 ButtonID (de.mossgrabers.framework.controller.ButtonID)1 Modes (de.mossgrabers.framework.mode.Modes)1