use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class PushControllerSetup method createModel.
/**
* {@inheritDoc}
*/
@Override
protected void createModel() {
this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8, 8, this.isPush2 ? 8 : 6, this.isPush2 ? 48 : 16, this.isPush2 ? 48 : 16, false, -1, -1, -1, -1);
final ITrackBank trackBank = this.model.getTrackBank();
trackBank.setIndication(true);
trackBank.addTrackSelectionObserver(this::handleTrackChange);
final IChannelBank effectTrackBank = this.model.getEffectTrackBank();
if (effectTrackBank != null)
effectTrackBank.addTrackSelectionObserver(this::handleTrackChange);
this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
final PushControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
if (isSelected)
modeManager.setActiveMode(Modes.MODE_MASTER);
else if (modeManager.isActiveMode(Modes.MODE_MASTER))
modeManager.restoreMode();
});
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class MastertrackTouchCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
final boolean isTouched = event == ButtonEvent.DOWN;
// Avoid accidentally leaving the browser
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_BROWSER))
return;
final IMasterTrack masterTrack = this.model.getMasterTrack();
masterTrack.touchVolume(isTouched);
if (this.surface.isDeletePressed()) {
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_DELETE);
masterTrack.resetVolume();
return;
}
final boolean isMasterMode = modeManager.isActiveMode(Modes.MODE_MASTER);
if (isTouched && isMasterMode)
return;
if (isTouched)
modeManager.setActiveMode(Modes.MODE_MASTER_TEMP);
else if (!isMasterMode)
modeManager.restoreMode();
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class PanSendCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
final ModeManager modeManager = this.surface.getModeManager();
final Integer currentMode = modeManager.getActiveModeId();
// Layer mode selection for Push 1
Integer mode;
final PushConfiguration config = this.surface.getConfiguration();
if (!config.isPush2() && this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
if (this.model.isEffectTrackBankActive()) {
// No Sends on FX tracks
mode = Modes.MODE_DEVICE_LAYER_PAN;
} else {
mode = Integer.valueOf(currentMode.intValue() + 1);
// Wrap
if (mode.intValue() < Modes.MODE_DEVICE_LAYER_PAN.intValue() || mode.intValue() > Modes.MODE_DEVICE_LAYER_SEND6.intValue())
mode = Modes.MODE_DEVICE_LAYER_PAN;
// Check if Send channel exists
if (mode.intValue() >= Modes.MODE_DEVICE_LAYER_SEND1.intValue() && mode.intValue() <= Modes.MODE_DEVICE_LAYER_SEND6.intValue() && fxTrackBank != null && !fxTrackBank.getTrack(mode.intValue() - Modes.MODE_DEVICE_LAYER_SEND1.intValue()).doesExist())
mode = Modes.MODE_DEVICE_LAYER_PAN;
}
modeManager.setActiveMode(mode);
return;
}
if (this.model.isEffectTrackBankActive()) {
// No Sends on FX tracks
mode = Modes.MODE_PAN;
} else {
mode = Integer.valueOf(currentMode.intValue() + 1);
// Wrap
if (mode.intValue() < Modes.MODE_PAN.intValue() || mode.intValue() > Modes.MODE_SEND6.intValue())
mode = Modes.MODE_PAN;
// Check if Send channel exists
if (mode.intValue() >= Modes.MODE_SEND1.intValue() && mode.intValue() <= Modes.MODE_SEND6.intValue() && fxTrackBank != null && !fxTrackBank.getTrack(mode.intValue() - Modes.MODE_SEND1.intValue()).doesExist())
mode = Modes.MODE_PAN;
}
modeManager.setActiveMode(mode);
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class PushCursorCommand method scrollRight.
/**
* {@inheritDoc}
*/
@Override
protected void scrollRight() {
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS)) {
final DeviceParamsMode activeMode = (DeviceParamsMode) modeManager.getActiveMode();
if (this.surface.isShiftPressed())
activeMode.selectNextPageBank();
else
activeMode.selectNextPage();
return;
}
if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
((DeviceBrowserMode) modeManager.getActiveMode()).resetFilterColumn();
this.model.getBrowser().nextContentType();
return;
}
if (Modes.isLayerMode(modeManager.getActiveModeId())) {
if (this.surface.isShiftPressed())
this.model.getCursorDevice().nextLayerOrDrumPadBank();
else
this.model.getCursorDevice().nextLayerOrDrumPad();
return;
}
this.scrollTracksRight();
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class SelectCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
// Update for key combinations
this.surface.getViewManager().getActiveView().updateNoteMapping();
final boolean isUp = event == ButtonEvent.UP;
this.surface.updateButton(PushControlSurface.PUSH_BUTTON_SELECT, isUp ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
final ModeManager modeManager = this.surface.getModeManager();
if (event == ButtonEvent.DOWN) {
// Track or layer details?
if (Modes.isLayerMode(modeManager.getActiveModeId()))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_DETAILS);
else
modeManager.setActiveMode(Modes.MODE_TRACK_DETAILS);
} else if (isUp && modeManager.isActiveMode(Modes.MODE_TRACK_DETAILS))
modeManager.restoreMode();
}
Aggregations