Search in sources :

Example 21 with ModeManager

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

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

the class MastertrackCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    // Avoid accidentally leaving the browser
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActive(Modes.BROWSER))
        return;
    switch(event) {
        case DOWN:
            this.quitMasterMode = false;
            break;
        case UP:
            this.handleButtonUp(modeManager);
            break;
        case LONG:
            this.quitMasterMode = true;
            modeManager.setTemporary(Modes.FRAME);
            break;
    }
}
Also used : ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 23 with ModeManager

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

the class SLControllerSetup method flush.

/**
 * {@inheritDoc}
 */
@Override
public void flush() {
    super.flush();
    // Always refresh volume mode
    final ModeManager modeManager = this.getSurface().getModeManager();
    if (!modeManager.isActive(Modes.VOLUME))
        modeManager.get(Modes.VOLUME).updateDisplay();
}
Also used : ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 24 with ModeManager

use of de.mossgrabers.framework.featuregroup.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.register(Modes.VOLUME, new SLVolumeMode(surface, this.model));
    modeManager.register(Modes.TRACK, new SLTrackMode(surface, this.model));
    modeManager.register(Modes.DEVICE_PARAMS, new SLParameterMode(surface, this.model));
    modeManager.register(Modes.FIXED, new FixedMode(surface, this.model));
    modeManager.register(Modes.FRAME, new FrameMode(surface, this.model));
    modeManager.register(Modes.FUNCTIONS, new FunctionMode(surface, this.model));
    modeManager.register(Modes.PLAY_OPTIONS, new PlayOptionsMode(surface, this.model));
    modeManager.register(Modes.SESSION, new SessionMode(surface, this.model));
    modeManager.register(Modes.TRACK_DETAILS, new TrackTogglesMode(surface, this.model));
    modeManager.register(Modes.VIEW_SELECT, new ViewSelectMode(surface, this.model));
    modeManager.register(Modes.BROWSER, new DevicePresetsMode(surface, this.model));
}
Also used : TrackTogglesMode(de.mossgrabers.controller.novation.sl.mode.TrackTogglesMode) SLParameterMode(de.mossgrabers.controller.novation.sl.mode.device.SLParameterMode) FunctionMode(de.mossgrabers.controller.novation.sl.mode.FunctionMode) SLControlSurface(de.mossgrabers.controller.novation.sl.controller.SLControlSurface) FixedMode(de.mossgrabers.controller.novation.sl.mode.FixedMode) SLVolumeMode(de.mossgrabers.controller.novation.sl.mode.SLVolumeMode) SessionMode(de.mossgrabers.controller.novation.sl.mode.SessionMode) SLTrackMode(de.mossgrabers.controller.novation.sl.mode.SLTrackMode) DevicePresetsMode(de.mossgrabers.controller.novation.sl.mode.device.DevicePresetsMode) ViewSelectMode(de.mossgrabers.controller.novation.sl.mode.ViewSelectMode) FrameMode(de.mossgrabers.controller.novation.sl.mode.FrameMode) PlayOptionsMode(de.mossgrabers.controller.novation.sl.mode.PlayOptionsMode) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 25 with ModeManager

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

the class SLControllerSetup method registerContinuousCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerContinuousCommands() {
    final SLControlSurface surface = this.getSurface();
    for (int i = 0; i < 8; i++) {
        final int index = i;
        this.addFader(ContinuousID.get(ContinuousID.FADER1, i), "Fader " + (i + 1), null, BindType.CC, SLControlSurface.MKII_SLIDER1 + i);
        final IHwRelativeKnob relativeKnob = this.addRelativeKnob(ContinuousID.get(ContinuousID.DEVICE_KNOB1, i), "Device Knob " + (i + 1), null, SLControlSurface.MKII_KNOB_ROW1_1 + i, RelativeEncoding.SIGNED_BIT);
        relativeKnob.addOutput(() -> {
            final boolean hasDevice = this.model.hasSelectedDevice();
            final IParameterBank parameterBank = this.model.getCursorDevice().getParameterBank();
            return hasDevice ? parameterBank.getItem(index).getValue() : 0;
        }, value -> surface.getMidiOutput().sendCC(0x70 + index, Math.min(value * 11 / 127, 11)));
        this.addAbsoluteKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), null, SLControlSurface.MKII_KNOB_ROW2_1 + i);
    }
    this.addFader(ContinuousID.TOUCHPAD_X, "Touchpad X", new TouchpadCommand(true, this.model, surface), BindType.CC, SLControlSurface.MKII_TOUCHPAD_X);
    this.addFader(ContinuousID.TOUCHPAD_Y, "Touchpad Y", new TouchpadCommand(false, this.model, surface), BindType.CC, SLControlSurface.MKII_TOUCHPAD_Y);
    // These are no faders but cannot be mapped to any meaningful control anyway
    this.addFader(ContinuousID.HELLO, "Tap Init", new TapTempoInitMkICommand(this.model, surface), BindType.CC, SLControlSurface.MKI_BUTTON_TAP_TEMPO);
    this.addFader(ContinuousID.TEMPO, "Tap Tempo", new TapTempoMkICommand(this.model, surface), BindType.CC, SLControlSurface.MKI_BUTTON_TAP_TEMPO_VALUE);
    // Volume, Track and Parameter modes are always bound since they have dedicated controls
    final ModeManager modeManager = surface.getModeManager();
    modeManager.get(Modes.VOLUME).onActivate();
    modeManager.get(Modes.TRACK).onActivate();
    modeManager.get(Modes.DEVICE_PARAMS).onActivate();
}
Also used : IHwRelativeKnob(de.mossgrabers.framework.controller.hardware.IHwRelativeKnob) TapTempoMkICommand(de.mossgrabers.controller.novation.sl.command.continuous.TapTempoMkICommand) TapTempoInitMkICommand(de.mossgrabers.controller.novation.sl.command.continuous.TapTempoInitMkICommand) SLControlSurface(de.mossgrabers.controller.novation.sl.controller.SLControlSurface) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) TouchpadCommand(de.mossgrabers.controller.novation.sl.command.continuous.TouchpadCommand) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Aggregations

ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)90 Modes (de.mossgrabers.framework.mode.Modes)22 ITrack (de.mossgrabers.framework.daw.data.ITrack)15 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)15 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)11 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)10 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)6 MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)4 StudioEncoderModeManager (de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)4 EditNoteMode (de.mossgrabers.controller.ni.maschine.mk3.mode.EditNoteMode)4 StepState (de.mossgrabers.framework.daw.StepState)4 INoteMode (de.mossgrabers.framework.mode.INoteMode)4 IMode (de.mossgrabers.framework.featuregroup.IMode)3 NoteMode (de.mossgrabers.controller.akai.apc.mode.NoteMode)2 MCUConfiguration (de.mossgrabers.controller.mackie.mcu.MCUConfiguration)2 SLControlSurface (de.mossgrabers.controller.novation.sl.controller.SLControlSurface)2 SLMkIIIControlSurface (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)2 IHwRelativeKnob (de.mossgrabers.framework.controller.hardware.IHwRelativeKnob)2 INoteClip (de.mossgrabers.framework.daw.INoteClip)2