use of de.mossgrabers.sl.mode.device.DevicePresetsMode in project DrivenByMoss by git-moss.
the class ControlView method updateButtons.
/**
* {@inheritDoc}
*/
@Override
public void updateButtons() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ICursorDevice cd = this.model.getCursorDevice();
final ITransport transport = this.model.getTransport();
final int clipLength = this.surface.getConfiguration().getNewClipLength();
final Integer mode = this.surface.getModeManager().getActiveModeId();
final boolean isTrack = mode == Modes.MODE_TRACK;
final boolean isTrackToggles = mode == Modes.MODE_TRACK_TOGGLES;
final boolean isVolume = mode == Modes.MODE_VOLUME;
final boolean isMaster = mode == Modes.MODE_MASTER;
final boolean isFixed = mode == Modes.MODE_FIXED;
final boolean isFrame = mode == Modes.MODE_FRAME;
final boolean isPreset = mode == Modes.MODE_BROWSER;
final boolean isDevice = mode == Modes.MODE_PARAMS;
final boolean isFunctions = mode == Modes.MODE_FUNCTIONS;
if (mode == Modes.MODE_VIEW_SELECT) {
for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
} else {
// Button row 1: Clip length or functions
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_1, !isFunctions && clipLength == 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_2, !isFunctions && clipLength == 1 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_3, !isFunctions && clipLength == 2 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_4, !isFunctions && clipLength == 3 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_5, !isFunctions && clipLength == 4 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_6, isFunctions && this.model.getCursorDevice().isWindowOpen() || !isFunctions && clipLength == 5 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_7, isFunctions && transport.isMetronomeOn() || !isFunctions && clipLength == 6 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_8, !isFunctions && clipLength == 7 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
}
// Button row 2: Track toggles / Browse
if (mode == Modes.MODE_BROWSER) {
final int selMode = ((DevicePresetsMode) this.surface.getModeManager().getMode(Modes.MODE_BROWSER)).getSelectionMode();
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_1, SLControlSurface.MKII_BUTTON_STATE_ON);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_2, SLControlSurface.MKII_BUTTON_STATE_ON);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_3, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_4, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_5, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_6, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_7, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_8, SLControlSurface.MKII_BUTTON_STATE_ON);
} else {
final boolean isNoOverlayMode = mode != Modes.MODE_FRAME && mode != Modes.MODE_BROWSER;
final ITrack track = tb.getSelectedTrack();
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_1, isNoOverlayMode && track != null && track.isMute() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_2, isNoOverlayMode && track != null && track.isSolo() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_3, isNoOverlayMode && track != null && track.isRecArm() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_4, transport.isWritingArrangerAutomation() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_5, SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_6, this.model.getCursorDevice().isEnabled() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_7, isNoOverlayMode && cd.canSelectPreviousFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_8, isNoOverlayMode && cd.canSelectNextFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
}
// Button row 3: Selected track indication
for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + i, tb.getTrack(i).isSelected() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
// LED indications for device parameters
((DeviceParamsMode) this.surface.getModeManager().getMode(Modes.MODE_PARAMS)).setLEDs();
// Transport buttons
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_3, !transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_4, transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_5, transport.isLoop() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_6, transport.isRecording() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL1, isFunctions || isFixed ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL2, isDevice ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL3, isTrackToggles || isFrame || isPreset ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL4, isTrack || isMaster ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL6, isVolume ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL7, SLControlSurface.MKII_BUTTON_STATE_OFF);
}
use of de.mossgrabers.sl.mode.device.DevicePresetsMode in project DrivenByMoss by git-moss.
the class SLControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final SLControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
modeManager.registerMode(Modes.MODE_FIXED, new FixedMode(surface, this.model));
modeManager.registerMode(Modes.MODE_FRAME, new FrameMode(surface, this.model));
modeManager.registerMode(Modes.MODE_FUNCTIONS, new FunctionMode(surface, this.model));
modeManager.registerMode(Modes.MODE_MASTER, new MasterMode(surface, this.model));
modeManager.registerMode(Modes.MODE_PLAY_OPTIONS, new PlayOptionsMode(surface, this.model));
modeManager.registerMode(Modes.MODE_SESSION, new SessionMode(surface, this.model));
modeManager.registerMode(Modes.MODE_TRACK, new TrackMode(surface, this.model));
modeManager.registerMode(Modes.MODE_TRACK_TOGGLES, new TrackTogglesMode(surface, this.model));
modeManager.registerMode(Modes.MODE_VIEW_SELECT, new ViewSelectMode(surface, this.model));
modeManager.registerMode(Modes.MODE_VOLUME, new VolumeMode(surface, this.model));
modeManager.registerMode(Modes.MODE_PARAMS, new DeviceParamsMode(surface, this.model));
modeManager.registerMode(Modes.MODE_BROWSER, new DevicePresetsMode(surface, this.model));
}
Aggregations