Search in sources :

Example 1 with PushCursorCommand

use of de.mossgrabers.push.command.trigger.PushCursorCommand in project DrivenByMoss by git-moss.

the class PushControllerSetup method registerTriggerCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerTriggerCommands() {
    final PushControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    this.addTriggerCommand(Commands.COMMAND_PLAY, PushControlSurface.PUSH_BUTTON_PLAY, new PlayCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_RECORD, PushControlSurface.PUSH_BUTTON_RECORD, new RecordCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_NEW, PushControlSurface.PUSH_BUTTON_NEW, new NewCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_DUPLICATE, PushControlSurface.PUSH_BUTTON_DUPLICATE, new DuplicateCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_AUTOMATION, PushControlSurface.PUSH_BUTTON_AUTOMATION, new AutomationCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_FIXED_LENGTH, PushControlSurface.PUSH_BUTTON_FIXED_LENGTH, new FixedLengthCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_QUANTIZE, PushControlSurface.PUSH_BUTTON_QUANTIZE, new PushQuantizeCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_DELETE, PushControlSurface.PUSH_BUTTON_DELETE, new DeleteCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_DOUBLE, PushControlSurface.PUSH_BUTTON_DOUBLE, new DoubleCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_UNDO, PushControlSurface.PUSH_BUTTON_UNDO, new UndoCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_DEVICE, PushControlSurface.PUSH_BUTTON_DEVICE, new DeviceCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_BROWSE, PushControlSurface.PUSH_BUTTON_BROWSE, new BrowserCommand<>(Modes.MODE_BROWSER, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_TRACK, PushControlSurface.PUSH_BUTTON_TRACK, new TrackCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_CLIP, PushControlSurface.PUSH_BUTTON_CLIP, new ClipCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_VOLUME, PushControlSurface.PUSH_BUTTON_VOLUME, new VolumeCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_PAN_SEND, PushControlSurface.PUSH_BUTTON_PAN_SEND, new PanSendCommand(this.model, surface));
    for (int i = 0; i < 8; i++) {
        this.addTriggerCommand(Integer.valueOf(Commands.COMMAND_ROW1_1.intValue() + i), PushControlSurface.PUSH_BUTTON_ROW1_1 + i, new ButtonRowModeCommand<>(0, i, this.model, surface));
        this.addTriggerCommand(Integer.valueOf(Commands.COMMAND_ROW2_1.intValue() + i), PushControlSurface.PUSH_BUTTON_ROW2_1 + i, new ButtonRowModeCommand<>(1, i, this.model, surface));
        this.addTriggerCommand(Integer.valueOf(Commands.COMMAND_SCENE1.intValue() + i), PushControlSurface.PUSH_BUTTON_SCENE1 + i, new SceneCommand<>(i, this.model, surface));
    }
    this.addTriggerCommand(Commands.COMMAND_SHIFT, PushControlSurface.PUSH_BUTTON_SHIFT, new ShiftCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_LAYOUT, PushControlSurface.PUSH_BUTTON_LAYOUT, new LayoutCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SELECT, PushControlSurface.PUSH_BUTTON_SELECT, new SelectCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_TAP_TEMPO, PushControlSurface.PUSH_BUTTON_TAP, new TapTempoCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_METRONOME, PushControlSurface.PUSH_BUTTON_METRONOME, new MetronomeCommand<>(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_MASTERTRACK, PushControlSurface.PUSH_BUTTON_MASTER, new MastertrackCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_PAGE_LEFT, PushControlSurface.PUSH_BUTTON_DEVICE_LEFT, new PageLeftCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_PAGE_RIGHT, PushControlSurface.PUSH_BUTTON_DEVICE_RIGHT, new PageRightCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_MUTE, PushControlSurface.PUSH_BUTTON_MUTE, new MuteCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SOLO, PushControlSurface.PUSH_BUTTON_SOLO, new SoloCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SCALES, PushControlSurface.PUSH_BUTTON_SCALES, new ScalesCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ACCENT, PushControlSurface.PUSH_BUTTON_ACCENT, new AccentCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ADD_EFFECT, PushControlSurface.PUSH_BUTTON_ADD_EFFECT, new AddEffectCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ADD_TRACK, PushControlSurface.PUSH_BUTTON_ADD_TRACK, new AddTrackCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_SELECT_PLAY_VIEW, PushControlSurface.PUSH_BUTTON_NOTE, new SelectPlayViewCommand(this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_DOWN, PushControlSurface.PUSH_BUTTON_DOWN, new PushCursorCommand(Direction.DOWN, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_UP, PushControlSurface.PUSH_BUTTON_UP, new PushCursorCommand(Direction.UP, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_LEFT, PushControlSurface.PUSH_BUTTON_LEFT, new PushCursorCommand(Direction.LEFT, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_ARROW_RIGHT, PushControlSurface.PUSH_BUTTON_RIGHT, new PushCursorCommand(Direction.RIGHT, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_OCTAVE_DOWN, PushControlSurface.PUSH_BUTTON_OCTAVE_DOWN, new OctaveCommand(false, this.model, surface));
    this.addTriggerCommand(Commands.COMMAND_OCTAVE_UP, PushControlSurface.PUSH_BUTTON_OCTAVE_UP, new OctaveCommand(true, this.model, surface));
    viewManager.registerTriggerCommand(Commands.COMMAND_SETUP, new SetupCommand(this.isPush2, this.model, surface));
    if (this.isPush2) {
        surface.assignTriggerCommand(PushControlSurface.PUSH_BUTTON_SETUP, Commands.COMMAND_SETUP);
        this.addTriggerCommand(Commands.COMMAND_CONVERT, PushControlSurface.PUSH_BUTTON_CONVERT, new ConvertCommand<>(this.model, surface));
    } else
        surface.assignTriggerCommand(PushControlSurface.PUSH_BUTTON_USER_MODE, Commands.COMMAND_SETUP);
    if (this.host.hasClips()) {
        this.addTriggerCommand(Commands.COMMAND_STOP_CLIP, PushControlSurface.PUSH_BUTTON_CLIP_STOP, new StopClipCommand<>(this.model, surface));
        this.addTriggerCommand(Commands.COMMAND_SELECT_SESSION_VIEW, PushControlSurface.PUSH_BUTTON_SESSION, new SelectSessionViewCommand(this.model, surface));
    } else
        this.addTriggerCommand(Commands.COMMAND_SELECT_SESSION_VIEW, PushControlSurface.PUSH_BUTTON_SESSION, new NopCommand<>(this.model, surface));
}
Also used : PanSendCommand(de.mossgrabers.push.command.trigger.PanSendCommand) ShiftCommand(de.mossgrabers.push.command.trigger.ShiftCommand) MuteCommand(de.mossgrabers.push.command.trigger.MuteCommand) PageRightCommand(de.mossgrabers.push.command.trigger.PageRightCommand) ViewManager(de.mossgrabers.framework.view.ViewManager) TrackCommand(de.mossgrabers.push.command.trigger.TrackCommand) AddTrackCommand(de.mossgrabers.push.command.trigger.AddTrackCommand) AddEffectCommand(de.mossgrabers.push.command.trigger.AddEffectCommand) OctaveCommand(de.mossgrabers.push.command.trigger.OctaveCommand) SelectSessionViewCommand(de.mossgrabers.push.command.trigger.SelectSessionViewCommand) SoloCommand(de.mossgrabers.push.command.trigger.SoloCommand) AddTrackCommand(de.mossgrabers.push.command.trigger.AddTrackCommand) PushQuantizeCommand(de.mossgrabers.push.command.trigger.PushQuantizeCommand) ScalesCommand(de.mossgrabers.push.command.trigger.ScalesCommand) AutomationCommand(de.mossgrabers.push.command.trigger.AutomationCommand) FixedLengthCommand(de.mossgrabers.push.command.trigger.FixedLengthCommand) MasterVolumeCommand(de.mossgrabers.framework.command.continuous.MasterVolumeCommand) VolumeCommand(de.mossgrabers.push.command.trigger.VolumeCommand) MastertrackCommand(de.mossgrabers.push.command.trigger.MastertrackCommand) PageLeftCommand(de.mossgrabers.push.command.trigger.PageLeftCommand) SelectCommand(de.mossgrabers.push.command.trigger.SelectCommand) DeviceCommand(de.mossgrabers.push.command.trigger.DeviceCommand) SetupCommand(de.mossgrabers.push.command.trigger.SetupCommand) SelectPlayViewCommand(de.mossgrabers.push.command.trigger.SelectPlayViewCommand) PushCursorCommand(de.mossgrabers.push.command.trigger.PushCursorCommand) StopClipCommand(de.mossgrabers.framework.command.trigger.clip.StopClipCommand) ClipCommand(de.mossgrabers.push.command.trigger.ClipCommand) AccentCommand(de.mossgrabers.push.command.trigger.AccentCommand) LayoutCommand(de.mossgrabers.push.command.trigger.LayoutCommand) NopCommand(de.mossgrabers.framework.command.trigger.NopCommand) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface)

Example 2 with PushCursorCommand

use of de.mossgrabers.push.command.trigger.PushCursorCommand in project DrivenByMoss by git-moss.

the class PushControllerSetup method updateButtons.

private void updateButtons() {
    final ITransport t = this.model.getTransport();
    final PushControlSurface surface = this.getSurface();
    surface.updateButton(PushControlSurface.PUSH_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
    surface.updateButton(PushControlSurface.PUSH_BUTTON_PLAY, t.isPlaying() ? PushColors.PUSH_BUTTON_STATE_PLAY_HI : PushColors.PUSH_BUTTON_STATE_PLAY_ON);
    final boolean isShift = surface.isShiftPressed();
    final boolean isFlipRecord = this.configuration.isFlipRecord();
    final boolean isRecordShifted = isShift && !isFlipRecord || !isShift && isFlipRecord;
    if (isRecordShifted)
        surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingClipLauncherAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
    else
        surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingArrangerAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
    surface.updateButton(PushControlSurface.PUSH_BUTTON_RECORD, isRecordShifted ? t.isLauncherOverdub() ? PushColors.PUSH_BUTTON_STATE_OVR_HI : PushColors.PUSH_BUTTON_STATE_OVR_ON : t.isRecording() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
    surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, this.configuration.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
    final PushConfiguration config = surface.getConfiguration();
    if (this.isPush2) {
        final ModeManager modeManager = surface.getModeManager();
        if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER)) {
            final ICursorDevice cd = this.model.getCursorDevice();
            final IChannel layer = cd.getSelectedLayerOrDrumPad();
            surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, layer != null && layer.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
            surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, layer != null && layer.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
        } else {
            final IChannelBank tb = this.model.getCurrentTrackBank();
            final ITrack selTrack = modeManager.isActiveMode(Modes.MODE_MASTER) ? this.model.getMasterTrack() : tb.getSelectedTrack();
            surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, selTrack != null && selTrack.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
            surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, selTrack != null && selTrack.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
        }
        surface.updateButton(PushControlSurface.PUSH_BUTTON_CONVERT, this.model.canConvertClip() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    } else {
        final boolean isMuteState = config.isMuteState();
        surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, isMuteState ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
        surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, !isMuteState ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
    }
    final ViewManager viewManager = surface.getViewManager();
    final boolean isSessionView = Views.isSessionView(viewManager.getActiveViewId());
    surface.updateButton(PushControlSurface.PUSH_BUTTON_NOTE, isSessionView ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
    if (this.host.hasClips()) {
        surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) ? PushColors.PUSH_BUTTON_STATE_STOP_HI : PushColors.PUSH_BUTTON_STATE_STOP_ON);
        surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, isSessionView ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
    } else {
        surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, ColorManager.BUTTON_STATE_OFF);
    }
    surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, config.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
    final View activeView = viewManager.getActiveView();
    if (activeView != null) {
        ((PushCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
        ((SceneView) activeView).updateSceneButtons();
    }
    final ICursorClip clip = activeView instanceof AbstractSequencerView && !(activeView instanceof ClipView) ? ((AbstractSequencerView<?, ?>) activeView).getClip() : null;
    surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_LEFT, clip != null && clip.canScrollStepsBackwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_RIGHT, clip != null && clip.canScrollStepsForwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITransport(de.mossgrabers.framework.daw.ITransport) ViewManager(de.mossgrabers.framework.view.ViewManager) ColorView(de.mossgrabers.push.view.ColorView) PlayView(de.mossgrabers.push.view.PlayView) SequencerView(de.mossgrabers.push.view.SequencerView) ScenePlayView(de.mossgrabers.push.view.ScenePlayView) DrumView(de.mossgrabers.push.view.DrumView) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) ClipView(de.mossgrabers.push.view.ClipView) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) PrgChangeView(de.mossgrabers.push.view.PrgChangeView) PianoView(de.mossgrabers.push.view.PianoView) SessionView(de.mossgrabers.push.view.SessionView) RaindropsView(de.mossgrabers.push.view.RaindropsView) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) PushCursorCommand(de.mossgrabers.push.command.trigger.PushCursorCommand) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ICursorClip(de.mossgrabers.framework.daw.ICursorClip) SceneView(de.mossgrabers.framework.view.SceneView) ClipView(de.mossgrabers.push.view.ClipView) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

ViewManager (de.mossgrabers.framework.view.ViewManager)2 PushCursorCommand (de.mossgrabers.push.command.trigger.PushCursorCommand)2 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)2 MasterVolumeCommand (de.mossgrabers.framework.command.continuous.MasterVolumeCommand)1 NopCommand (de.mossgrabers.framework.command.trigger.NopCommand)1 StopClipCommand (de.mossgrabers.framework.command.trigger.clip.StopClipCommand)1 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)1 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)1 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)1 ITransport (de.mossgrabers.framework.daw.ITransport)1 IChannel (de.mossgrabers.framework.daw.data.IChannel)1 ITrack (de.mossgrabers.framework.daw.data.ITrack)1 ModeManager (de.mossgrabers.framework.mode.ModeManager)1 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)1 SceneView (de.mossgrabers.framework.view.SceneView)1 View (de.mossgrabers.framework.view.View)1 AccentCommand (de.mossgrabers.push.command.trigger.AccentCommand)1 AddEffectCommand (de.mossgrabers.push.command.trigger.AddEffectCommand)1 AddTrackCommand (de.mossgrabers.push.command.trigger.AddTrackCommand)1 AutomationCommand (de.mossgrabers.push.command.trigger.AutomationCommand)1