Search in sources :

Example 41 with ModeManager

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

the class SwingCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    final ModeManager modeManager = this.surface.getModeManager();
    // Switch Gain/Velocity note edit parameters
    if (modeManager.isActive(Modes.NOTE) && this.surface.getViewManager().isActive(Views.DRUM, Views.PLAY)) {
        if (event == ButtonEvent.DOWN) {
            final EditNoteMode mode = (EditNoteMode) modeManager.get(Modes.NOTE);
            final boolean isPanorama = mode.getSelectedItem() == EditNoteMode.PANORAMA;
            mode.selectItem(isPanorama ? EditNoteMode.DURATION : EditNoteMode.PANORAMA);
            this.surface.getDisplay().notify(isPanorama ? "Duration" : "Panorama");
        }
        return;
    }
    super.execute(event, velocity);
}
Also used : EditNoteMode(de.mossgrabers.controller.ni.maschine.mk3.mode.EditNoteMode) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 42 with ModeManager

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

Example 43 with ModeManager

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

the class RasteredKnobCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final int value) {
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActive(Modes.BROWSER)) {
        final DeviceBrowserMode mode = (DeviceBrowserMode) modeManager.get(Modes.BROWSER);
        mode.changeSelectedColumnValue(value);
        return;
    }
    if (this.surface.isSelectPressed()) {
        this.transport.changeLoopStart(this.model.getValueChanger().isIncrease(value), this.surface.isKnobSensitivitySlow());
        return;
    }
    super.execute(value);
    this.mvHelper.notifyTempo();
}
Also used : DeviceBrowserMode(de.mossgrabers.controller.ableton.push.mode.device.DeviceBrowserMode) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 44 with ModeManager

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

the class SelectPlayViewCommand 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 ViewManager viewManager = this.surface.getViewManager();
    if (Views.isSessionView(viewManager.getActiveID())) {
        final ITrack cursorTrack = this.model.getCursorTrack();
        if (!cursorTrack.doesExist()) {
            this.surface.getDisplay().notify("Please select a track first.");
            return;
        }
        final Views preferredView = viewManager.getPreferredView(cursorTrack.getPosition());
        viewManager.setActive(preferredView == null ? Views.PLAY : preferredView);
        if (modeManager.isActive(Modes.SESSION) || modeManager.isTemporary())
            modeManager.restore();
        return;
    }
    if (modeManager.isActive(Modes.VIEW_SELECT))
        modeManager.restore();
    else
        modeManager.setTemporary(Modes.VIEW_SELECT);
}
Also used : Views(de.mossgrabers.framework.view.Views) ITrack(de.mossgrabers.framework.daw.data.ITrack) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 45 with ModeManager

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

the class PushQuantizeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    final ModeManager modeManager = this.surface.getModeManager();
    if (event == ButtonEvent.LONG || event == ButtonEvent.DOWN && this.surface.isShiftPressed()) {
        modeManager.setTemporary(Modes.REC_ARM);
        this.surface.setTriggerConsumed(ButtonID.QUANTIZE);
        return;
    }
    if (event != ButtonEvent.UP)
        return;
    if (Modes.REC_ARM.equals(modeManager.getActiveID()))
        modeManager.restore();
    else
        this.quantize();
}
Also used : 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