Search in sources :

Example 1 with DevicePresetsMode

use of de.mossgrabers.sl.mode.device.DevicePresetsMode in project DrivenByMoss by git-moss.

the class ControlView method updateButtons.

/**
 * {@inheritDoc}
 */
@Override
public void updateButtons() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ICursorDevice cd = this.model.getCursorDevice();
    final ITransport transport = this.model.getTransport();
    final int clipLength = this.surface.getConfiguration().getNewClipLength();
    final Integer mode = this.surface.getModeManager().getActiveModeId();
    final boolean isTrack = mode == Modes.MODE_TRACK;
    final boolean isTrackToggles = mode == Modes.MODE_TRACK_TOGGLES;
    final boolean isVolume = mode == Modes.MODE_VOLUME;
    final boolean isMaster = mode == Modes.MODE_MASTER;
    final boolean isFixed = mode == Modes.MODE_FIXED;
    final boolean isFrame = mode == Modes.MODE_FRAME;
    final boolean isPreset = mode == Modes.MODE_BROWSER;
    final boolean isDevice = mode == Modes.MODE_PARAMS;
    final boolean isFunctions = mode == Modes.MODE_FUNCTIONS;
    if (mode == Modes.MODE_VIEW_SELECT) {
        for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
    } else {
        // Button row 1: Clip length or functions
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_1, !isFunctions && clipLength == 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_2, !isFunctions && clipLength == 1 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_3, !isFunctions && clipLength == 2 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_4, !isFunctions && clipLength == 3 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_5, !isFunctions && clipLength == 4 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_6, isFunctions && this.model.getCursorDevice().isWindowOpen() || !isFunctions && clipLength == 5 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_7, isFunctions && transport.isMetronomeOn() || !isFunctions && clipLength == 6 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_8, !isFunctions && clipLength == 7 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    }
    // Button row 2: Track toggles / Browse
    if (mode == Modes.MODE_BROWSER) {
        final int selMode = ((DevicePresetsMode) this.surface.getModeManager().getMode(Modes.MODE_BROWSER)).getSelectionMode();
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_1, SLControlSurface.MKII_BUTTON_STATE_ON);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_2, SLControlSurface.MKII_BUTTON_STATE_ON);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_3, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_4, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_5, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_6, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_7, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_8, SLControlSurface.MKII_BUTTON_STATE_ON);
    } else {
        final boolean isNoOverlayMode = mode != Modes.MODE_FRAME && mode != Modes.MODE_BROWSER;
        final ITrack track = tb.getSelectedTrack();
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_1, isNoOverlayMode && track != null && track.isMute() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_2, isNoOverlayMode && track != null && track.isSolo() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_3, isNoOverlayMode && track != null && track.isRecArm() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_4, transport.isWritingArrangerAutomation() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_5, SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_6, this.model.getCursorDevice().isEnabled() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_7, isNoOverlayMode && cd.canSelectPreviousFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
        this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_8, isNoOverlayMode && cd.canSelectNextFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    }
    // Button row 3: Selected track indication
    for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + i, tb.getTrack(i).isSelected() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    // LED indications for device parameters
    ((DeviceParamsMode) this.surface.getModeManager().getMode(Modes.MODE_PARAMS)).setLEDs();
    // Transport buttons
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_3, !transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_4, transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_5, transport.isLoop() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_6, transport.isRecording() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL1, isFunctions || isFixed ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL2, isDevice ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL3, isTrackToggles || isFrame || isPreset ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL4, isTrack || isMaster ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL6, isVolume ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
    this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL7, SLControlSurface.MKII_BUTTON_STATE_OFF);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ITransport(de.mossgrabers.framework.daw.ITransport) DevicePresetsMode(de.mossgrabers.sl.mode.device.DevicePresetsMode) DeviceParamsMode(de.mossgrabers.sl.mode.device.DeviceParamsMode) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 2 with DevicePresetsMode

use of de.mossgrabers.sl.mode.device.DevicePresetsMode in project DrivenByMoss by git-moss.

the class SLControllerSetup method createModes.

/**
 * {@inheritDoc}
 */
@Override
protected void createModes() {
    final SLControlSurface surface = this.getSurface();
    final ModeManager modeManager = surface.getModeManager();
    modeManager.registerMode(Modes.MODE_FIXED, new FixedMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_FRAME, new FrameMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_FUNCTIONS, new FunctionMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_MASTER, new MasterMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_PLAY_OPTIONS, new PlayOptionsMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_SESSION, new SessionMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_TRACK, new TrackMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_TRACK_TOGGLES, new TrackTogglesMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_VIEW_SELECT, new ViewSelectMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_VOLUME, new VolumeMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_PARAMS, new DeviceParamsMode(surface, this.model));
    modeManager.registerMode(Modes.MODE_BROWSER, new DevicePresetsMode(surface, this.model));
}
Also used : TrackMode(de.mossgrabers.sl.mode.TrackMode) MasterMode(de.mossgrabers.sl.mode.MasterMode) TrackTogglesMode(de.mossgrabers.sl.mode.TrackTogglesMode) FunctionMode(de.mossgrabers.sl.mode.FunctionMode) SLControlSurface(de.mossgrabers.sl.controller.SLControlSurface) FixedMode(de.mossgrabers.sl.mode.FixedMode) DeviceParamsMode(de.mossgrabers.sl.mode.device.DeviceParamsMode) SessionMode(de.mossgrabers.sl.mode.SessionMode) VolumeMode(de.mossgrabers.sl.mode.VolumeMode) DevicePresetsMode(de.mossgrabers.sl.mode.device.DevicePresetsMode) ViewSelectMode(de.mossgrabers.sl.mode.ViewSelectMode) FrameMode(de.mossgrabers.sl.mode.FrameMode) PlayOptionsMode(de.mossgrabers.sl.mode.PlayOptionsMode) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

DeviceParamsMode (de.mossgrabers.sl.mode.device.DeviceParamsMode)2 DevicePresetsMode (de.mossgrabers.sl.mode.device.DevicePresetsMode)2 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)1 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)1 ITransport (de.mossgrabers.framework.daw.ITransport)1 ITrack (de.mossgrabers.framework.daw.data.ITrack)1 ModeManager (de.mossgrabers.framework.mode.ModeManager)1 SLControlSurface (de.mossgrabers.sl.controller.SLControlSurface)1 FixedMode (de.mossgrabers.sl.mode.FixedMode)1 FrameMode (de.mossgrabers.sl.mode.FrameMode)1 FunctionMode (de.mossgrabers.sl.mode.FunctionMode)1 MasterMode (de.mossgrabers.sl.mode.MasterMode)1 PlayOptionsMode (de.mossgrabers.sl.mode.PlayOptionsMode)1 SessionMode (de.mossgrabers.sl.mode.SessionMode)1 TrackMode (de.mossgrabers.sl.mode.TrackMode)1 TrackTogglesMode (de.mossgrabers.sl.mode.TrackTogglesMode)1 ViewSelectMode (de.mossgrabers.sl.mode.ViewSelectMode)1 VolumeMode (de.mossgrabers.sl.mode.VolumeMode)1