Search in sources :

Example 26 with ViewManager

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

the class AbstractTrackCommand method onFaderModeButton.

protected void onFaderModeButton(final ButtonEvent event, final Views view, final String notification) {
    final ViewManager viewManager = this.surface.getViewManager();
    switch(event) {
        case DOWN:
            if (viewManager.isActive(view)) {
                this.surface.getViewManager().setActive(Views.SESSION);
                return;
            }
            this.temporaryView = false;
            this.surface.getModeManager().setActive(Modes.DUMMY);
            viewManager.setActive(view);
            this.surface.getDisplay().notify(notification);
            break;
        case LONG:
            this.temporaryView = true;
            break;
        case UP:
            if (this.temporaryView)
                viewManager.restore();
            break;
    }
}
Also used : ViewManager(de.mossgrabers.framework.featuregroup.ViewManager)

Example 27 with ViewManager

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

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

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

the class ShiftView method switchToView.

private void switchToView(final Views viewID) {
    final ViewManager viewManager = this.surface.getViewManager();
    viewManager.setActive(viewID);
    this.surface.getDisplay().notify(viewManager.get(viewID).getName());
}
Also used : ViewManager(de.mossgrabers.framework.featuregroup.ViewManager)

Example 30 with ViewManager

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

the class APCTapTempoCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    super.execute(event, velocity);
    final ViewManager viewManager = this.surface.getViewManager();
    if (!viewManager.isActive(Views.TEMPO))
        viewManager.setTemporary(Views.TEMPO);
    this.timeout.delay(viewManager::restore);
}
Also used : ViewManager(de.mossgrabers.framework.featuregroup.ViewManager)

Aggregations

ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)58 ITrack (de.mossgrabers.framework.daw.data.ITrack)12 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)11 Views (de.mossgrabers.framework.view.Views)11 INoteMode (de.mossgrabers.framework.mode.INoteMode)5 BeatstepControlSurface (de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface)4 MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)4 IView (de.mossgrabers.framework.featuregroup.IView)4 DrumView (de.mossgrabers.controller.ni.maschine.mk3.view.DrumView)3 ConfiguredRecordCommand (de.mossgrabers.framework.command.trigger.transport.ConfiguredRecordCommand)3 FeatureGroupButtonColorSupplier (de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier)3 IHost (de.mossgrabers.framework.daw.IHost)3 ITransport (de.mossgrabers.framework.daw.ITransport)3 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)3 PlayView (de.mossgrabers.controller.arturia.beatstep.view.PlayView)2 LaunchkeyMk3ControlSurface (de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface)2 LaunchkeyMiniMk3ControlSurface (de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ControlSurface)2 SLMkIIIControlSurface (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface)2 DrumView (de.mossgrabers.controller.novation.slmkiii.view.DrumView)2 Configuration (de.mossgrabers.framework.configuration.Configuration)2