Search in sources :

Example 1 with TransportButtonCommand

use of de.mossgrabers.controller.novation.sl.command.trigger.TransportButtonCommand 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)

Aggregations

P1ButtonCommand (de.mossgrabers.controller.novation.sl.command.trigger.P1ButtonCommand)1 P2ButtonCommand (de.mossgrabers.controller.novation.sl.command.trigger.P2ButtonCommand)1 TransportButtonCommand (de.mossgrabers.controller.novation.sl.command.trigger.TransportButtonCommand)1 SLControlSurface (de.mossgrabers.controller.novation.sl.controller.SLControlSurface)1 ButtonID (de.mossgrabers.framework.controller.ButtonID)1