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;
}
}
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);
}
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);
}
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());
}
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);
}
Aggregations