Search in sources :

Example 1 with Modes

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

the class DeviceLayerMode method handleSendEffect.

/**
 * Handle the selection of a send effect.
 *
 * @param sendIndex The index of the send
 */
protected void handleSendEffect(final int sendIndex) {
    if (this.model.isEffectTrackBankActive())
        return;
    final ITrackBank fxTrackBank = this.model.getEffectTrackBank();
    if (fxTrackBank == null || !fxTrackBank.getItem(sendIndex).doesExist())
        return;
    final Modes si = Modes.get(Modes.DEVICE_LAYER_SEND1, sendIndex);
    final ModeManager modeManager = this.surface.getModeManager();
    this.setMode(modeManager.isActive(si) ? Modes.DEVICE_LAYER : si);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 2 with Modes

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

the class AbstractTrackMode method handleSendEffect.

/**
 * Handle the selection of a send effect.
 *
 * @param sendIndex The index of the send
 */
protected void handleSendEffect(final int sendIndex) {
    final ITrackBank tb = this.model.getCurrentTrackBank();
    if (tb == null || !tb.canEditSend(sendIndex))
        return;
    final Modes si = Modes.get(Modes.SEND1, sendIndex);
    final ModeManager modeManager = this.surface.getModeManager();
    modeManager.setActive(modeManager.isActive(si) ? Modes.TRACK : si);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 3 with Modes

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

the class AbstractTrackMode method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    final PushConfiguration config = this.surface.getConfiguration();
    final ITrackBank tb = this.model.getCurrentTrackBank();
    int index = this.isButtonRow(0, buttonID);
    if (index >= 0) {
        final ITrack track = tb.getItem(index);
        if (!track.doesExist() || !track.isActivated())
            return this.colorManager.getColorIndex(PushColorManager.PUSH_BLACK);
        final ITrack cursorTrack = this.model.getCursorTrack();
        final int selIndex = cursorTrack.doesExist() ? cursorTrack.getIndex() : -1;
        final boolean isSel = track.getIndex() == selIndex;
        if (track.isRecArm())
            return this.colorManager.getColorIndex(isSel ? PushColorManager.PUSH_RED_HI : PushColorManager.PUSH_RED_LO);
        return this.colorManager.getColorIndex(isSel ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_YELLOW_LO);
    }
    index = this.isButtonRow(1, buttonID);
    if (index >= 0) {
        final ITrack track = tb.getItem(index);
        if (this.isPush2) {
            if (this.surface.isPressed(ButtonID.STOP_CLIP))
                return track.doesExist() && track.isPlaying() ? PushColorManager.PUSH2_COLOR_RED_HI : PushColorManager.PUSH2_COLOR_BLACK;
            if (config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
                final boolean muteState = config.isMuteState();
                return this.getTrackStateColor(muteState, track);
            }
            final ModeManager modeManager = this.surface.getModeManager();
            final boolean sendsAreToggled = config.isSendsAreToggled();
            switch(index) {
                case 0:
                    return modeManager.isActive(Modes.VOLUME) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                case 1:
                    return modeManager.isActive(Modes.PAN) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                case 2:
                    return modeManager.isActive(Modes.CROSSFADER) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                case 4:
                    final Modes sendMode1 = sendsAreToggled ? Modes.SEND5 : Modes.SEND1;
                    return modeManager.isActive(sendMode1) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                case 5:
                    final Modes sendMode2 = sendsAreToggled ? Modes.SEND6 : Modes.SEND2;
                    return modeManager.isActive(sendMode2) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                case 6:
                    final Modes sendMode3 = sendsAreToggled ? Modes.SEND7 : Modes.SEND3;
                    return modeManager.isActive(sendMode3) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                case 7:
                    if (this.lastSendIsAccessible()) {
                        final Modes sendMode4 = sendsAreToggled ? Modes.SEND8 : Modes.SEND4;
                        return modeManager.isActive(sendMode4) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                    }
                    return tb.hasParent() ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                default:
                case 3:
                    return PushColorManager.PUSH2_COLOR_BLACK;
            }
        }
        final boolean muteState = config.isMuteState();
        if (!track.doesExist())
            return PushColorManager.PUSH1_COLOR_BLACK;
        if (muteState)
            return track.isMute() ? PushColorManager.PUSH1_COLOR_BLACK : PushColorManager.PUSH1_COLOR2_YELLOW_HI;
        return track.isSolo() ? PushColorManager.PUSH1_COLOR2_BLUE_HI : PushColorManager.PUSH1_COLOR2_GREY_LO;
    }
    return super.getButtonColor(buttonID);
}
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 4 with Modes

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

the class MaschineControllerSetup method getEncoderColor.

private int getEncoderColor(final ButtonID arrowButton) {
    final MaschineControlSurface surface = this.getSurface();
    final ModeManager modeManager = surface.getModeManager();
    final Modes modeID = modeManager.getActiveID();
    if (modeID == null)
        return MaschineColorManager.COLOR_BLACK;
    final IMode mode = modeManager.getActive();
    boolean isOn;
    switch(arrowButton) {
        case ARROW_LEFT:
            isOn = mode.hasPreviousItem();
            break;
        case ARROW_RIGHT:
            isOn = mode.hasNextItem();
            break;
        case ARROW_UP:
            isOn = mode.hasNextItemPage();
            break;
        case ARROW_DOWN:
            isOn = mode.hasPreviousItemPage();
            break;
        // Never reached
        default:
            return MaschineColorManager.COLOR_BLACK;
    }
    if (!isOn)
        return MaschineColorManager.COLOR_BLACK;
    switch(modeID) {
        case VOLUME:
            return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_BLUE : MaschineColorManager.COLOR_BLUE_LO;
        case PAN:
            return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO;
        case SEND1:
        case SEND2:
        case SEND3:
        case SEND4:
        case SEND5:
        case SEND6:
        case SEND7:
        case SEND8:
            return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_WHITE : MaschineColorManager.COLOR_YELLOW;
        case DEVICE_PARAMS:
        case USER:
            return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO;
        case BROWSER:
            return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_AMBER : MaschineColorManager.COLOR_AMBER_LO;
        case NOTE:
            return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_GREEN : MaschineColorManager.COLOR_GREEN_LO;
        default:
            return MaschineColorManager.COLOR_BLACK;
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) IMode(de.mossgrabers.framework.featuregroup.IMode) MaschineControlSurface(de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) StudioEncoderModeManager(de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)

Example 5 with Modes

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

the class MaschineSendSelectCommand method executeShifted.

/**
 * {@inheritDoc}
 */
@Override
public void executeShifted(final ButtonEvent event) {
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes activeMode = modeManager.getActiveID();
    super.executeShifted(event);
    final Modes newMode = modeManager.getActiveID();
    if (activeMode == newMode)
        return;
    final int sendIndex = newMode.ordinal() - Modes.SEND1.ordinal();
    final Optional<ITrack> t = this.model.getCurrentTrackBank().getSelectedItem();
    if (t.isEmpty())
        return;
    final ISendBank sendBank = t.get().getSendBank();
    final ISend send = sendBank.getItem(sendIndex);
    if (send.doesExist())
        this.surface.getDisplay().notify("Send " + (sendIndex + 1) + ": " + send.getName());
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISend(de.mossgrabers.framework.daw.data.ISend) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) 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