use of de.mossgrabers.push.controller.PushControlSurface in project DrivenByMoss by git-moss.
the class PushControllerSetup method flush.
/**
* {@inheritDoc}
*/
@Override
public void flush() {
this.flushSurfaces();
this.updateButtons();
final PushControlSurface surface = this.getSurface();
this.updateMode(surface.getModeManager().getActiveModeId());
final View activeView = surface.getViewManager().getActiveView();
if (activeView == null)
return;
final de.mossgrabers.framework.command.core.PitchbendCommand pitchbendCommand = activeView.getPitchbendCommand();
if (pitchbendCommand != null)
pitchbendCommand.updateValue();
}
use of de.mossgrabers.push.controller.PushControlSurface in project DrivenByMoss by git-moss.
the class PushControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final PushControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
modeManager.registerMode(Modes.MODE_VOLUME, new VolumeMode(surface, this.model));
modeManager.registerMode(Modes.MODE_PAN, new PanMode(surface, this.model));
modeManager.registerMode(Modes.MODE_CROSSFADER, new CrossfaderMode(surface, this.model));
final SendMode modeSend = new SendMode(surface, this.model);
modeManager.registerMode(Modes.MODE_SEND1, modeSend);
modeManager.registerMode(Modes.MODE_SEND2, modeSend);
modeManager.registerMode(Modes.MODE_SEND3, modeSend);
modeManager.registerMode(Modes.MODE_SEND4, modeSend);
modeManager.registerMode(Modes.MODE_SEND5, modeSend);
modeManager.registerMode(Modes.MODE_SEND6, modeSend);
modeManager.registerMode(Modes.MODE_MASTER, new MasterMode(surface, this.model, false));
modeManager.registerMode(Modes.MODE_MASTER_TEMP, new MasterMode(surface, this.model, true));
modeManager.registerMode(Modes.MODE_TRACK, new TrackMode(surface, this.model));
modeManager.registerMode(Modes.MODE_TRACK_DETAILS, new TrackDetailsMode(surface, this.model));
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_DETAILS, new LayerDetailsMode(surface, this.model));
modeManager.registerMode(Modes.MODE_CLIP, new ClipMode(surface, this.model));
modeManager.registerMode(Modes.MODE_NOTE, new NoteMode(surface, this.model));
modeManager.registerMode(Modes.MODE_FRAME, new FrameMode(surface, this.model));
modeManager.registerMode(Modes.MODE_SCALES, new ScalesMode(surface, this.model));
modeManager.registerMode(Modes.MODE_SCALE_LAYOUT, new ScaleLayoutMode(surface, this.model));
modeManager.registerMode(Modes.MODE_ACCENT, new AccentMode(surface, this.model));
modeManager.registerMode(Modes.MODE_FIXED, new FixedMode(surface, this.model));
modeManager.registerMode(Modes.MODE_RIBBON, new RibbonMode(surface, this.model));
modeManager.registerMode(Modes.MODE_GROOVE, new GrooveMode(surface, this.model));
modeManager.registerMode(Modes.MODE_VIEW_SELECT, new NoteViewSelectMode(surface, this.model));
modeManager.registerMode(Modes.MODE_AUTOMATION, new AutomationMode(surface, this.model));
modeManager.registerMode(Modes.MODE_TRANSPORT, new TransportMode(surface, this.model));
modeManager.registerMode(Modes.MODE_DEVICE_PARAMS, new DeviceParamsMode(surface, this.model));
modeManager.registerMode(Modes.MODE_DEVICE_LAYER, new DeviceLayerMode(surface, this.model));
modeManager.registerMode(Modes.MODE_BROWSER, new DeviceBrowserMode(surface, this.model));
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_VOLUME, new DeviceLayerModeVolume(surface, this.model));
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_PAN, new DeviceLayerModePan(surface, this.model));
final DeviceLayerModeSend modeLayerSend = new DeviceLayerModeSend(surface, this.model);
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_SEND1, modeLayerSend);
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_SEND2, modeLayerSend);
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_SEND3, modeLayerSend);
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_SEND4, modeLayerSend);
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_SEND5, modeLayerSend);
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_SEND6, modeLayerSend);
if (this.isPush2) {
modeManager.registerMode(Modes.MODE_SEND7, modeSend);
modeManager.registerMode(Modes.MODE_SEND8, modeSend);
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_SEND7, modeLayerSend);
modeManager.registerMode(Modes.MODE_DEVICE_LAYER_SEND8, modeLayerSend);
modeManager.registerMode(Modes.MODE_SETUP, new SetupMode(surface, this.model));
modeManager.registerMode(Modes.MODE_INFO, new InfoMode(surface, this.model));
} else
modeManager.registerMode(Modes.MODE_CONFIGURATION, new ConfigurationMode(surface, this.model));
if (this.host.hasClips()) {
modeManager.registerMode(Modes.MODE_SESSION_VIEW_SELECT, new SessionViewSelectMode(surface, this.model));
}
}
use of de.mossgrabers.push.controller.PushControlSurface in project DrivenByMoss by git-moss.
the class PushControllerSetup method updateMode.
private void updateMode(final Integer mode) {
if (mode == null)
return;
this.updateIndication(mode);
final boolean isMasterOn = Modes.MODE_MASTER.equals(mode) || Modes.MODE_MASTER_TEMP.equals(mode) || Modes.MODE_FRAME.equals(mode);
final boolean isVolumeOn = Modes.MODE_VOLUME.equals(mode) || Modes.MODE_CROSSFADER.equals(mode);
final boolean isPanOn = mode.intValue() >= Modes.MODE_PAN.intValue() && mode.intValue() <= Modes.MODE_SEND8.intValue();
final boolean isDeviceOn = Modes.isDeviceMode(mode);
boolean isMixOn = Modes.MODE_TRACK.equals(mode);
if (this.isPush2)
isMixOn = isMixOn || isVolumeOn || isPanOn;
final PushControlSurface surface = this.getSurface();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MASTER, isMasterOn ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_TRACK, isMixOn ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_VOLUME, isVolumeOn ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_PAN_SEND, isPanOn ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE, isDeviceOn ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SCALES, Modes.MODE_SCALES.equals(mode) ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_FIXED_LENGTH, Modes.MODE_FIXED.equals(mode) ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_BROWSE, Modes.MODE_BROWSER.equals(mode) ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP, Modes.MODE_CLIP.equals(mode) ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
if (this.isPush2)
surface.updateButton(PushControlSurface.PUSH_BUTTON_SETUP, Modes.MODE_SETUP.equals(mode) ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
}
use of de.mossgrabers.push.controller.PushControlSurface 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);
}
Aggregations