Search in sources :

Example 11 with Modes

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

the class VolumeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes currentMode = modeManager.getActiveID();
    // Layer mode selection for Push 1
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2() && this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
        modeManager.setActive(Modes.DEVICE_LAYER_VOLUME);
        return;
    }
    if (Modes.VOLUME.equals(currentMode)) {
        if (this.model.getHost().supports(Capability.HAS_CROSSFADER))
            modeManager.setActive(Modes.CROSSFADER);
    } else
        modeManager.setActive(Modes.VOLUME);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 12 with Modes

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

the class ShiftCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes cm = modeManager.getActiveID();
    if (event == ButtonEvent.DOWN && Modes.SCALES.equals(cm))
        modeManager.setTemporary(Modes.SCALE_LAYOUT);
    else if (event == ButtonEvent.UP && Modes.SCALE_LAYOUT.equals(cm))
        modeManager.restore();
    this.surface.setKnobSensitivityIsSlow(this.surface.isShiftPressed());
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 13 with Modes

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

the class MuteCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    // Update for key combinations
    this.surface.getViewManager().getActive().updateNoteMapping();
    if (this.surface.isSelectPressed()) {
        if (event == ButtonEvent.UP)
            this.model.getProject().clearMute();
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2()) {
        config.setTrackState(TrackState.MUTE);
        return;
    }
    // Toggle mute lock mode
    if (this.surface.isShiftPressed()) {
        if (event == ButtonEvent.UP) {
            if (config.isMuteSoloLocked() && config.isMuteState())
                config.setMuteSoloLocked(false);
            else {
                config.setMuteSoloLocked(true);
                config.setTrackState(TrackState.MUTE);
            }
        }
        return;
    }
    // Behaviour like Push 1
    if (config.isMuteSoloLocked()) {
        config.setTrackState(TrackState.MUTE);
        return;
    }
    if (event == ButtonEvent.DOWN) {
        config.setIsMuteLongPressed(false);
        return;
    }
    if (event == ButtonEvent.LONG) {
        config.setIsMuteLongPressed(true);
        config.setTrackState(TrackState.MUTE);
        return;
    }
    if (config.isMuteLongPressed()) {
        config.setIsMuteLongPressed(false);
        return;
    }
    final Modes activeModeId = this.surface.getModeManager().getActiveID();
    if (Modes.isLayerMode(activeModeId)) {
        final ICursorDevice cd = this.model.getCursorDevice();
        final Optional<?> layer = cd.getLayerBank().getSelectedItem();
        if (layer.isPresent())
            ((ILayer) layer.get()).toggleMute();
    } else if (Modes.MASTER.equals(activeModeId))
        this.model.getMasterTrack().toggleMute();
    else
        this.model.getCursorTrack().toggleMute();
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) Modes(de.mossgrabers.framework.mode.Modes) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 14 with Modes

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

the class PanSendCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes currentMode = modeManager.getActiveID();
    // Layer mode selection for Push 1
    Modes 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.DEVICE_LAYER_PAN;
        } else {
            mode = Modes.get(currentMode, 1);
            // Wrap
            if (mode.ordinal() < Modes.DEVICE_LAYER_PAN.ordinal() || mode.ordinal() > Modes.DEVICE_LAYER_SEND8.ordinal())
                mode = Modes.DEVICE_LAYER_PAN;
            // Check if Send channel exists
            final ITrackBank tb = this.model.getTrackBank();
            if (mode.ordinal() < Modes.DEVICE_LAYER_SEND1.ordinal() || mode.ordinal() > Modes.DEVICE_LAYER_SEND8.ordinal() || tb.canEditSend(mode.ordinal() - Modes.DEVICE_LAYER_SEND1.ordinal()))
                mode = Modes.DEVICE_LAYER_PAN;
        }
        modeManager.setActive(mode);
        return;
    }
    if (this.model.isEffectTrackBankActive()) {
        // No Sends on FX tracks
        mode = Modes.PAN;
    } else {
        if (currentMode.ordinal() < Modes.SEND1.ordinal() || currentMode.ordinal() > Modes.SEND8.ordinal())
            mode = Modes.SEND1;
        else {
            mode = Modes.get(currentMode, 1);
            if (mode.ordinal() > Modes.SEND8.ordinal())
                mode = Modes.PAN;
        }
        // Check if Send channel exists
        final ITrackBank tb = this.model.getTrackBank();
        if (mode.ordinal() < Modes.SEND1.ordinal() || mode.ordinal() > Modes.SEND8.ordinal() || !tb.canEditSend(mode.ordinal() - Modes.SEND1.ordinal()))
            mode = Modes.PAN;
    }
    modeManager.setActive(mode);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 15 with Modes

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

the class GenericFlexiControllerSetup method selectMode.

private void selectMode() {
    final String selectedModeName = this.configuration.getSelectedModeName();
    if (selectedModeName == null)
        return;
    final GenericFlexiControlSurface surface = this.getSurface();
    final Modes modeID = surface.getModeManager().get(selectedModeName);
    if (modeID != null)
        surface.activateMode(modeID);
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) Modes(de.mossgrabers.framework.mode.Modes)

Aggregations

Modes (de.mossgrabers.framework.mode.Modes)35 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)22 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)13 ITrack (de.mossgrabers.framework.daw.data.ITrack)8 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)6 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)5 ITransport (de.mossgrabers.framework.daw.ITransport)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)2 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)2 GenericFlexiControlSurface (de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface)1 MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)1 StudioEncoderModeManager (de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)1 P2ButtonCommand (de.mossgrabers.controller.novation.sl.command.trigger.P2ButtonCommand)1 DevicePresetsMode (de.mossgrabers.controller.novation.sl.mode.device.DevicePresetsMode)1 SLParameterMode (de.mossgrabers.controller.novation.sl.mode.device.SLParameterMode)1 ContinuousCommand (de.mossgrabers.framework.command.core.ContinuousCommand)1 PitchbendCommand (de.mossgrabers.framework.command.core.PitchbendCommand)1 TriggerCommand (de.mossgrabers.framework.command.core.TriggerCommand)1 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)1