use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class LaunchpadControllerSetup method updateButtons.
private void updateButtons() {
final LaunchpadControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final View activeView = viewManager.getActiveView();
if (activeView != null) {
((LaunchpadCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
((SceneView) activeView).updateSceneButtons();
}
if (!this.isPro) {
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_MKII_BUTTON_USER, surface.isUserPressed() ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
return;
}
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_PRO_BUTTON_USER, LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
final boolean isShift = surface.isShiftPressed();
final ITrack selTrack = this.model.getCurrentTrackBank().getSelectedTrack();
final int index = selTrack == null ? -1 : selTrack.getIndex();
final ModeManager modeManager = surface.getModeManager();
final ITransport transport = this.model.getTransport();
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SHIFT, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_CLICK, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : transport.isMetronomeOn() ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_UNDO, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DELETE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_QUANTIZE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DOUBLE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
final boolean flipRecord = surface.getConfiguration().isFlipRecord();
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_RECORD, isShift && !flipRecord || !isShift && flipRecord ? transport.isLauncherOverdub() ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : LaunchpadColors.LAUNCHPAD_COLOR_RED_AMBER : transport.isRecording() ? LaunchpadColors.LAUNCHPAD_COLOR_RED_HI : LaunchpadColors.LAUNCHPAD_COLOR_RED_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_REC_ARM, modeManager.isActiveMode(Modes.MODE_REC_ARM) ? LaunchpadColors.LAUNCHPAD_COLOR_RED : index == 0 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_TRACK, modeManager.isActiveMode(Modes.MODE_TRACK_SELECT) ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN : index == 1 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_MUTE, modeManager.isActiveMode(Modes.MODE_MUTE) ? LaunchpadColors.LAUNCHPAD_COLOR_YELLOW : index == 2 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SOLO, modeManager.isActiveMode(Modes.MODE_SOLO) ? LaunchpadColors.LAUNCHPAD_COLOR_BLUE : index == 3 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_VOLUME, viewManager.isActiveView(Views.VIEW_VOLUME) ? LaunchpadColors.LAUNCHPAD_COLOR_CYAN : index == 4 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_PAN, viewManager.isActiveView(Views.VIEW_PAN) ? LaunchpadColors.LAUNCHPAD_COLOR_SKY : index == 5 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SENDS, viewManager.isActiveView(Views.VIEW_SENDS) ? LaunchpadColors.LAUNCHPAD_COLOR_ORCHID : index == 6 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_STOP_CLIP, modeManager.isActiveMode(Modes.MODE_STOP_CLIP) ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : index == 7 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
// Update the front LED with the color of the current track
final ITrack track = index == -1 ? null : this.model.getCurrentTrackBank().getTrack(index);
final int color = track != null && track.doesExist() ? this.colorManager.getColor(BitwigColors.getColorIndex(track.getColor())) : 0;
surface.sendLaunchpadSysEx("0A 63 " + StringUtils.toHexStr(color));
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class LeftCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack sel = tb.getSelectedTrack();
final int index = sel == null ? 0 : sel.getIndex() - 1;
final View view = this.surface.getViewManager().getActiveView();
if (index == -1 || this.surface.isShiftPressed()) {
if (!tb.canScrollTracksUp())
return;
tb.scrollTracksPageUp();
final int newSel = index == -1 || sel == null ? 7 : sel.getIndex();
this.surface.scheduleTask(() -> view.selectTrack(newSel), 75);
return;
}
view.selectTrack(index);
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class DeviceParamsMode method moveUp.
/**
* Move up the hierarchy.
*/
protected void moveUp() {
// There is no device on the track move upwards to the track view
final ICursorDevice cd = this.model.getCursorDevice();
final View activeView = this.surface.getViewManager().getActiveView();
if (!cd.hasSelectedDevice()) {
activeView.executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
return;
}
// Parameter banks are shown -> show devices
final ModeManager modeManager = this.surface.getModeManager();
final DeviceParamsMode deviceParamsMode = (DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS);
if (!deviceParamsMode.isShowDevices()) {
deviceParamsMode.setShowDevices(true);
return;
}
// Devices are shown, if nested show the layers otherwise move up to the tracks
if (cd.isNested()) {
cd.selectParent();
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
deviceParamsMode.setShowDevices(false);
cd.selectChannel();
return;
}
// Move up to the track
if (this.model.isCursorDeviceOnMasterTrack()) {
activeView.executeTriggerCommand(Commands.COMMAND_MASTERTRACK, ButtonEvent.DOWN);
activeView.executeTriggerCommand(Commands.COMMAND_MASTERTRACK, ButtonEvent.UP);
} else
activeView.executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class PushControllerSetup method createObservers.
/**
* {@inheritDoc}
*/
@Override
protected void createObservers() {
final PushControlSurface surface = this.getSurface();
if (this.configuration.isPush2()) {
this.configuration.addSettingObserver(PushConfiguration.DISPLAY_BRIGHTNESS, surface::sendDisplayBrightness);
this.configuration.addSettingObserver(PushConfiguration.LED_BRIGHTNESS, surface::sendLEDBrightness);
this.configuration.addSettingObserver(PushConfiguration.PAD_SENSITIVITY, () -> {
surface.sendPadVelocityCurve();
surface.sendPadThreshold();
});
this.configuration.addSettingObserver(PushConfiguration.PAD_GAIN, () -> {
surface.sendPadVelocityCurve();
surface.sendPadThreshold();
});
this.configuration.addSettingObserver(PushConfiguration.PAD_DYNAMICS, () -> {
surface.sendPadVelocityCurve();
surface.sendPadThreshold();
});
} else {
this.configuration.addSettingObserver(PushConfiguration.VELOCITY_CURVE, surface::sendPadSensitivity);
this.configuration.addSettingObserver(PushConfiguration.PAD_THRESHOLD, surface::sendPadSensitivity);
}
surface.getModeManager().addModeListener((oldMode, newMode) -> {
this.updateMode(null);
this.updateMode(newMode);
});
surface.getViewManager().addViewChangeListener((previousViewId, activeViewId) -> {
// Update button states
final View view = surface.getViewManager().getActiveView();
for (final int button : surface.getButtons()) {
if (surface.shouldUpdateButton(button))
surface.setButton(button, view.usesButton(button) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
// Update ribbon mode
if (Views.VIEW_SESSION.equals(activeViewId))
surface.setRibbonMode(PushControlSurface.PUSH_RIBBON_PAN);
else
this.updateRibbonMode();
});
this.configuration.addSettingObserver(PushConfiguration.RIBBON_MODE, this::updateRibbonMode);
this.configuration.addSettingObserver(PushConfiguration.SEND_PORT, () -> ((PushDisplay) surface.getDisplay()).setCommunicationPort(this.configuration.getSendPort()));
this.configuration.addSettingObserver(PushConfiguration.DEBUG_MODE, () -> {
final ModeManager modeManager = surface.getModeManager();
final Integer debugMode = this.configuration.getDebugMode();
if (modeManager.getMode(debugMode) != null)
modeManager.setActiveMode(debugMode);
else
this.host.error("Mode " + debugMode + " not registered.");
});
this.createScaleObservers(this.configuration);
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class NoteViewSelectMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1() {
final Display d = this.surface.getDisplay();
final ViewManager viewManager = this.surface.getViewManager();
d.clear().setBlock(1, 0, "Note view:");
for (int i = 0; i < VIEWS.length; i++) {
if (VIEWS[i] != null) {
final View view = viewManager.getView(VIEWS[i]);
d.setCell(3, i, view == null ? "" : (viewManager.isActiveView(VIEWS[i]) ? PushDisplay.RIGHT_ARROW : "") + view.getName());
}
if (VIEWS_TOP[i] != null)
d.setCell(0, i, (viewManager.isActiveView(VIEWS_TOP[i]) ? PushDisplay.RIGHT_ARROW : "") + viewManager.getView(VIEWS_TOP[i]).getName());
}
d.allDone();
}
Aggregations