Search in sources :

Example 1 with LaunchpadCursorCommand

use of de.mossgrabers.launchpad.command.trigger.LaunchpadCursorCommand in project DrivenByMoss by git-moss.

the class LaunchpadControllerSetup method registerTriggerCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerTriggerCommands() {
    final LaunchpadControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    viewManager.registerTriggerCommand(Commands.COMMAND_SHIFT, new ShiftCommand(this.model, surface));
    surface.assignTriggerCommand(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SHIFT, Commands.COMMAND_SHIFT);
    surface.assignTriggerCommand(LaunchpadControlSurface.LAUNCHPAD_MKII_BUTTON_USER, Commands.COMMAND_SHIFT);
    this.addTriggerCommand(Commands.COMMAND_METRONOME, LaunchpadControlSurface.LAUNCHPAD_BUTTON_CLICK, new ClickCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_UNDO, LaunchpadControlSurface.LAUNCHPAD_BUTTON_UNDO, new UndoCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_DELETE, LaunchpadControlSurface.LAUNCHPAD_BUTTON_DELETE, new DeleteCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_QUANTIZE, LaunchpadControlSurface.LAUNCHPAD_BUTTON_QUANTIZE, new QuantizeCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_DUPLICATE, LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE, new ToggleLoopCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_DOUBLE, LaunchpadControlSurface.LAUNCHPAD_BUTTON_DOUBLE, new DoubleCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_RECORD, LaunchpadControlSurface.LAUNCHPAD_BUTTON_RECORD, new RecordCommand<>(this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_PLAY, new PlayCommand<>(this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_NEW, new NewCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SELECT_SESSION_VIEW, surface.getSessionButton(), new SelectSessionViewCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SELECT_PLAY_VIEW, surface.getNoteButton(), new SelectNoteViewCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_DEVICE, surface.getDeviceButton(), new SelectDeviceViewCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_REC_ARM, LaunchpadControlSurface.LAUNCHPAD_BUTTON_REC_ARM, new RecordArmCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_TRACK, LaunchpadControlSurface.LAUNCHPAD_BUTTON_TRACK, new TrackSelectCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_MUTE, LaunchpadControlSurface.LAUNCHPAD_BUTTON_MUTE, new MuteCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SOLO, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SOLO, new SoloCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_VOLUME, LaunchpadControlSurface.LAUNCHPAD_BUTTON_VOLUME, new VolumeCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_PAN_SEND, LaunchpadControlSurface.LAUNCHPAD_BUTTON_PAN, new PanCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SENDS, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SENDS, new SendsCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_STOP_CLIP, LaunchpadControlSurface.LAUNCHPAD_BUTTON_STOP_CLIP, new StopClipCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_DOWN, surface.getDownButtonId(), new LaunchpadCursorCommand(Direction.DOWN, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_UP, surface.getUpButtonId(), new LaunchpadCursorCommand(Direction.UP, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_LEFT, surface.getLeftButtonId(), new LaunchpadCursorCommand(Direction.LEFT, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_RIGHT, surface.getRightButtonId(), new LaunchpadCursorCommand(Direction.RIGHT, this.model, surface));
    if (this.isPro) {
        this.addTriggerCommand(Commands.COMMAND_SCENE1, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE1, new LPSceneCommand(7, this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_SCENE2, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE2, new LPSceneCommand(6, this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_SCENE3, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE3, new LPSceneCommand(5, this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_SCENE4, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE4, new LPSceneCommand(4, this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_SCENE5, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE5, new LPSceneCommand(3, this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_SCENE6, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE6, new LPSceneCommand(2, this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_SCENE7, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE7, new LPSceneCommand(1, this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_SCENE8, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE8, new LPSceneCommand(0, this.model, surface));
    } else {
        this.addNoteCommand(Commands.COMMAND_SCENE1, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE1, new LPSceneCommand(7, this.model, surface));
        this.addNoteCommand(Commands.COMMAND_SCENE2, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE2, new LPSceneCommand(6, this.model, surface));
        this.addNoteCommand(Commands.COMMAND_SCENE3, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE3, new LPSceneCommand(5, this.model, surface));
        this.addNoteCommand(Commands.COMMAND_SCENE4, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE4, new LPSceneCommand(4, this.model, surface));
        this.addNoteCommand(Commands.COMMAND_SCENE5, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE5, new LPSceneCommand(3, this.model, surface));
        this.addNoteCommand(Commands.COMMAND_SCENE6, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE6, new LPSceneCommand(2, this.model, surface));
        this.addNoteCommand(Commands.COMMAND_SCENE7, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE7, new LPSceneCommand(1, this.model, surface));
        this.addNoteCommand(Commands.COMMAND_SCENE8, LaunchpadControlSurface.LAUNCHPAD_BUTTON_SCENE8, new LPSceneCommand(0, this.model, surface));
    }
}
Also used : ShiftCommand(de.mossgrabers.launchpad.command.trigger.ShiftCommand) MuteCommand(de.mossgrabers.launchpad.command.trigger.MuteCommand) ViewManager(de.mossgrabers.framework.view.ViewManager) SelectDeviceViewCommand(de.mossgrabers.launchpad.command.trigger.SelectDeviceViewCommand) RecordArmCommand(de.mossgrabers.launchpad.command.trigger.RecordArmCommand) ClickCommand(de.mossgrabers.launchpad.command.trigger.ClickCommand) SelectSessionViewCommand(de.mossgrabers.launchpad.command.trigger.SelectSessionViewCommand) PanCommand(de.mossgrabers.launchpad.command.trigger.PanCommand) DoubleCommand(de.mossgrabers.launchpad.command.trigger.DoubleCommand) SoloCommand(de.mossgrabers.launchpad.command.trigger.SoloCommand) VolumeCommand(de.mossgrabers.launchpad.command.trigger.VolumeCommand) SendsCommand(de.mossgrabers.launchpad.command.trigger.SendsCommand) LPSceneCommand(de.mossgrabers.launchpad.command.trigger.LPSceneCommand) StopClipCommand(de.mossgrabers.launchpad.command.trigger.StopClipCommand) LaunchpadControlSurface(de.mossgrabers.launchpad.controller.LaunchpadControlSurface) LaunchpadCursorCommand(de.mossgrabers.launchpad.command.trigger.LaunchpadCursorCommand) SelectNoteViewCommand(de.mossgrabers.launchpad.command.trigger.SelectNoteViewCommand) TrackSelectCommand(de.mossgrabers.launchpad.command.trigger.TrackSelectCommand)

Example 2 with LaunchpadCursorCommand

use of de.mossgrabers.launchpad.command.trigger.LaunchpadCursorCommand in project DrivenByMoss by git-moss.

the class LaunchpadControllerSetup method updateButtons.

private void updateButtons() {
    final LaunchpadControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final View activeView = viewManager.getActiveView();
    if (activeView != null) {
        ((LaunchpadCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
        ((SceneView) activeView).updateSceneButtons();
    }
    if (!this.isPro) {
        surface.setButton(LaunchpadControlSurface.LAUNCHPAD_MKII_BUTTON_USER, surface.isUserPressed() ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
        return;
    }
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_PRO_BUTTON_USER, LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
    final boolean isShift = surface.isShiftPressed();
    final ITrack selTrack = this.model.getCurrentTrackBank().getSelectedTrack();
    final int index = selTrack == null ? -1 : selTrack.getIndex();
    final ModeManager modeManager = surface.getModeManager();
    final ITransport transport = this.model.getTransport();
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SHIFT, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_CLICK, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : transport.isMetronomeOn() ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_UNDO, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DELETE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_QUANTIZE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DOUBLE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    final boolean flipRecord = surface.getConfiguration().isFlipRecord();
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_RECORD, isShift && !flipRecord || !isShift && flipRecord ? transport.isLauncherOverdub() ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : LaunchpadColors.LAUNCHPAD_COLOR_RED_AMBER : transport.isRecording() ? LaunchpadColors.LAUNCHPAD_COLOR_RED_HI : LaunchpadColors.LAUNCHPAD_COLOR_RED_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_REC_ARM, modeManager.isActiveMode(Modes.MODE_REC_ARM) ? LaunchpadColors.LAUNCHPAD_COLOR_RED : index == 0 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_TRACK, modeManager.isActiveMode(Modes.MODE_TRACK_SELECT) ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN : index == 1 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_MUTE, modeManager.isActiveMode(Modes.MODE_MUTE) ? LaunchpadColors.LAUNCHPAD_COLOR_YELLOW : index == 2 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SOLO, modeManager.isActiveMode(Modes.MODE_SOLO) ? LaunchpadColors.LAUNCHPAD_COLOR_BLUE : index == 3 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_VOLUME, viewManager.isActiveView(Views.VIEW_VOLUME) ? LaunchpadColors.LAUNCHPAD_COLOR_CYAN : index == 4 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_PAN, viewManager.isActiveView(Views.VIEW_PAN) ? LaunchpadColors.LAUNCHPAD_COLOR_SKY : index == 5 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SENDS, viewManager.isActiveView(Views.VIEW_SENDS) ? LaunchpadColors.LAUNCHPAD_COLOR_ORCHID : index == 6 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_STOP_CLIP, modeManager.isActiveMode(Modes.MODE_STOP_CLIP) ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : index == 7 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    // Update the front LED with the color of the current track
    final ITrack track = index == -1 ? null : this.model.getCurrentTrackBank().getTrack(index);
    final int color = track != null && track.doesExist() ? this.colorManager.getColor(BitwigColors.getColorIndex(track.getColor())) : 0;
    surface.sendLaunchpadSysEx("0A 63 " + StringUtils.toHexStr(color));
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITransport(de.mossgrabers.framework.daw.ITransport) SceneView(de.mossgrabers.framework.view.SceneView) ViewManager(de.mossgrabers.framework.view.ViewManager) VolumeView(de.mossgrabers.launchpad.view.VolumeView) SessionView(de.mossgrabers.launchpad.view.SessionView) SequencerView(de.mossgrabers.launchpad.view.SequencerView) SceneView(de.mossgrabers.framework.view.SceneView) DeviceView(de.mossgrabers.launchpad.view.DeviceView) View(de.mossgrabers.framework.view.View) PanView(de.mossgrabers.launchpad.view.PanView) RaindropsView(de.mossgrabers.launchpad.view.RaindropsView) BrowserView(de.mossgrabers.launchpad.view.BrowserView) DrumView(de.mossgrabers.launchpad.view.DrumView) SendsView(de.mossgrabers.launchpad.view.SendsView) ShiftView(de.mossgrabers.launchpad.view.ShiftView) PlayView(de.mossgrabers.launchpad.view.PlayView) LaunchpadControlSurface(de.mossgrabers.launchpad.controller.LaunchpadControlSurface) LaunchpadCursorCommand(de.mossgrabers.launchpad.command.trigger.LaunchpadCursorCommand) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

ViewManager (de.mossgrabers.framework.view.ViewManager)2 LaunchpadCursorCommand (de.mossgrabers.launchpad.command.trigger.LaunchpadCursorCommand)2 LaunchpadControlSurface (de.mossgrabers.launchpad.controller.LaunchpadControlSurface)2 ITransport (de.mossgrabers.framework.daw.ITransport)1 ITrack (de.mossgrabers.framework.daw.data.ITrack)1 ModeManager (de.mossgrabers.framework.mode.ModeManager)1 SceneView (de.mossgrabers.framework.view.SceneView)1 View (de.mossgrabers.framework.view.View)1 ClickCommand (de.mossgrabers.launchpad.command.trigger.ClickCommand)1 DoubleCommand (de.mossgrabers.launchpad.command.trigger.DoubleCommand)1 LPSceneCommand (de.mossgrabers.launchpad.command.trigger.LPSceneCommand)1 MuteCommand (de.mossgrabers.launchpad.command.trigger.MuteCommand)1 PanCommand (de.mossgrabers.launchpad.command.trigger.PanCommand)1 RecordArmCommand (de.mossgrabers.launchpad.command.trigger.RecordArmCommand)1 SelectDeviceViewCommand (de.mossgrabers.launchpad.command.trigger.SelectDeviceViewCommand)1 SelectNoteViewCommand (de.mossgrabers.launchpad.command.trigger.SelectNoteViewCommand)1 SelectSessionViewCommand (de.mossgrabers.launchpad.command.trigger.SelectSessionViewCommand)1 SendsCommand (de.mossgrabers.launchpad.command.trigger.SendsCommand)1 ShiftCommand (de.mossgrabers.launchpad.command.trigger.ShiftCommand)1 SoloCommand (de.mossgrabers.launchpad.command.trigger.SoloCommand)1