Search in sources :

Example 46 with ModeManager

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

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

the class Drum64View method handleSelectButton.

/**
 * {@inheritDoc}
 */
@Override
protected void handleSelectButton(final int playedPad) {
    // Do we have drum pads?
    final IDrumDevice primary = this.model.getDrumDevice64();
    if (!primary.hasDrumPads())
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    final boolean isNested = cd.isNested();
    if (isNested) {
        // We have to move up to compare the main drum devices
        cd.selectParent();
    }
    // Can only scroll to the channel if the cursor device is the primary device
    if (primary.getPosition() != cd.getPosition())
        return;
    // Align the primary and cursor device drum bank view
    final IDrumPadBank drumPadBank = primary.getDrumPadBank();
    final int scrollPos = drumPadBank.getScrollPosition();
    final IDrumPadBank cdDrumPadBank = cd.getDrumPadBank();
    final int pageSize = cdDrumPadBank.getPageSize();
    final int adjustedPage = playedPad / pageSize * pageSize;
    cdDrumPadBank.scrollTo(scrollPos + adjustedPage, false);
    // Do not reselect, if pad is already selected
    final IDrumPad drumPad = drumPadBank.getItem(playedPad);
    if (drumPad.isSelected()) {
        // If the instrument of the pad was selected for editing, try to select it again
        if (isNested) {
            final IDrumPad selectedItem = cdDrumPadBank.getItem(playedPad % pageSize);
            if (selectedItem != null)
                selectedItem.enter();
        }
        return;
    }
    // Only activate layer mode if not one of the layer modes is already active
    final ModeManager modeManager = this.surface.getModeManager();
    if (!Modes.isLayerMode(modeManager.getActiveID()))
        modeManager.setActive(Modes.DEVICE_LAYER);
    drumPad.select();
}
Also used : IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank) IDrumPad(de.mossgrabers.framework.daw.data.IDrumPad) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 48 with ModeManager

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

the class FireModeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (this.surface.isPressed(ButtonID.ALT)) {
        if (event == ButtonEvent.UP)
            return;
        // Toggle 16 track displays in channel and mixer modes
        final ModeManager modeManager = this.surface.getModeManager();
        switch(modeManager.getActiveID()) {
            case DEVICE_LAYER:
                modeManager.setActive(Modes.DEVICE_LAYER_VOLUME);
                break;
            case DEVICE_LAYER_VOLUME:
                modeManager.setActive(Modes.DEVICE_LAYER);
                break;
            case TRACK:
                modeManager.setActive(Modes.VOLUME);
                break;
            case VOLUME:
                modeManager.setActive(Modes.TRACK);
                break;
            default:
                // Do nothing
                break;
        }
        this.model.getHost().showNotification(modeManager.getActive().getName());
        return;
    }
    super.execute(event, velocity);
}
Also used : ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 49 with ModeManager

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

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

the class GenericFlexiControllerSetup method createModes.

/**
 * {@inheritDoc}
 */
@Override
protected void createModes() {
    final GenericFlexiControlSurface surface = this.getSurface();
    final ModeManager modeManager = surface.getModeManager();
    modeManager.register(Modes.TRACK, new TrackMode<>(surface, this.model, true));
    modeManager.register(Modes.VOLUME, new TrackVolumeMode<>(surface, this.model, true));
    modeManager.register(Modes.PAN, new TrackPanMode<>(surface, this.model, true));
    for (int i = 0; i < 8; i++) modeManager.register(Modes.get(Modes.SEND1, i), new TrackSendMode<>(i, surface, this.model, true));
    modeManager.register(Modes.DEVICE_PARAMS, new ParameterMode<>(surface, this.model, true));
    modeManager.register(Modes.BROWSER, new BrowserMode<>(surface, this.model));
    modeManager.setDefaultID(Modes.VOLUME);
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) TrackSendMode(de.mossgrabers.framework.mode.track.TrackSendMode) 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