Search in sources :

Example 36 with ModeManager

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

the class MCUControllerSetup method createModel.

/**
 * {@inheritDoc}
 */
@Override
protected void createModel() {
    this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8 * this.numMCUDevices, 8, 8, 8, 8, true, 8 * this.numMCUDevices, -1, -1, -1);
    final ITrackBank trackBank = this.model.getTrackBank();
    trackBank.setIndication(true);
    trackBank.addTrackSelectionObserver(this::handleTrackChange);
    this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
        final ModeManager modeManager = this.getSurface().getModeManager();
        if (isSelected)
            modeManager.setActiveMode(Modes.MODE_MASTER);
        else
            modeManager.restoreMode();
    });
}
Also used : ITrackBank(de.mossgrabers.framework.daw.ITrackBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 37 with ModeManager

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

the class PushCursorCommand method scrollLeft.

/**
 * {@inheritDoc}
 */
@Override
protected void scrollLeft() {
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS)) {
        final DeviceParamsMode paramsMode = (DeviceParamsMode) modeManager.getActiveMode();
        if (this.surface.isShiftPressed())
            paramsMode.selectPreviousPageBank();
        else
            paramsMode.selectPreviousPage();
        return;
    }
    if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
        ((DeviceBrowserMode) modeManager.getActiveMode()).resetFilterColumn();
        this.model.getBrowser().previousContentType();
        return;
    }
    if (Modes.isLayerMode(modeManager.getActiveModeId())) {
        if (this.surface.isShiftPressed())
            this.model.getCursorDevice().previousLayerOrDrumPadBank();
        else
            this.model.getCursorDevice().previousLayerOrDrumPad();
        return;
    }
    this.scrollTracksLeft();
}
Also used : DeviceParamsMode(de.mossgrabers.push.mode.device.DeviceParamsMode) DeviceBrowserMode(de.mossgrabers.push.mode.device.DeviceBrowserMode) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 38 with ModeManager

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

the class PushCursorCommand method updateArrowStates.

/**
 * {@inheritDoc}
 */
@Override
protected void updateArrowStates() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    this.canScrollUp = tb.canScrollScenesUp();
    this.canScrollDown = tb.canScrollScenesDown();
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS)) {
        final DeviceParamsMode mode = (DeviceParamsMode) modeManager.getActiveMode();
        this.canScrollLeft = mode.canSelectPreviousPage();
        this.canScrollRight = mode.canSelectNextPage();
        return;
    }
    if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
        final IBrowser browser = this.model.getBrowser();
        final int index = browser.getSelectedContentTypeIndex();
        this.canScrollLeft = index > 0;
        this.canScrollRight = index < browser.getContentTypeNames().length - 1;
        return;
    }
    if (Modes.isLayerMode(modeManager.getActiveModeId())) {
        final ICursorDevice cd = this.model.getCursorDevice();
        this.canScrollLeft = cd.canScrollLayersOrDrumPadsUp();
        this.canScrollRight = cd.canScrollLayersOrDrumPadsDown();
        return;
    }
    final ITrack sel = tb.getSelectedTrack();
    final int selIndex = sel != null ? sel.getIndex() : -1;
    this.canScrollLeft = selIndex > 0 || tb.canScrollTracksUp();
    this.canScrollRight = selIndex >= 0 && selIndex < 7 && tb.getTrack(selIndex + 1).doesExist() || tb.canScrollTracksDown();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) DeviceParamsMode(de.mossgrabers.push.mode.device.DeviceParamsMode) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 39 with ModeManager

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

the class PushQuantizeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    final ModeManager modeManager = this.surface.getModeManager();
    if (event == ButtonEvent.LONG || event == ButtonEvent.DOWN && this.surface.isShiftPressed()) {
        modeManager.setActiveMode(Modes.MODE_GROOVE);
        this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_QUANTIZE);
        return;
    }
    if (event != ButtonEvent.UP)
        return;
    if (Modes.MODE_GROOVE.equals(modeManager.getActiveModeId()))
        modeManager.restoreMode();
    else
        this.quantize();
}
Also used : ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 40 with ModeManager

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

the class RasteredKnobCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final int value) {
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
        final DeviceBrowserMode mode = (DeviceBrowserMode) modeManager.getMode(Modes.MODE_BROWSER);
        mode.changeSelectedColumnValue(value);
        return;
    }
    this.model.getTransport().changeTempo(value == 1);
}
Also used : DeviceBrowserMode(de.mossgrabers.push.mode.device.DeviceBrowserMode) 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