Search in sources :

Example 21 with Modes

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

the class ShiftView method onSelectTrack.

/**
 * {@inheritDoc}
 */
@Override
public void onSelectTrack(final int index, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ModeManager modeManager = this.surface.getModeManager();
    switch(index) {
        case 0:
            tb.getSceneBank().selectPreviousPage();
            break;
        case 1:
            tb.getSceneBank().selectNextPage();
            break;
        case 2:
            tb.selectPreviousPage();
            break;
        case 3:
            tb.selectNextPage();
            break;
        case 4:
            modeManager.setActive(Modes.VOLUME);
            this.surface.getConfiguration().setFaderCtrl("Volume");
            this.surface.getDisplay().notify("Volume");
            break;
        case 5:
            modeManager.setActive(Modes.PAN);
            this.surface.getConfiguration().setFaderCtrl("Pan");
            this.surface.getDisplay().notify("Pan");
            break;
        case 6:
            if (this.model.isEffectTrackBankActive())
                return;
            Modes mode = Modes.get(modeManager.getActiveID(), 1);
            // Wrap
            if (!Modes.isSendMode(mode))
                mode = Modes.SEND1;
            // Check if Send channel exists
            if (Modes.isSendMode(mode) && tb.canEditSend(mode.ordinal() - Modes.SEND1.ordinal()))
                mode = Modes.SEND1;
            modeManager.setActive(mode);
            final String name = "Send " + (mode.ordinal() - Modes.SEND1.ordinal() + 1);
            this.surface.getConfiguration().setFaderCtrl(name);
            this.surface.getDisplay().notify(name);
            break;
        case 7:
            if (modeManager.isActive(Modes.DEVICE_PARAMS))
                this.model.getBrowser().replace(this.model.getCursorDevice());
            else {
                modeManager.setActive(Modes.DEVICE_PARAMS);
                this.surface.getConfiguration().setFaderCtrl("Device");
                this.surface.getDisplay().notify("Device");
            }
            break;
        default:
            // Not used
            break;
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 22 with Modes

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

the class ControlMode method sendAdditionalForceParameters.

/**
 * Send additional parameters specific to the Force model.
 *
 * @param d The display
 */
private void sendAdditionalForceParameters(final ACVSDisplay d) {
    final Modes activeMode = this.surface.getTrackModeManager().getActiveID();
    final int modeColor = MODE_COLORS.getOrDefault(activeMode, Integer.valueOf(ACVSColorManager.COLOR_BLACK)).intValue();
    for (int trackIndex = 0; trackIndex < 8; trackIndex++) {
        final ITrack track = this.model.getTrackBank().getItem(trackIndex);
        int color;
        if (this.surface.isShiftPressed()) {
            if (LaunchQuantization.values()[trackIndex] == this.model.getTransport().getDefaultLaunchQuantization())
                color = ACVSColorManager.COLOR_SILVER;
            else
                color = ACVSColorManager.COLOR_BLACK;
        } else {
            if (!track.doesExist())
                color = ACVSColorManager.COLOR_BLACK;
            else
                color = track.isSelected() ? ACVSColorManager.COLOR_SILVER : this.colorManager.getColorIndex(DAWColor.getColorIndex(track.getColor()));
        }
        d.setScreenItem(ScreenItem.get(ScreenItem.FORCE_TRACK1_COLOR, trackIndex), color);
        switch(activeMode) {
            case CROSSFADE_MODE_A:
                final double value1 = this.model.getValueChanger().toNormalizedValue(track.getCrossfadeParameter().getValue());
                color = value1 < 0.1 ? modeColor : ACVSColorManager.COLOR_BLACK;
                break;
            case CROSSFADE_MODE_B:
                final double value2 = this.model.getValueChanger().toNormalizedValue(track.getCrossfadeParameter().getValue());
                color = value2 > 0.9 ? modeColor : ACVSColorManager.COLOR_BLACK;
                break;
            case MUTE:
                color = track.isMute() ? modeColor : ACVSColorManager.COLOR_BLACK;
                break;
            case SOLO:
                color = track.isSolo() ? modeColor : ACVSColorManager.COLOR_BLACK;
                break;
            case REC_ARM:
                color = track.isRecArm() ? modeColor : ACVSColorManager.COLOR_BLACK;
                break;
            case STOP_CLIP:
            default:
                color = modeColor;
                break;
        }
        d.setScreenItem(ScreenItem.get(ScreenItem.FORCE_TRACK1_ASSIGN, trackIndex), color);
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrack(de.mossgrabers.framework.daw.data.ITrack)

Example 23 with Modes

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

the class SelectTrackSendOrClipLengthCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.UP)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    if (this.surface.isPressed(ButtonID.SEND1)) {
        final Modes sendModeId = Modes.get(Modes.SEND1, this.index);
        this.surface.setTriggerConsumed(ButtonID.SEND1);
        // Keep the send step selection in sync
        if (this.surface.isMkII())
            ((ModeMultiSelectCommand<?, ?>) this.surface.getButton(ButtonID.SEND1).getCommand()).activateMode(sendModeId);
        else
            modeManager.setActive(sendModeId);
        // Display the sends name
        String modeName = "Send " + (this.index + 1) + ": ";
        final ITrackBank trackBank = this.model.getTrackBank();
        Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
        if (selectedTrack.isEmpty()) {
            final ITrack item = trackBank.getItem(0);
            selectedTrack = item.doesExist() ? Optional.of(item) : Optional.empty();
        }
        if (selectedTrack.isEmpty())
            modeName += "-";
        else
            modeName += selectedTrack.get().getSendBank().getItem(this.index).getName();
        this.surface.getDisplay().notify(modeName);
        return;
    }
    if (this.surface.isMkII() && this.surface.isPressed(ButtonID.SEND2)) {
        modeManager.setActive(Modes.USER);
        this.surface.setTriggerConsumed(ButtonID.USER);
        modeManager.get(Modes.USER).selectItemPage(this.index);
        return;
    }
    this.model.getCurrentTrackBank().getItem(this.index).selectOrExpandGroup();
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 24 with Modes

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

the class TrackCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    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 Modes currentMode = modeManager.getActiveID();
    if (currentMode != null) {
        if (config.isPush2()) {
            if (Modes.TRACK.equals(currentMode) || Modes.VOLUME.equals(currentMode) || Modes.CROSSFADER.equals(currentMode) || Modes.PAN.equals(currentMode)) {
                this.model.toggleCurrentTrackBank();
            } else if (currentMode.ordinal() >= Modes.SEND1.ordinal() && currentMode.ordinal() <= Modes.SEND8.ordinal()) {
                modeManager.setActive(Modes.TRACK);
                this.model.toggleCurrentTrackBank();
            } else
                modeManager.setActive(config.getCurrentMixMode());
        } else {
            // Layer mode selection for Push 1
            if (this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
                modeManager.setActive(Modes.DEVICE_LAYER);
                return;
            }
            if (Modes.TRACK.equals(currentMode))
                this.model.toggleCurrentTrackBank();
            else
                modeManager.setActive(Modes.TRACK);
        }
    } else
        modeManager.setActive(Modes.TRACK);
    config.setDebugMode(modeManager.getActiveID());
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final Optional<ITrack> track = tb.getSelectedItem();
    if (track.isEmpty())
        tb.getItem(0).select();
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) Modes(de.mossgrabers.framework.mode.Modes) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 25 with Modes

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

the class ModeSwitcher method scrollDown.

/**
 * Scroll downwards through the modes.
 */
public void scrollDown() {
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes activeModeId = modeManager.getActiveID();
    if (Modes.PAN == activeModeId) {
        modeManager.setActive(Modes.DEVICE_PARAMS);
        this.surface.getDisplay().notify("Parameters");
    } else if (Modes.VOLUME == activeModeId) {
        modeManager.setActive(Modes.PAN);
        this.surface.getDisplay().notify("Panorama");
    } else if (Modes.TRACK == activeModeId) {
        modeManager.setActive(Modes.VOLUME);
        this.surface.getDisplay().notify("Volume");
    } else {
        modeManager.setActive(Modes.TRACK);
        this.surface.getDisplay().notify("Track");
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

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