Search in sources :

Example 16 with Modes

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

the class ControlView method onButtonRow1.

/**
 * {@inheritDoc}
 */
@Override
public void onButtonRow1(final int index, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    Modes activeModeId = modeManager.getActiveID();
    if (Modes.VIEW_SELECT == activeModeId) {
        if (index == 1) {
            this.surface.getViewManager().setActive(Views.PLAY);
            if (Modes.VOLUME.equals(modeManager.getPreviousID()))
                modeManager.restore();
            else
                modeManager.setActive(Modes.SESSION);
        } else
            modeManager.restore();
        this.surface.turnOffTransport();
        return;
    }
    if (!Modes.FUNCTIONS.equals(activeModeId) && !Modes.FIXED.equals(activeModeId)) {
        modeManager.setActive(Modes.FUNCTIONS);
        activeModeId = Modes.FUNCTIONS;
    }
    if (Modes.FIXED.equals(activeModeId)) {
        this.surface.getConfiguration().setNewClipLength(index);
        return;
    }
    switch(index) {
        // Undo
        case 0:
            this.model.getApplication().undo();
            break;
        // Redo
        case 1:
            this.model.getApplication().redo();
            break;
        // Delete
        case 2:
            this.model.getApplication().deleteSelection();
            break;
        // Double
        case 3:
            this.model.getApplication().duplicate();
            break;
        // New
        case 4:
            this.newCommand.execute();
            break;
        // Open the VST window
        case 5:
            this.model.getCursorDevice().toggleWindowOpen();
            break;
        // Metronome
        case 6:
            this.model.getTransport().toggleMetronome();
            break;
        // Tap Tempo on MKII
        case 7:
            this.model.getTransport().tapTempo();
            break;
        default:
            // Not used
            break;
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 17 with Modes

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

the class ModeMultiSelectCommand method executeShifted.

/**
 * {@inheritDoc}
 */
@Override
public void executeShifted(final ButtonEvent event) {
    if (event != ButtonEvent.UP)
        return;
    final Modes activeModeId = this.modeManager.getActiveID();
    Modes newMode = this.currentModeID;
    // If coming from a mode not on the list, activate the last one
    if (this.currentModeID.equals(activeModeId)) {
        final ITrackBank trackBank = this.model.getTrackBank();
        int index = this.modeIds.indexOf(activeModeId);
        // If a send mode is selected check if the according send exists
        do {
            index--;
            if (index < 0 || index >= this.modeIds.size())
                index = this.modeIds.size() - 1;
            newMode = this.modeIds.get(index);
        } while (Modes.isSendMode(newMode) && !trackBank.canEditSend(newMode.ordinal() - Modes.SEND1.ordinal()));
    }
    this.activateMode(newMode);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank)

Example 18 with Modes

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

the class ShiftView method getTrackButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getTrackButtonColor(final int index) {
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ISceneBank sceneBank = tb.getSceneBank();
    final Modes mode = this.surface.getModeManager().getActiveID();
    switch(index) {
        case 0:
            return sceneBank.canScrollPageBackwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 1:
            return sceneBank.canScrollPageForwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 2:
            return tb.canScrollPageBackwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 3:
            return tb.canScrollPageForwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 4:
            return Modes.VOLUME.equals(mode) ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 5:
            return Modes.PAN.equals(mode) ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 6:
            return Modes.isSendMode(mode) ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        case 7:
            return Modes.DEVICE_PARAMS.equals(mode) ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
        default:
            // Never reached
            break;
    }
    return APCminiColorManager.APC_COLOR_BLACK;
}
Also used : ISceneBank(de.mossgrabers.framework.daw.data.bank.ISceneBank) Modes(de.mossgrabers.framework.mode.Modes) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank)

Example 19 with Modes

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

the class ModeSwitcher method scrollUp.

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

Example 20 with Modes

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

the class AbstractControllerSetup method test.

/**
 * {@inheritDoc}
 */
@Override
public void test(final TestCallback callback) {
    final TestFramework framework = new TestFramework(this.host);
    this.getSurfaces().forEach(surface -> {
        framework.scheduleFunction(() -> this.host.println("Testing controller: " + this.getClass().getName()));
        final ViewManager viewManager = surface.getViewManager();
        final ModeManager modeManager = surface.getModeManager();
        final int max = this.model.getValueChanger().getUpperBound() - 1;
        for (final Views viewID : Views.values()) {
            if (viewManager.get(viewID) == null)
                continue;
            for (final Modes modeID : Modes.values()) {
                if (modeManager.get(modeID) == null)
                    continue;
                framework.scheduleFunction(() -> {
                    this.host.println("- View " + viewID + " Mode " + modeID);
                    viewManager.setActive(viewID);
                    modeManager.setActive(modeID);
                    for (final ButtonID buttonID : ButtonID.values()) {
                        final IHwButton button = surface.getButton(buttonID);
                        if (button == null)
                            continue;
                        button.trigger(ButtonEvent.DOWN);
                        button.trigger(ButtonEvent.LONG);
                        button.trigger(ButtonEvent.UP);
                    }
                    for (final ContinuousID continuousID : ContinuousID.values()) {
                        final IHwContinuousControl continuous = surface.getContinuous(continuousID);
                        if (continuous == null)
                            continue;
                        final TriggerCommand touchCommand = continuous.getTouchCommand();
                        if (touchCommand != null) {
                            touchCommand.execute(ButtonEvent.DOWN, 127);
                            touchCommand.execute(ButtonEvent.LONG, 127);
                            touchCommand.execute(ButtonEvent.UP, 0);
                        }
                        final ContinuousCommand command = continuous.getCommand();
                        if (command != null) {
                            command.execute(0);
                            command.execute(max);
                            command.execute(max / 2);
                        }
                        final PitchbendCommand pitchbendCommand = continuous.getPitchbendCommand();
                        if (pitchbendCommand != null) {
                            pitchbendCommand.onPitchbend(0, 0);
                            pitchbendCommand.onPitchbend(0, 127);
                            pitchbendCommand.onPitchbend(0, 64);
                        }
                    }
                });
            }
        }
    });
    callback.startTesting();
    framework.executeScheduler(callback);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) Views(de.mossgrabers.framework.view.Views) TriggerCommand(de.mossgrabers.framework.command.core.TriggerCommand) ContinuousCommand(de.mossgrabers.framework.command.core.ContinuousCommand) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) IHwButton(de.mossgrabers.framework.controller.hardware.IHwButton) TestFramework(de.mossgrabers.framework.utils.TestFramework) PitchbendCommand(de.mossgrabers.framework.command.core.PitchbendCommand) IHwContinuousControl(de.mossgrabers.framework.controller.hardware.IHwContinuousControl) 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