use of de.mossgrabers.controller.novation.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.register(Modes.VOLUME, new SLVolumeMode(surface, this.model));
modeManager.register(Modes.TRACK, new SLTrackMode(surface, this.model));
modeManager.register(Modes.DEVICE_PARAMS, new SLParameterMode(surface, this.model));
modeManager.register(Modes.FIXED, new FixedMode(surface, this.model));
modeManager.register(Modes.FRAME, new FrameMode(surface, this.model));
modeManager.register(Modes.FUNCTIONS, new FunctionMode(surface, this.model));
modeManager.register(Modes.PLAY_OPTIONS, new PlayOptionsMode(surface, this.model));
modeManager.register(Modes.SESSION, new SessionMode(surface, this.model));
modeManager.register(Modes.TRACK_DETAILS, new TrackTogglesMode(surface, this.model));
modeManager.register(Modes.VIEW_SELECT, new ViewSelectMode(surface, this.model));
modeManager.register(Modes.BROWSER, new DevicePresetsMode(surface, this.model));
}
use of de.mossgrabers.controller.novation.sl.mode.device.DevicePresetsMode in project DrivenByMoss by git-moss.
the class ControlView method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final ICursorDevice cd = this.model.getCursorDevice();
final ITransport transport = this.model.getTransport();
final int clipLength = this.surface.getConfiguration().getNewClipLength();
final Modes mode = this.surface.getModeManager().getActiveID();
final boolean isFunctions = Modes.FUNCTIONS.equals(mode);
final boolean isViewSelectMode = Modes.VIEW_SELECT.equals(mode);
switch(buttonID) {
case ROW1_1:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_2:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 1 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_3:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 2 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_4:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 3 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_5:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 4 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_6:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return isFunctions && this.model.getCursorDevice().isWindowOpen() || !isFunctions && clipLength == 5 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_7:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return isFunctions && transport.isMetronomeOn() || !isFunctions && clipLength == 6 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_8:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 7 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
// Fall through
break;
}
// Button row 2: Track toggles / Browse
if (Modes.BROWSER.equals(mode)) {
final int selMode = ((DevicePresetsMode) this.surface.getModeManager().get(Modes.BROWSER)).getSelectionMode();
switch(buttonID) {
case ROW2_1:
case ROW2_2:
case ROW2_8:
return SLControlSurface.MKII_BUTTON_STATE_ON;
case ROW2_3:
case ROW2_4:
case ROW2_5:
case ROW2_6:
case ROW2_7:
return selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
// Fall through
break;
}
} else {
final boolean isNoOverlayMode = !Modes.FRAME.equals(mode) && !Modes.BROWSER.equals(mode);
final Optional<ITrack> track = tb.getSelectedItem();
switch(buttonID) {
case ROW2_1:
return isNoOverlayMode && track.isPresent() && track.get().isMute() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_2:
return isNoOverlayMode && track.isPresent() && track.get().isSolo() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_3:
return isNoOverlayMode && track.isPresent() && track.get().isRecArm() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_4:
return transport.isWritingArrangerAutomation() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_5:
return SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_6:
return this.model.getCursorDevice().isEnabled() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_7:
return isNoOverlayMode && cd.canSelectPreviousFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_8:
return isNoOverlayMode && cd.canSelectNextFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
// Fall through
break;
}
}
// Button row 3: Selected track indication
final int buttonIDOrdinal = buttonID.ordinal();
if (buttonIDOrdinal >= ButtonID.ROW3_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW3_8.ordinal()) {
final int index = buttonIDOrdinal - ButtonID.ROW3_1.ordinal();
return tb.getItem(index).isSelected() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
}
final boolean isTrack = Modes.TRACK.equals(mode);
final boolean isTrackToggles = Modes.TRACK_DETAILS.equals(mode);
final boolean isVolume = Modes.VOLUME.equals(mode);
final boolean isFixed = Modes.FIXED.equals(mode);
final boolean isFrame = Modes.FRAME.equals(mode);
final boolean isPreset = Modes.BROWSER.equals(mode);
final boolean isDevice = Modes.DEVICE_PARAMS.equals(mode);
// Transport buttons
switch(buttonID) {
case ROW4_3:
return !transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_4:
return transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_5:
return transport.isLoop() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_6:
return transport.isRecording() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_1:
return isFunctions || isFixed ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_2:
return isDevice ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_3:
return isTrackToggles || isFrame || isPreset ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_4:
return isTrack ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_6:
return isVolume ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_7:
return SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
return 0;
}
}
Aggregations