Search in sources :

Example 16 with ModeManager

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

the class PushControllerSetup method createModel.

/**
 * {@inheritDoc}
 */
@Override
protected void createModel() {
    this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8, 8, this.isPush2 ? 8 : 6, this.isPush2 ? 48 : 16, this.isPush2 ? 48 : 16, false, -1, -1, -1, -1);
    final ITrackBank trackBank = this.model.getTrackBank();
    trackBank.setIndication(true);
    trackBank.addTrackSelectionObserver(this::handleTrackChange);
    final IChannelBank effectTrackBank = this.model.getEffectTrackBank();
    if (effectTrackBank != null)
        effectTrackBank.addTrackSelectionObserver(this::handleTrackChange);
    this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
        final PushControlSurface surface = this.getSurface();
        final ModeManager modeManager = surface.getModeManager();
        if (isSelected)
            modeManager.setActiveMode(Modes.MODE_MASTER);
        else if (modeManager.isActiveMode(Modes.MODE_MASTER))
            modeManager.restoreMode();
    });
}
Also used : ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 17 with ModeManager

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

the class MastertrackTouchCommand 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;
    final IMasterTrack masterTrack = this.model.getMasterTrack();
    masterTrack.touchVolume(isTouched);
    if (this.surface.isDeletePressed()) {
        this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_DELETE);
        masterTrack.resetVolume();
        return;
    }
    final boolean isMasterMode = modeManager.isActiveMode(Modes.MODE_MASTER);
    if (isTouched && isMasterMode)
        return;
    if (isTouched)
        modeManager.setActiveMode(Modes.MODE_MASTER_TEMP);
    else if (!isMasterMode)
        modeManager.restoreMode();
}
Also used : IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 18 with ModeManager

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

the class PanSendCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
    final ModeManager modeManager = this.surface.getModeManager();
    final Integer currentMode = modeManager.getActiveModeId();
    // Layer mode selection for Push 1
    Integer mode;
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2() && this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
        if (this.model.isEffectTrackBankActive()) {
            // No Sends on FX tracks
            mode = Modes.MODE_DEVICE_LAYER_PAN;
        } else {
            mode = Integer.valueOf(currentMode.intValue() + 1);
            // Wrap
            if (mode.intValue() < Modes.MODE_DEVICE_LAYER_PAN.intValue() || mode.intValue() > Modes.MODE_DEVICE_LAYER_SEND6.intValue())
                mode = Modes.MODE_DEVICE_LAYER_PAN;
            // Check if Send channel exists
            if (mode.intValue() >= Modes.MODE_DEVICE_LAYER_SEND1.intValue() && mode.intValue() <= Modes.MODE_DEVICE_LAYER_SEND6.intValue() && fxTrackBank != null && !fxTrackBank.getTrack(mode.intValue() - Modes.MODE_DEVICE_LAYER_SEND1.intValue()).doesExist())
                mode = Modes.MODE_DEVICE_LAYER_PAN;
        }
        modeManager.setActiveMode(mode);
        return;
    }
    if (this.model.isEffectTrackBankActive()) {
        // No Sends on FX tracks
        mode = Modes.MODE_PAN;
    } else {
        mode = Integer.valueOf(currentMode.intValue() + 1);
        // Wrap
        if (mode.intValue() < Modes.MODE_PAN.intValue() || mode.intValue() > Modes.MODE_SEND6.intValue())
            mode = Modes.MODE_PAN;
        // Check if Send channel exists
        if (mode.intValue() >= Modes.MODE_SEND1.intValue() && mode.intValue() <= Modes.MODE_SEND6.intValue() && fxTrackBank != null && !fxTrackBank.getTrack(mode.intValue() - Modes.MODE_SEND1.intValue()).doesExist())
            mode = Modes.MODE_PAN;
    }
    modeManager.setActiveMode(mode);
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 19 with ModeManager

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

the class PushCursorCommand method scrollRight.

/**
 * {@inheritDoc}
 */
@Override
protected void scrollRight() {
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS)) {
        final DeviceParamsMode activeMode = (DeviceParamsMode) modeManager.getActiveMode();
        if (this.surface.isShiftPressed())
            activeMode.selectNextPageBank();
        else
            activeMode.selectNextPage();
        return;
    }
    if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
        ((DeviceBrowserMode) modeManager.getActiveMode()).resetFilterColumn();
        this.model.getBrowser().nextContentType();
        return;
    }
    if (Modes.isLayerMode(modeManager.getActiveModeId())) {
        if (this.surface.isShiftPressed())
            this.model.getCursorDevice().nextLayerOrDrumPadBank();
        else
            this.model.getCursorDevice().nextLayerOrDrumPad();
        return;
    }
    this.scrollTracksRight();
}
Also used : DeviceParamsMode(de.mossgrabers.push.mode.device.DeviceParamsMode) DeviceBrowserMode(de.mossgrabers.push.mode.device.DeviceBrowserMode) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 20 with ModeManager

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

the class SelectCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    // Update for key combinations
    this.surface.getViewManager().getActiveView().updateNoteMapping();
    final boolean isUp = event == ButtonEvent.UP;
    this.surface.updateButton(PushControlSurface.PUSH_BUTTON_SELECT, isUp ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
    final ModeManager modeManager = this.surface.getModeManager();
    if (event == ButtonEvent.DOWN) {
        // Track or layer details?
        if (Modes.isLayerMode(modeManager.getActiveModeId()))
            modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_DETAILS);
        else
            modeManager.setActiveMode(Modes.MODE_TRACK_DETAILS);
    } else if (isUp && modeManager.isActiveMode(Modes.MODE_TRACK_DETAILS))
        modeManager.restoreMode();
}
Also used : 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