Search in sources :

Example 1 with APCCursorCommand

use of de.mossgrabers.apc.command.trigger.APCCursorCommand in project DrivenByMoss by git-moss.

the class APCControllerSetup method registerTriggerCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerTriggerCommands() {
    final APCControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    this.addTriggerCommand(Commands.COMMAND_SHIFT, APCControlSurface.APC_BUTTON_SHIFT, new ShiftCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_PLAY, APCControlSurface.APC_BUTTON_PLAY, new PlayCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_RECORD, APCControlSurface.APC_BUTTON_RECORD, new APCRecordCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_TAP_TEMPO, APCControlSurface.APC_BUTTON_TAP_TEMPO, new TapTempoCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_QUANTIZE, APCControlSurface.APC_BUTTON_REC_QUANT, new APCQuantizeCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_PAN_SEND, APCControlSurface.APC_BUTTON_PAN, new ModeSelectCommand<>(Modes.MODE_PAN, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_MASTERTRACK, APCControlSurface.APC_BUTTON_MASTER, new MasterCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_STOP_ALL_CLIPS, APCControlSurface.APC_BUTTON_STOP_ALL_CLIPS, new StopAllClipsCommand<>(this.model, surface));
    this.addTriggerCommand(Integer.valueOf(COMMAND_SEND), APCControlSurface.APC_BUTTON_SEND_A, new SendCommand(0, this.model, surface));
    this.addTriggerCommand(Integer.valueOf(COMMAND_SEND + 1), APCControlSurface.APC_BUTTON_SEND_B, new SendCommand(1, this.model, surface));
    for (int i = 0; i < 8; i++) {
        final Integer selectCommand = Integer.valueOf(COMMAND_SELECT + i);
        final Integer soloCommand = Integer.valueOf(COMMAND_SOLO + i);
        final Integer muteCommand = Integer.valueOf(COMMAND_MUTE + i);
        final Integer recArmCommand = Integer.valueOf(COMMAND_REC_ARM + i);
        final Integer crossfadeCommand = Integer.valueOf(COMMAND_CROSSFADER + i);
        final Integer stopClipCommand = Integer.valueOf(COMMAND_STOP_CLIP + i);
        viewManager.registerTriggerCommand(selectCommand, new SelectCommand(i, this.model, surface));
        viewManager.registerTriggerCommand(soloCommand, new SoloCommand<>(i, this.model, surface));
        viewManager.registerTriggerCommand(muteCommand, new MuteCommand<>(i, this.model, surface));
        viewManager.registerTriggerCommand(recArmCommand, new RecArmCommand(i, this.model, surface));
        viewManager.registerTriggerCommand(crossfadeCommand, new CrossfadeModeCommand<>(i, this.model, surface));
        viewManager.registerTriggerCommand(stopClipCommand, new StopClipCommand<>(i, this.model, surface));
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_TRACK_SELECTION, i, selectCommand);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_SOLO, i, soloCommand);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_ACTIVATOR, i, muteCommand);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_RECORD_ARM, i, recArmCommand);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_A_B, i, crossfadeCommand);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_CLIP_STOP, i, stopClipCommand);
    }
    viewManager.registerTriggerCommand(COMMAND_DEVICE_LEFT, new DeviceLeftCommand(this.model, surface));
    viewManager.registerTriggerCommand(COMMAND_DEVICE_RIGHT, new DeviceRightCommand(this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_CLIP, new SessionRecordCommand(this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_METRONOME, new MetronomeCommand<>(this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_NUDGE_MINUS, new NudgeCommand(true, this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_NUDGE_PLUS, new NudgeCommand(false, this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_LAYOUT, new PanelLayoutCommand(this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_DEVICE_ON_OFF, new DeviceOnOffCommand<>(this.model, surface));
    viewManager.registerTriggerCommand(COMMAND_TOGGLE_DEVICES, new PaneCommand<>(Panels.DEVICE, this.model, surface));
    if (this.isMkII) {
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_SESSION, Commands.COMMAND_CLIP);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_SEND_C, Commands.COMMAND_METRONOME);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_NUDGE_MINUS, Commands.COMMAND_NUDGE_MINUS);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_NUDGE_PLUS, Commands.COMMAND_NUDGE_PLUS);
        // Detail View
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_METRONOME, Commands.COMMAND_LAYOUT);
        // Device on/off
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_DETAIL_VIEW, Commands.COMMAND_DEVICE_ON_OFF);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_CLIP_TRACK, COMMAND_DEVICE_LEFT);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, COMMAND_DEVICE_RIGHT);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, COMMAND_TOGGLE_DEVICES);
    } else {
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, Commands.COMMAND_CLIP);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_METRONOME, Commands.COMMAND_METRONOME);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_NUDGE_PLUS, Commands.COMMAND_NUDGE_MINUS);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_NUDGE_MINUS, Commands.COMMAND_NUDGE_PLUS);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_DETAIL_VIEW, Commands.COMMAND_LAYOUT);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, Commands.COMMAND_DEVICE_ON_OFF);
        surface.assignTriggerCommand(APCControlSurface.APC_BUTTON_CLIP_TRACK, COMMAND_TOGGLE_DEVICES);
        this.addTriggerCommand(Commands.COMMAND_STOP, APCControlSurface.APC_BUTTON_STOP, new StopCommand<>(this.model, surface));
        this.addTriggerCommand(Integer.valueOf(COMMAND_SEND + 2), APCControlSurface.APC_BUTTON_SEND_C, new SendCommand(2, this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_NEW, APCControlSurface.APC_FOOTSWITCH_2, new NewCommand<>(this.model, surface));
    }
    this.addTriggerCommand(Commands.COMMAND_BROWSE, APCControlSurface.APC_BUTTON_BANK, new APCBrowserCommand(this.model, surface));
    this.addTriggerCommand(COMMAND_BANK_LEFT, APCControlSurface.APC_BUTTON_DEVICE_LEFT, new BankLeftCommand(this.model, surface));
    this.addTriggerCommand(COMMAND_BANK_RIGHT, APCControlSurface.APC_BUTTON_DEVICE_RIGHT, new BankRightCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_DOWN, surface.getDownButtonId(), new APCCursorCommand(Direction.DOWN, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_UP, surface.getUpButtonId(), new APCCursorCommand(Direction.UP, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_LEFT, surface.getLeftButtonId(), new APCCursorCommand(Direction.LEFT, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_RIGHT, surface.getRightButtonId(), new APCCursorCommand(Direction.RIGHT, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SCENE1, APCControlSurface.APC_BUTTON_SCENE_LAUNCH_1, new SceneCommand<>(7, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SCENE2, APCControlSurface.APC_BUTTON_SCENE_LAUNCH_2, new SceneCommand<>(6, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SCENE3, APCControlSurface.APC_BUTTON_SCENE_LAUNCH_3, new SceneCommand<>(5, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SCENE4, APCControlSurface.APC_BUTTON_SCENE_LAUNCH_4, new SceneCommand<>(4, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SCENE5, APCControlSurface.APC_BUTTON_SCENE_LAUNCH_5, new SceneCommand<>(3, this.model, surface));
}
Also used : ShiftCommand(de.mossgrabers.apc.command.trigger.ShiftCommand) RecArmCommand(de.mossgrabers.apc.command.trigger.RecArmCommand) NudgeCommand(de.mossgrabers.apc.command.trigger.NudgeCommand) APCCursorCommand(de.mossgrabers.apc.command.trigger.APCCursorCommand) ViewManager(de.mossgrabers.framework.view.ViewManager) BankRightCommand(de.mossgrabers.apc.command.trigger.BankRightCommand) MasterCommand(de.mossgrabers.apc.command.trigger.MasterCommand) DeviceRightCommand(de.mossgrabers.apc.command.trigger.DeviceRightCommand) SessionRecordCommand(de.mossgrabers.apc.command.trigger.SessionRecordCommand) SendCommand(de.mossgrabers.apc.command.trigger.SendCommand) APCQuantizeCommand(de.mossgrabers.apc.command.trigger.APCQuantizeCommand) ModeSelectCommand(de.mossgrabers.framework.command.trigger.ModeSelectCommand) SelectCommand(de.mossgrabers.apc.command.trigger.SelectCommand) PanelLayoutCommand(de.mossgrabers.apc.command.trigger.PanelLayoutCommand) APCRecordCommand(de.mossgrabers.apc.command.trigger.APCRecordCommand) APCControlSurface(de.mossgrabers.apc.controller.APCControlSurface) APCBrowserCommand(de.mossgrabers.apc.command.trigger.APCBrowserCommand) BankLeftCommand(de.mossgrabers.apc.command.trigger.BankLeftCommand) DeviceLeftCommand(de.mossgrabers.apc.command.trigger.DeviceLeftCommand)

Example 2 with APCCursorCommand

use of de.mossgrabers.apc.command.trigger.APCCursorCommand in project DrivenByMoss by git-moss.

the class APCControllerSetup method updateButtons.

private void updateButtons() {
    final APCControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final View activeView = viewManager.getActiveView();
    if (activeView != null) {
        ((APCCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
        ((SceneView) activeView).updateSceneButtons();
    }
    final boolean isShift = surface.isShiftPressed();
    final boolean isSendA = surface.isPressed(APCControlSurface.APC_BUTTON_SEND_A);
    final ITransport t = this.model.getTransport();
    surface.updateButton(APCControlSurface.APC_BUTTON_PLAY, t.isPlaying() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    surface.updateButton(APCControlSurface.APC_BUTTON_RECORD, t.isRecording() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    // Activator, Solo, Record Arm
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selTrack = tb.getSelectedTrack();
    final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
    final int clipLength = surface.getConfiguration().getNewClipLength();
    final ModeManager modeManager = surface.getModeManager();
    for (int i = 0; i < 8; i++) {
        final ITrack track = tb.getTrack(i);
        boolean isOn;
        if (isShift)
            isOn = i == clipLength;
        else
            isOn = isSendA ? modeManager.isActiveMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + i)) : i == selIndex;
        surface.updateButtonEx(APCControlSurface.APC_BUTTON_TRACK_SELECTION, i, isOn ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButtonEx(APCControlSurface.APC_BUTTON_SOLO, i, track.doesExist() && (isShift ? track.isAutoMonitor() : track.isSolo()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButtonEx(APCControlSurface.APC_BUTTON_ACTIVATOR, i, track.doesExist() && (isShift ? track.isMonitor() : !track.isMute()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        if (this.isMkII) {
            surface.updateButtonEx(APCControlSurface.APC_BUTTON_A_B, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
            surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        } else {
            if (isShift)
                surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
            else
                surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        }
    }
    surface.updateButton(APCControlSurface.APC_BUTTON_MASTER, this.model.getMasterTrack().isSelected() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    final ICursorDevice device = this.model.getCursorDevice();
    if (this.isMkII) {
        surface.updateButton(APCControlSurface.APC_BUTTON_SESSION, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_SEND_C, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_BANK, this.model.getBrowser().isActive() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    } else {
        surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
    }
    this.updateDeviceKnobs();
}
Also used : APCControlSurface(de.mossgrabers.apc.controller.APCControlSurface) ITrack(de.mossgrabers.framework.daw.data.ITrack) APCCursorCommand(de.mossgrabers.apc.command.trigger.APCCursorCommand) ITransport(de.mossgrabers.framework.daw.ITransport) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) SceneView(de.mossgrabers.framework.view.SceneView) ViewManager(de.mossgrabers.framework.view.ViewManager) SessionView(de.mossgrabers.apc.view.SessionView) ShiftView(de.mossgrabers.apc.view.ShiftView) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) DrumView(de.mossgrabers.apc.view.DrumView) SequencerView(de.mossgrabers.apc.view.SequencerView) PlayView(de.mossgrabers.apc.view.PlayView) RaindropsView(de.mossgrabers.apc.view.RaindropsView) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

APCCursorCommand (de.mossgrabers.apc.command.trigger.APCCursorCommand)2 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)2 ViewManager (de.mossgrabers.framework.view.ViewManager)2 APCBrowserCommand (de.mossgrabers.apc.command.trigger.APCBrowserCommand)1 APCQuantizeCommand (de.mossgrabers.apc.command.trigger.APCQuantizeCommand)1 APCRecordCommand (de.mossgrabers.apc.command.trigger.APCRecordCommand)1 BankLeftCommand (de.mossgrabers.apc.command.trigger.BankLeftCommand)1 BankRightCommand (de.mossgrabers.apc.command.trigger.BankRightCommand)1 DeviceLeftCommand (de.mossgrabers.apc.command.trigger.DeviceLeftCommand)1 DeviceRightCommand (de.mossgrabers.apc.command.trigger.DeviceRightCommand)1 MasterCommand (de.mossgrabers.apc.command.trigger.MasterCommand)1 NudgeCommand (de.mossgrabers.apc.command.trigger.NudgeCommand)1 PanelLayoutCommand (de.mossgrabers.apc.command.trigger.PanelLayoutCommand)1 RecArmCommand (de.mossgrabers.apc.command.trigger.RecArmCommand)1 SelectCommand (de.mossgrabers.apc.command.trigger.SelectCommand)1 SendCommand (de.mossgrabers.apc.command.trigger.SendCommand)1 SessionRecordCommand (de.mossgrabers.apc.command.trigger.SessionRecordCommand)1 ShiftCommand (de.mossgrabers.apc.command.trigger.ShiftCommand)1 DrumView (de.mossgrabers.apc.view.DrumView)1 PlayView (de.mossgrabers.apc.view.PlayView)1