Search in sources :

Example 61 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) {
    if (velocity == 0) {
        final TriggerCommand triggerCommand = this.surface.getViewManager().getView(Views.VIEW_SESSION).getTriggerCommand(Commands.COMMAND_SELECT_SESSION_VIEW);
        ((SelectSessionViewCommand) triggerCommand).setTemporary();
        return;
    }
    final int index = note - 36;
    int t = index % this.columns;
    int s = this.rows - 1 - index / this.columns;
    final boolean flipSession = this.surface.getConfiguration().isFlipSession();
    if (flipSession) {
        final int dummy = t;
        t = s;
        s = dummy;
    }
    final IChannelBank tb = this.model.getCurrentTrackBank();
    // Birds-eye-view navigation
    if (this.surface.isShiftPressed()) {
        // Calculate page offsets
        final int numTracks = tb.getNumTracks();
        final int numScenes = tb.getNumScenes();
        final int trackPosition = tb.getTrack(0).getPosition() / numTracks;
        final int scenePosition = tb.getScenePosition() / numScenes;
        final int selX = flipSession ? scenePosition : trackPosition;
        final int selY = flipSession ? trackPosition : scenePosition;
        final int padsX = flipSession ? this.rows : this.columns;
        final int padsY = flipSession ? this.columns : this.rows;
        final int offsetX = selX / padsX * padsX;
        final int offsetY = selY / padsY * padsY;
        tb.scrollToChannel(offsetX * numTracks + t * padsX);
        tb.scrollToScene(offsetY * numScenes + s * padsY);
        return;
    }
    // Duplicate a clip
    final ITrack track = tb.getTrack(t);
    if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_DUPLICATE)) {
        this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_DUPLICATE);
        if (track.doesExist())
            track.getSlot(s).duplicate();
        return;
    }
    // Stop clip
    if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
        this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_CLIP_STOP);
        track.stop();
        return;
    }
    // Browse for clips
    if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_BROWSE)) {
        this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_BROWSE);
        if (!track.doesExist())
            return;
        track.getSlot(s).browse();
        final ModeManager modeManager = this.surface.getModeManager();
        if (!modeManager.isActiveMode(Modes.MODE_BROWSER))
            modeManager.setActiveMode(Modes.MODE_BROWSER);
        return;
    }
    super.onGridNote(note, velocity);
}
Also used : TriggerCommand(de.mossgrabers.framework.command.core.TriggerCommand) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) SelectSessionViewCommand(de.mossgrabers.push.command.trigger.SelectSessionViewCommand) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 62 with ModeManager

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

Example 63 with ModeManager

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

the class ShiftCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    final boolean isUp = event == ButtonEvent.UP;
    this.surface.updateButton(PushControlSurface.PUSH_BUTTON_SHIFT, isUp ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
    final ModeManager modeManager = this.surface.getModeManager();
    final Integer cm = modeManager.getActiveModeId();
    if (event == ButtonEvent.DOWN && Modes.MODE_SCALES.equals(cm))
        modeManager.setActiveMode(Modes.MODE_SCALE_LAYOUT);
    else if (isUp && Modes.MODE_SCALE_LAYOUT.equals(cm))
        modeManager.restoreMode();
    this.model.getValueChanger().setSpeed(this.surface.isShiftPressed());
}
Also used : ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 64 with ModeManager

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

the class TrackCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final PushConfiguration config = this.surface.getConfiguration();
    if (this.surface.isShiftPressed()) {
        config.setVUMetersEnabled(!config.isEnableVUMeters());
        return;
    }
    final ModeManager modeManager = this.surface.getModeManager();
    final Integer currentMode = modeManager.getActiveModeId();
    if (currentMode != null) {
        if (config.isPush2()) {
            if (Modes.MODE_TRACK.equals(currentMode) || Modes.MODE_VOLUME.equals(currentMode) || Modes.MODE_CROSSFADER.equals(currentMode) || Modes.MODE_PAN.equals(currentMode)) {
                this.model.toggleCurrentTrackBank();
            } else if (currentMode.intValue() >= Modes.MODE_SEND1.intValue() && currentMode.intValue() <= Modes.MODE_SEND8.intValue()) {
                modeManager.setActiveMode(Modes.MODE_TRACK);
                this.model.toggleCurrentTrackBank();
            } else
                modeManager.setActiveMode(config.getCurrentMixMode());
        } else {
            // Layer mode selection for Push 1
            if (this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
                modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
                return;
            }
            if (currentMode == Modes.MODE_TRACK)
                this.model.toggleCurrentTrackBank();
            else
                modeManager.setActiveMode(Modes.MODE_TRACK);
        }
    } else
        modeManager.setActiveMode(Modes.MODE_TRACK);
    config.setDebugMode(modeManager.getActiveModeId());
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack track = tb.getSelectedTrack();
    if (track == null)
        tb.getTrack(0).select();
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 65 with ModeManager

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

the class FaderCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final int value) {
    final IMasterTrack masterTrack = this.model.getMasterTrack();
    if (masterTrack.isSelected()) {
        if (this.index == 0)
            masterTrack.setVolume(value);
    } else
        this.model.getCurrentTrackBank().getTrack(this.index).setVolume(value);
    final ModeManager modeManager = this.surface.getModeManager();
    if (!modeManager.isActiveMode(Modes.MODE_VOLUME))
        modeManager.setActiveMode(Modes.MODE_VOLUME);
}
Also used : IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack) 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