Search in sources :

Example 21 with ModeManager

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

the class SelectPlayViewCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ViewManager viewManager = this.surface.getViewManager();
    if (Views.isSessionView(viewManager.getActiveViewId())) {
        final IChannelBank tb = this.model.getCurrentTrackBank();
        final ITrack selectedTrack = tb.getSelectedTrack();
        if (selectedTrack == null) {
            this.surface.getDisplay().notify("Please select a track first.");
            return;
        }
        final Integer preferredView = viewManager.getPreferredView(selectedTrack.getPosition());
        viewManager.setActiveView(preferredView == null ? Views.VIEW_PLAY : preferredView);
        return;
    }
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActiveMode(Modes.MODE_VIEW_SELECT))
        modeManager.restoreMode();
    else
        modeManager.setActiveMode(Modes.MODE_VIEW_SELECT);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ViewManager(de.mossgrabers.framework.view.ViewManager) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 22 with ModeManager

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

the class MastertrackCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    // Avoid accidentally leaving the browser
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActiveMode(Modes.MODE_BROWSER))
        return;
    switch(event) {
        case DOWN:
            this.quitMasterMode = false;
            break;
        case UP:
            this.handleButtonUp(modeManager);
            break;
        case LONG:
            this.quitMasterMode = true;
            modeManager.setActiveMode(Modes.MODE_FRAME);
            break;
    }
}
Also used : ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 23 with ModeManager

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

the class VolumeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Integer currentMode = modeManager.getActiveModeId();
    // Layer mode selection for Push 1
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2() && this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
        modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME);
        return;
    }
    if (Modes.MODE_VOLUME.equals(currentMode))
        modeManager.setActiveMode(Modes.MODE_CROSSFADER);
    else
        modeManager.setActiveMode(Modes.MODE_VOLUME);
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 24 with ModeManager

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

the class SLControllerSetup method createModel.

/**
 * {@inheritDoc}
 */
@Override
protected void createModel() {
    this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8, 8, 6, 16, 16, true, -1, -1, -1, -1);
    this.model.getTrackBank().addTrackSelectionObserver(this::handleTrackChange);
    this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
        if (!isSelected)
            return;
        final ModeManager modeManager = this.getSurface().getModeManager();
        if (!modeManager.isActiveMode(Modes.MODE_VOLUME))
            modeManager.setActiveMode(Modes.MODE_MASTER);
    });
}
Also used : ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 25 with ModeManager

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

the class ControlView method onButtonP1.

/**
 * {@inheritDoc}
 */
@Override
public void onButtonP1(final boolean isUp, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Integer activeModeId = modeManager.getActiveModeId();
    if (activeModeId == Modes.MODE_FUNCTIONS || activeModeId == Modes.MODE_FIXED)
        this.onButtonRow1Select();
    else if (activeModeId == Modes.MODE_VOLUME)
        new P2ButtonCommand(isUp, this.model, this.surface).execute(event);
    else if (activeModeId == Modes.MODE_TRACK || activeModeId == Modes.MODE_MASTER)
        new ButtonRowSelectCommand<>(3, this.model, this.surface).execute(event);
    else if (activeModeId == Modes.MODE_TRACK_TOGGLES || activeModeId == Modes.MODE_FRAME)
        this.onButtonRow2Select();
    else {
        if (isUp)
            ((DeviceParamsMode) modeManager.getMode(Modes.MODE_PARAMS)).nextPage();
        else
            ((DeviceParamsMode) modeManager.getMode(Modes.MODE_PARAMS)).previousPage();
    }
}
Also used : ButtonRowSelectCommand(de.mossgrabers.sl.command.trigger.ButtonRowSelectCommand) P2ButtonCommand(de.mossgrabers.sl.command.trigger.P2ButtonCommand) DeviceParamsMode(de.mossgrabers.sl.mode.device.DeviceParamsMode) 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