Search in sources :

Example 31 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager 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)

Example 32 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class SmallKnobTouchCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    final boolean isTouched = event == ButtonEvent.DOWN;
    // Avoid accidentally leaving the browser
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActiveMode(Modes.MODE_BROWSER))
        return;
    // Prevent flickering if a knob is touched accidentally while fiddling with other knobs
    final Mode activeMode = modeManager.getActiveMode();
    if (activeMode instanceof BaseMode && ((BaseMode) activeMode).isAKnobTouched())
        return;
    this.model.getTransport().setTempoIndication(isTouched);
    if (isTouched)
        modeManager.setActiveMode(Modes.MODE_TRANSPORT);
    else
        modeManager.restoreMode();
}
Also used : BaseMode(de.mossgrabers.push.mode.BaseMode) Mode(de.mossgrabers.framework.mode.Mode) ModeManager(de.mossgrabers.framework.mode.ModeManager) BaseMode(de.mossgrabers.push.mode.BaseMode)

Example 33 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class SessionView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    final ModeManager modeManager = this.surface.getModeManager();
    final Integer activeModeId = modeManager.getActiveModeId();
    // Block 1st row if mode is active
    final boolean isNotRow1 = note >= 44;
    if (activeModeId == null || isNotRow1) {
        if (this.surface.isShiftPressed()) {
            this.onGridNoteBankSelection(note, velocity, isNotRow1);
            return;
        }
        final int n = note - (activeModeId != null ? 8 : 0);
        final int index = n - 36;
        final int t = index % this.columns;
        // Duplicate a clip
        if (this.surface.isPressed(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE)) {
            this.surface.setButtonConsumed(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE);
            final IChannelBank tb = this.model.getCurrentTrackBank();
            final ITrack track = tb.getTrack(t);
            if (track.doesExist()) {
                final int s = this.rows - 1 - index / this.columns;
                track.getSlot(s).duplicate();
            }
            return;
        }
        super.onGridNote(n, velocity);
        return;
    }
    if (velocity != 0)
        this.handleFirstRowModes(note, modeManager);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 34 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class SessionView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final Integer controlMode = this.surface.getModeManager().getActiveModeId();
    final boolean isOff = controlMode == null;
    final boolean flip = this.surface.getConfiguration().isFlipSession();
    this.rows = isOff || flip ? 8 : 7;
    this.columns = isOff || !flip ? 8 : 7;
    super.drawGrid();
    if (isOff)
        return;
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final PadGrid pads = this.surface.getPadGrid();
    final ModeManager modeManager = this.surface.getModeManager();
    for (int x = 0; x < this.columns; x++) {
        final ITrack track = tb.getTrack(x);
        final boolean exists = track.doesExist();
        if (modeManager.isActiveMode(Modes.MODE_REC_ARM))
            pads.lightEx(x, 7, exists ? track.isRecArm() ? LaunchpadColors.LAUNCHPAD_COLOR_RED_HI : LaunchpadColors.LAUNCHPAD_COLOR_RED_LO : LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
        else if (modeManager.isActiveMode(Modes.MODE_TRACK_SELECT))
            pads.lightEx(x, 7, exists ? track.isSelected() ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO : LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
        else if (modeManager.isActiveMode(Modes.MODE_MUTE))
            pads.lightEx(x, 7, exists ? track.isMute() ? LaunchpadColors.LAUNCHPAD_COLOR_YELLOW_HI : LaunchpadColors.LAUNCHPAD_COLOR_YELLOW_LO : LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
        else if (modeManager.isActiveMode(Modes.MODE_SOLO))
            pads.lightEx(x, 7, exists ? track.isSolo() ? LaunchpadColors.LAUNCHPAD_COLOR_BLUE_HI : LaunchpadColors.LAUNCHPAD_COLOR_BLUE_LO : LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
        else if (modeManager.isActiveMode(Modes.MODE_STOP_CLIP))
            pads.lightEx(x, 7, exists ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
    }
}
Also used : PadGrid(de.mossgrabers.framework.controller.grid.PadGrid) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 35 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class ShiftView method handleControlModes.

private boolean handleControlModes(final int note, final int velocity) {
    final ButtonEvent event = velocity == 0 ? ButtonEvent.UP : ButtonEvent.DOWN;
    final View view = this.surface.getViewManager().getActiveView();
    switch(note) {
        case 36:
            view.getTriggerCommand(Commands.COMMAND_REC_ARM).execute(event);
            break;
        case 37:
            view.getTriggerCommand(Commands.COMMAND_TRACK).execute(event);
            break;
        case 38:
            view.getTriggerCommand(Commands.COMMAND_MUTE).execute(event);
            break;
        case 39:
            view.getTriggerCommand(Commands.COMMAND_SOLO).execute(event);
            break;
        case 40:
            view.getTriggerCommand(Commands.COMMAND_VOLUME).execute(event);
            break;
        case 41:
            view.getTriggerCommand(Commands.COMMAND_PAN_SEND).execute(event);
            break;
        case 42:
            view.getTriggerCommand(Commands.COMMAND_SENDS).execute(event);
            break;
        case 43:
            view.getTriggerCommand(Commands.COMMAND_STOP_CLIP).execute(event);
            break;
        default:
            return false;
    }
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.getPreviousModeId() == modeManager.getActiveModeId())
        modeManager.setActiveMode(null);
    return true;
}
Also used : ButtonEvent(de.mossgrabers.framework.utils.ButtonEvent) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) AbstractView(de.mossgrabers.framework.view.AbstractView) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

ModeManager (de.mossgrabers.framework.mode.ModeManager)67 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)20 ITrack (de.mossgrabers.framework.daw.data.ITrack)18 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)9 ViewManager (de.mossgrabers.framework.view.ViewManager)7 PushConfiguration (de.mossgrabers.push.PushConfiguration)7 View (de.mossgrabers.framework.view.View)6 SceneView (de.mossgrabers.framework.view.SceneView)5 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)5 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)4 IChannel (de.mossgrabers.framework.daw.data.IChannel)4 ITransport (de.mossgrabers.framework.daw.ITransport)3 DeviceBrowserMode (de.mossgrabers.push.mode.device.DeviceBrowserMode)3 DeviceParamsMode (de.mossgrabers.push.mode.device.DeviceParamsMode)3 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)2 APCminiControlSurface (de.mossgrabers.apcmini.controller.APCminiControlSurface)2 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)2 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)2 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)2 LaunchpadControlSurface (de.mossgrabers.launchpad.controller.LaunchpadControlSurface)2