use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class SelectSessionViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event == ButtonEvent.DOWN) {
this.isTemporary = false;
final ViewManager viewManager = this.surface.getViewManager();
final ModeManager modeManager = this.surface.getModeManager();
if (Views.isSessionView(viewManager.getActiveID())) {
if (modeManager.isActive(Modes.SESSION_VIEW_SELECT))
modeManager.restore();
else
modeManager.setTemporary(Modes.SESSION_VIEW_SELECT);
return;
}
// Switch to the preferred session view and display scene/clip mode if enabled
final PushConfiguration configuration = this.surface.getConfiguration();
viewManager.setActive(configuration.isScenesClipViewSelected() ? Views.SCENE_PLAY : Views.SESSION);
if (configuration.shouldDisplayScenesOrClips())
modeManager.setActive(Modes.SESSION);
return;
}
if (event == ButtonEvent.UP && this.isTemporary)
this.surface.getViewManager().restore();
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method registerTriggerCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerTriggerCommands() {
final BeatstepControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
this.addButton(ButtonID.SHIFT, "Shift", (event, value) -> {
if (event == ButtonEvent.DOWN) {
viewManager.setActive(Views.SHIFT);
return;
}
if (event == ButtonEvent.UP) {
if (viewManager.isActive(Views.SHIFT))
viewManager.restore();
// Red LED is turned off on button release, restore the correct color
final BeatstepPadGrid beatstepPadGrid = (BeatstepPadGrid) surface.getPadGrid();
for (int note = 36; note < 52; note++) {
final LightInfo lightInfo = beatstepPadGrid.getLightInfo(note);
beatstepPadGrid.lightPad(note, lightInfo.getColor());
}
}
}, BeatstepControlSurface.BEATSTEP_SHIFT);
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method handleTrackChange.
/**
* Handle a track selection change.
*
* @param isSelected Has the track been selected?
*/
private void handleTrackChange(final boolean isSelected) {
if (!isSelected)
return;
final ViewManager viewManager = this.getSurface().getViewManager();
if (viewManager.isActive(Views.PLAY))
viewManager.getActive().updateNoteMapping();
// Reset drum octave because the drum pad bank is also reset
this.scales.resetDrumOctave();
if (viewManager.isActive(Views.DRUM))
viewManager.get(Views.DRUM).updateNoteMapping();
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class ShiftView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
int viewIndex;
IView view;
final ICursorDevice cursorDevice = this.model.getCursorDevice();
switch(note - 36) {
// Play
case 0:
this.playCommand.executeNormal(ButtonEvent.UP);
break;
// Record
case 1:
this.model.getTransport().startRecording();
break;
// Repeat
case 2:
this.model.getTransport().toggleLoop();
break;
// Click
case 3:
this.model.getTransport().toggleMetronome();
break;
// Tap Tempo
case 4:
this.model.getTransport().tapTempo();
break;
// Insert device before current
case 5:
this.model.getBrowser().insertBeforeCursorDevice();
break;
// Insert device after current
case 6:
this.model.getBrowser().insertAfterCursorDevice();
break;
// Open the browser
case 7:
this.model.getBrowser().replace(cursorDevice);
break;
// Toggle window of VSTs
case 15:
cursorDevice.toggleWindowOpen();
break;
default:
viewIndex = note - 44;
if (viewIndex < 0 || viewIndex >= 6)
return;
final ViewManager viewManager = this.surface.getViewManager();
final Views viewId = VIEWS[viewIndex];
viewManager.setPreviousID(viewId);
view = viewManager.get(viewId);
this.surface.getDisplay().notify(view.getName());
break;
}
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class LaunchpadToggleShiftViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
final ViewManager viewManager = this.surface.getViewManager();
if (event == ButtonEvent.DOWN && (viewManager.isActive(Views.TEMPO) || viewManager.isActive(Views.SHUFFLE))) {
viewManager.restore();
this.surface.setTriggerConsumed(ButtonID.SHIFT);
return;
}
super.execute(event, velocity);
}
Aggregations