use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class TrackTogglesMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITrack cursorTrack = this.model.getCursorTrack();
final ITextDisplay d = this.surface.getTextDisplay().clearRow(0).clearRow(1);
if (!cursorTrack.doesExist()) {
d.setRow(0, " Please select a track... ").done(0).done(1);
return;
}
final ICursorDevice device = this.model.getCursorDevice();
d.setCell(0, 0, " Mute");
d.setCell(1, 0, cursorTrack.isMute() ? ON : OFF);
d.setCell(0, 1, " Solo");
d.setCell(1, 1, cursorTrack.isSolo() ? ON : OFF);
d.setCell(0, 2, "Rec Arm");
d.setCell(1, 2, cursorTrack.isRecArm() ? ON : OFF);
d.setCell(0, 3, " Write");
d.setCell(1, 3, this.model.getTransport().isWritingArrangerAutomation() ? ON : OFF);
d.setCell(0, 4, " Browse");
d.setCell(1, 4, "");
d.setCell(0, 5, device.doesExist() ? device.getName(8) : "None");
d.setCell(1, 5, device.isEnabled() ? "Enabled" : "Disabled");
d.setCell(0, 6, "<<Device").setCell(2, 6, "");
d.setCell(0, 7, "Device>>").setCell(2, 7, "").done(0).done(2);
d.done(0).done(1);
}
use of de.mossgrabers.framework.daw.data.ICursorDevice 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