use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class AbstractTrackMode method handleSendEffect.
/**
* Handle the selection of a send effect.
*
* @param sendIndex The index of the send
*/
protected void handleSendEffect(final int sendIndex) {
final ITrackBank tb = this.model.getCurrentTrackBank();
if (tb == null || !tb.canEditSend(sendIndex))
return;
final Modes si = Modes.get(Modes.SEND1, sendIndex);
final ModeManager modeManager = this.surface.getModeManager();
modeManager.setActive(modeManager.isActive(si) ? Modes.TRACK : si);
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class PlayView method onButtonP1.
/**
* {@inheritDoc}
*/
@Override
public void onButtonP1(final boolean isUp, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final Modes activeModeId = this.surface.getModeManager().getActiveID();
if (Modes.SESSION == activeModeId) {
if (isUp)
this.model.getSceneBank().selectNextPage();
else
this.model.getSceneBank().selectPreviousPage();
return;
}
if (Modes.VOLUME.equals(activeModeId)) {
new P2ButtonCommand(isUp, this.model, this.surface).execute(ButtonEvent.DOWN, 127);
return;
}
if (Modes.TRACK.equals(activeModeId)) {
new ButtonRowSelectCommand<>(3, this.model, this.surface).execute(ButtonEvent.DOWN, 127);
return;
}
if (Modes.PLAY_OPTIONS.equals(activeModeId))
return;
final SLParameterMode mode = (SLParameterMode) this.surface.getModeManager().get(Modes.DEVICE_PARAMS);
if (isUp)
mode.selectNextItemPage();
else
mode.selectPreviousItemPage();
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class PlayView method onButtonRow1.
/**
* {@inheritDoc}
*/
@Override
public void onButtonRow1(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final Modes activeModeId = modeManager.getActiveID();
if (Modes.VIEW_SELECT == activeModeId) {
if (index == 0) {
this.surface.getViewManager().setActive(Views.CONTROL);
if (Modes.VOLUME.equals(modeManager.getPreviousID()))
modeManager.restore();
else
modeManager.setActive(Modes.TRACK);
} else
modeManager.restore();
this.surface.turnOffTransport();
return;
}
if (!Modes.SESSION.equals(activeModeId))
modeManager.setActive(Modes.SESSION);
this.model.getSceneBank().getItem(index).launch();
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class ControlView method onButtonRow2.
/**
* {@inheritDoc}
*/
@Override
public void onButtonRow2(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
Modes cm = modeManager.getActiveID();
if (!Modes.TRACK_DETAILS.equals(cm) && !Modes.FRAME.equals(cm) && !Modes.BROWSER.equals(cm)) {
modeManager.setActive(Modes.TRACK_DETAILS);
cm = Modes.TRACK_DETAILS;
}
if (Modes.FRAME.equals(cm)) {
modeManager.get(Modes.FRAME).onButton(0, index, event);
return;
} else if (Modes.BROWSER.equals(cm)) {
modeManager.get(Modes.BROWSER).onButton(0, index, event);
return;
}
switch(index) {
// Mute
case 0:
this.model.getCursorTrack().toggleMute();
break;
// Solo
case 1:
this.model.getCursorTrack().toggleSolo();
break;
// Arm
case 2:
this.model.getCursorTrack().toggleRecArm();
break;
// Write
case 3:
this.model.getTransport().toggleWriteArrangerAutomation();
break;
// Browse
case 4:
this.model.getBrowser().replace(this.model.getCursorDevice());
modeManager.setTemporary(Modes.BROWSER);
break;
// Dis-/Enable device
case 5:
this.model.getCursorDevice().toggleEnabledState();
break;
// Previous device
case 6:
this.model.getCursorDevice().selectPrevious();
break;
// Next device
case 7:
this.model.getCursorDevice().selectNext();
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.framework.mode.Modes 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