Search in sources :

Example 1 with IMode

use of de.mossgrabers.framework.featuregroup.IMode in project DrivenByMoss by git-moss.

the class MaschineControllerSetup method registerContinuousCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerContinuousCommands() {
    final MaschineControlSurface surface = this.getSurface();
    final ModeManager modeManager = surface.getModeManager();
    final ViewManager viewManager = surface.getViewManager();
    final IHwRelativeKnob knob = this.addRelativeKnob(ContinuousID.MASTER_KNOB, "Encoder", new MainKnobRowModeCommand(this.model, surface), MaschineControlSurface.ENCODER);
    knob.bindTouch((event, velocity) -> {
        final IMode mode = modeManager.getActive();
        if (mode != null && event != ButtonEvent.LONG)
            mode.onKnobTouch(8, event == ButtonEvent.DOWN);
    }, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.ENCODER_TOUCH);
    if (this.maschine.hasMCUDisplay()) {
        for (int i = 0; i < 8; i++) {
            final int index = i;
            final IHwRelativeKnob modeKnob = this.addRelativeKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), new KnobRowModeCommand<>(i, this.model, surface), MaschineControlSurface.MODE_KNOB_1 + i);
            modeKnob.bindTouch((event, velocity) -> {
                final IMode mode = modeManager.getActive();
                if (mode != null && event != ButtonEvent.LONG)
                    mode.onKnobTouch(index, event == ButtonEvent.DOWN);
            }, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.MODE_KNOB_TOUCH_1 + i);
            modeKnob.setIndexInGroup(i);
        }
    }
    final TouchstripCommand touchstripCommand = new TouchstripCommand(this.model, surface);
    this.addFader(ContinuousID.CROSSFADER, "Touchstrip", touchstripCommand, BindType.CC, MaschineControlSurface.TOUCHSTRIP, false);
    surface.getContinuous(ContinuousID.CROSSFADER).bindTouch(touchstripCommand, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.TOUCHSTRIP_TOUCH);
    // Enable aftertouch
    final Views[] views = { Views.PLAY, Views.DRUM };
    for (final Views viewID : views) {
        final IView view = viewManager.get(viewID);
        view.registerAftertouchCommand(new AftertouchViewCommand<>(view, this.model, surface));
    }
    if (this.maschine == Maschine.STUDIO) {
        final IHwAbsoluteKnob masterKnob = this.addAbsoluteKnob(ContinuousID.MONITOR_KNOB, "Encoder", null, MaschineControlSurface.MONITOR_ENCODER);
        this.encoderManager = new StudioEncoderModeManager(masterKnob, this.model, surface);
        masterKnob.bind(this.encoderManager);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMaster = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.MASTER_VOLUME, this.model, surface);
        this.addButton(ButtonID.ROW4_1, "MST", encoderCommandMaster, MaschineControlSurface.MONITOR_MST, encoderCommandMaster::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandSelectedTrack = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.SELECTED_TRACK_VOLUME, this.model, surface);
        this.addButton(ButtonID.ROW4_2, "GRP", encoderCommandSelectedTrack, MaschineControlSurface.MONITOR_GRP, encoderCommandSelectedTrack::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMetronome = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.METRONOME_VOLUME, this.model, surface);
        this.addButton(ButtonID.ROW4_3, "SND", encoderCommandMetronome, MaschineControlSurface.MONITOR_SND, encoderCommandMetronome::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandCue = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.CUE_VOLUME, this.model, surface);
        this.addButton(ButtonID.ROW4_4, "CUE", encoderCommandCue, MaschineControlSurface.MONITOR_CUE, encoderCommandCue::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMasterPan = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.MASTER_PANORAMA, this.model, surface);
        this.addButton(ButtonID.ROW4_5, "IN1", encoderCommandMasterPan, MaschineControlSurface.MONITOR_IN1, encoderCommandMasterPan::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandSelectedTrackPan = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.SELECTED_TRACK_PANORAMA, this.model, surface);
        this.addButton(ButtonID.ROW4_6, "IN2", encoderCommandSelectedTrackPan, MaschineControlSurface.MONITOR_IN2, encoderCommandSelectedTrackPan::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandCueMix = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.CUE_MIX, this.model, surface);
        this.addButton(ButtonID.ROW4_8, "IN4", encoderCommandCueMix, MaschineControlSurface.MONITOR_IN4, encoderCommandCueMix::isLit);
        this.addButton(ButtonID.TOGGLE_VU, "IN3", (event, value) -> {
            if (event == ButtonEvent.UP)
                this.encoderManager.toggleMode();
        }, MaschineControlSurface.MONITOR_IN3, this.encoderManager::isParameterMode);
        // Activate the default mode
        this.encoderManager.setActiveEncoderMode(EncoderMode.MASTER_VOLUME);
    }
}
Also used : MainKnobRowModeCommand(de.mossgrabers.controller.ni.maschine.mk3.command.continuous.MainKnobRowModeCommand) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) MaschineControlSurface(de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface) IHwRelativeKnob(de.mossgrabers.framework.controller.hardware.IHwRelativeKnob) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) StudioEncoderModeManager(de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager) MaschineMonitorEncoderCommand(de.mossgrabers.controller.ni.maschine.core.command.trigger.MaschineMonitorEncoderCommand) Views(de.mossgrabers.framework.view.Views) IView(de.mossgrabers.framework.featuregroup.IView) IMode(de.mossgrabers.framework.featuregroup.IMode) TouchstripCommand(de.mossgrabers.controller.ni.maschine.mk3.command.continuous.TouchstripCommand) IHwAbsoluteKnob(de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob) StudioEncoderModeManager(de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)

