use of de.mossgrabers.framework.view.SceneView 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.SceneView in project DrivenByMoss by git-moss.
the class PushControllerSetup method updateButtons.
private void updateButtons() {
final ITransport t = this.model.getTransport();
final PushControlSurface surface = this.getSurface();
surface.updateButton(PushControlSurface.PUSH_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_PLAY, t.isPlaying() ? PushColors.PUSH_BUTTON_STATE_PLAY_HI : PushColors.PUSH_BUTTON_STATE_PLAY_ON);
final boolean isShift = surface.isShiftPressed();
final boolean isFlipRecord = this.configuration.isFlipRecord();
final boolean isRecordShifted = isShift && !isFlipRecord || !isShift && isFlipRecord;
if (isRecordShifted)
surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingClipLauncherAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
else
surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingArrangerAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_RECORD, isRecordShifted ? t.isLauncherOverdub() ? PushColors.PUSH_BUTTON_STATE_OVR_HI : PushColors.PUSH_BUTTON_STATE_OVR_ON : t.isRecording() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, this.configuration.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
final PushConfiguration config = surface.getConfiguration();
if (this.isPush2) {
final ModeManager modeManager = surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER)) {
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel layer = cd.getSelectedLayerOrDrumPad();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, layer != null && layer.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, layer != null && layer.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
} else {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = modeManager.isActiveMode(Modes.MODE_MASTER) ? this.model.getMasterTrack() : tb.getSelectedTrack();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, selTrack != null && selTrack.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, selTrack != null && selTrack.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
}
surface.updateButton(PushControlSurface.PUSH_BUTTON_CONVERT, this.model.canConvertClip() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
final boolean isMuteState = config.isMuteState();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, isMuteState ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, !isMuteState ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
}
final ViewManager viewManager = surface.getViewManager();
final boolean isSessionView = Views.isSessionView(viewManager.getActiveViewId());
surface.updateButton(PushControlSurface.PUSH_BUTTON_NOTE, isSessionView ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
if (this.host.hasClips()) {
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) ? PushColors.PUSH_BUTTON_STATE_STOP_HI : PushColors.PUSH_BUTTON_STATE_STOP_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, isSessionView ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
} else {
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, ColorManager.BUTTON_STATE_OFF);
}
surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, config.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
final View activeView = viewManager.getActiveView();
if (activeView != null) {
((PushCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
((SceneView) activeView).updateSceneButtons();
}
final ICursorClip clip = activeView instanceof AbstractSequencerView && !(activeView instanceof ClipView) ? ((AbstractSequencerView<?, ?>) activeView).getClip() : null;
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_LEFT, clip != null && clip.canScrollStepsBackwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_RIGHT, clip != null && clip.canScrollStepsForwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
use of de.mossgrabers.framework.view.SceneView in project DrivenByMoss by git-moss.
the class APCControllerSetup method updateButtons.
private void updateButtons() {
final APCControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final View activeView = viewManager.getActiveView();
if (activeView != null) {
((APCCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
((SceneView) activeView).updateSceneButtons();
}
final boolean isShift = surface.isShiftPressed();
final boolean isSendA = surface.isPressed(APCControlSurface.APC_BUTTON_SEND_A);
final ITransport t = this.model.getTransport();
surface.updateButton(APCControlSurface.APC_BUTTON_PLAY, t.isPlaying() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_RECORD, t.isRecording() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
// Activator, Solo, Record Arm
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
final int clipLength = surface.getConfiguration().getNewClipLength();
final ModeManager modeManager = surface.getModeManager();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
boolean isOn;
if (isShift)
isOn = i == clipLength;
else
isOn = isSendA ? modeManager.isActiveMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + i)) : i == selIndex;
surface.updateButtonEx(APCControlSurface.APC_BUTTON_TRACK_SELECTION, i, isOn ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_SOLO, i, track.doesExist() && (isShift ? track.isAutoMonitor() : track.isSolo()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_ACTIVATOR, i, track.doesExist() && (isShift ? track.isMonitor() : !track.isMute()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
if (this.isMkII) {
surface.updateButtonEx(APCControlSurface.APC_BUTTON_A_B, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
if (isShift)
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
else
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
}
surface.updateButton(APCControlSurface.APC_BUTTON_MASTER, this.model.getMasterTrack().isSelected() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
final ICursorDevice device = this.model.getCursorDevice();
if (this.isMkII) {
surface.updateButton(APCControlSurface.APC_BUTTON_SESSION, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_SEND_C, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_BANK, this.model.getBrowser().isActive() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
}
this.updateDeviceKnobs();
}
Aggregations