Example 2 with IMode

use of de.mossgrabers.framework.featuregroup.IMode 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 3 with IMode

use of de.mossgrabers.framework.featuregroup.IMode in project DrivenByMoss by git-moss.

the class AssignableCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    final MCUConfiguration configuration = this.surface.getConfiguration();
    switch(this.getSetting()) {
        case MCUConfiguration.FOOTSWITCH_2_PREV_MODE:
            if (event == ButtonEvent.DOWN)
                this.switcher.scrollDown();
            break;
        case MCUConfiguration.FOOTSWITCH_2_NEXT_MODE:
            if (event == ButtonEvent.DOWN)
                this.switcher.scrollUp();
            break;
        case MCUConfiguration.FOOTSWITCH_2_SHOW_MARKER_MODE:
            if (event != ButtonEvent.DOWN)
                return;
            final ModeManager modeManager = this.surface.getModeManager();
            if (modeManager.isActive(Modes.MARKERS))
                modeManager.restore();
            else
                modeManager.setActive(Modes.MARKERS);
            final IMode mode = modeManager.getActive();
            if (mode != null)
                this.surface.getDisplay().notify(mode.getName());
            break;
        case MCUConfiguration.FOOTSWITCH_2_USE_FADERS_LIKE_EDIT_KNOBS:
            this.flipCommand.executeNormal(event);
            break;
        case MCUConfiguration.FOOTSWITCH_2_TOGGLE_MOTOR_FADERS_ON_OFF:
            if (event != ButtonEvent.DOWN)
                return;
            configuration.toggleMotorFaders();
            this.mvHelper.delayDisplay(() -> "Motor Faders: " + (configuration.hasMotorFaders() ? "On" : "Off"));
            break;
        case MCUConfiguration.FOOTSWITCH_2_ACTION:
            if (event != ButtonEvent.DOWN)
                return;
            final String assignableActionID = configuration.getAssignableAction(this.index);
            if (assignableActionID != null)
                this.model.getApplication().invokeAction(assignableActionID);
            break;
        default:
            super.execute(event, velocity);
            break;
    }
}
Also used : MCUConfiguration(de.mossgrabers.controller.mackie.mcu.MCUConfiguration) IMode(de.mossgrabers.framework.featuregroup.IMode) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 4 with IMode

use of de.mossgrabers.framework.featuregroup.IMode in project DrivenByMoss by git-moss.

the class CursorCommand method updateArrowStates.

/**
 * {@inheritDoc}
 */
@Override
protected void updateArrowStates() {
    final ISceneBank sceneBank = this.getSceneBank();
    this.canScrollUp = sceneBank.canScrollBackwards();
    this.canScrollDown = sceneBank.canScrollForwards();
    final IMode mode = this.surface.getModeManager().getActive();
    final boolean shiftPressed = this.surface.isShiftPressed();
    this.canScrollLeft = mode != null && (shiftPressed ? mode.hasPreviousItemPage() : mode.hasPreviousItem());
    this.canScrollRight = mode != null && (shiftPressed ? mode.hasNextItemPage() : mode.hasNextItem());
}
Also used : ISceneBank(de.mossgrabers.framework.daw.data.bank.ISceneBank) IMode(de.mossgrabers.framework.featuregroup.IMode)

Example 5 with IMode

use of de.mossgrabers.framework.featuregroup.IMode in project DrivenByMoss by git-moss.

the class ModeCursorCommand method updateArrowStates.

/**
 * Update the states of the arrow buttons. Override to update arrow states.
 */
protected void updateArrowStates() {
    final IMode mode = this.surface.getModeManager().getActive();
    this.canScrollLeft = mode != null && mode.hasPreviousItem();
    this.canScrollRight = mode != null && mode.hasNextItem();
    this.canScrollUp = mode != null && mode.hasNextItemPage();
    this.canScrollDown = mode != null && mode.hasPreviousItemPage();
}
Also used : IMode(de.mossgrabers.framework.featuregroup.IMode)

Aggregations

IMode (de.mossgrabers.framework.featuregroup.IMode)7 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)4 MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)2 StudioEncoderModeManager (de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)2 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)2 MCUConfiguration (de.mossgrabers.controller.mackie.mcu.MCUConfiguration)1 IKontrol1Mode (de.mossgrabers.controller.ni.kontrol.mki.mode.IKontrol1Mode)1 MaschineMonitorEncoderCommand (de.mossgrabers.controller.ni.maschine.core.command.trigger.MaschineMonitorEncoderCommand)1 MainKnobRowModeCommand (de.mossgrabers.controller.ni.maschine.mk3.command.continuous.MainKnobRowModeCommand)1 TouchstripCommand (de.mossgrabers.controller.ni.maschine.mk3.command.continuous.TouchstripCommand)1 ButtonAreaCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.ButtonAreaCommand)1 DeviceModeCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.DeviceModeCommand)1 SLMkIIIPlayCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.SLMkIIIPlayCommand)1 SLMkIIIToggleLoopCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.SLMkIIIToggleLoopCommand)1 TrackModeCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.TrackModeCommand)1 SLMkIIIControlSurface (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface)1 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)1 BaseMode (de.mossgrabers.controller.novation.slmkiii.mode.BaseMode)1 DrumView (de.mossgrabers.controller.novation.slmkiii.view.DrumView)1 ModeCursorCommand (de.mossgrabers.framework.command.trigger.mode.ModeCursorCommand)1