use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class VolumeCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final Modes currentMode = modeManager.getActiveID();
// Layer mode selection for Push 1
final PushConfiguration config = this.surface.getConfiguration();
if (!config.isPush2() && this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
modeManager.setActive(Modes.DEVICE_LAYER_VOLUME);
return;
}
if (Modes.VOLUME.equals(currentMode)) {
if (this.model.getHost().supports(Capability.HAS_CROSSFADER))
modeManager.setActive(Modes.CROSSFADER);
} else
modeManager.setActive(Modes.VOLUME);
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class ShiftCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
final ModeManager modeManager = this.surface.getModeManager();
final Modes cm = modeManager.getActiveID();
if (event == ButtonEvent.DOWN && Modes.SCALES.equals(cm))
modeManager.setTemporary(Modes.SCALE_LAYOUT);
else if (event == ButtonEvent.UP && Modes.SCALE_LAYOUT.equals(cm))
modeManager.restore();
this.surface.setKnobSensitivityIsSlow(this.surface.isShiftPressed());
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class MuteCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
// Update for key combinations
this.surface.getViewManager().getActive().updateNoteMapping();
if (this.surface.isSelectPressed()) {
if (event == ButtonEvent.UP)
this.model.getProject().clearMute();
return;
}
final PushConfiguration config = this.surface.getConfiguration();
if (!config.isPush2()) {
config.setTrackState(TrackState.MUTE);
return;
}
// Toggle mute lock mode
if (this.surface.isShiftPressed()) {
if (event == ButtonEvent.UP) {
if (config.isMuteSoloLocked() && config.isMuteState())
config.setMuteSoloLocked(false);
else {
config.setMuteSoloLocked(true);
config.setTrackState(TrackState.MUTE);
}
}
return;
}
// Behaviour like Push 1
if (config.isMuteSoloLocked()) {
config.setTrackState(TrackState.MUTE);
return;
}
if (event == ButtonEvent.DOWN) {
config.setIsMuteLongPressed(false);
return;
}
if (event == ButtonEvent.LONG) {
config.setIsMuteLongPressed(true);
config.setTrackState(TrackState.MUTE);
return;
}
if (config.isMuteLongPressed()) {
config.setIsMuteLongPressed(false);
return;
}
final Modes activeModeId = this.surface.getModeManager().getActiveID();
if (Modes.isLayerMode(activeModeId)) {
final ICursorDevice cd = this.model.getCursorDevice();
final Optional<?> layer = cd.getLayerBank().getSelectedItem();
if (layer.isPresent())
((ILayer) layer.get()).toggleMute();
} else if (Modes.MASTER.equals(activeModeId))
this.model.getMasterTrack().toggleMute();
else
this.model.getCursorTrack().toggleMute();
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class PanSendCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final Modes currentMode = modeManager.getActiveID();
// Layer mode selection for Push 1
Modes 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.DEVICE_LAYER_PAN;
} else {
mode = Modes.get(currentMode, 1);
// Wrap
if (mode.ordinal() < Modes.DEVICE_LAYER_PAN.ordinal() || mode.ordinal() > Modes.DEVICE_LAYER_SEND8.ordinal())
mode = Modes.DEVICE_LAYER_PAN;
// Check if Send channel exists
final ITrackBank tb = this.model.getTrackBank();
if (mode.ordinal() < Modes.DEVICE_LAYER_SEND1.ordinal() || mode.ordinal() > Modes.DEVICE_LAYER_SEND8.ordinal() || tb.canEditSend(mode.ordinal() - Modes.DEVICE_LAYER_SEND1.ordinal()))
mode = Modes.DEVICE_LAYER_PAN;
}
modeManager.setActive(mode);
return;
}
if (this.model.isEffectTrackBankActive()) {
// No Sends on FX tracks
mode = Modes.PAN;
} else {
if (currentMode.ordinal() < Modes.SEND1.ordinal() || currentMode.ordinal() > Modes.SEND8.ordinal())
mode = Modes.SEND1;
else {
mode = Modes.get(currentMode, 1);
if (mode.ordinal() > Modes.SEND8.ordinal())
mode = Modes.PAN;
}
// Check if Send channel exists
final ITrackBank tb = this.model.getTrackBank();
if (mode.ordinal() < Modes.SEND1.ordinal() || mode.ordinal() > Modes.SEND8.ordinal() || !tb.canEditSend(mode.ordinal() - Modes.SEND1.ordinal()))
mode = Modes.PAN;
}
modeManager.setActive(mode);
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class GenericFlexiControllerSetup method selectMode.
private void selectMode() {
final String selectedModeName = this.configuration.getSelectedModeName();
if (selectedModeName == null)
return;
final GenericFlexiControlSurface surface = this.getSurface();
final Modes modeID = surface.getModeManager().get(selectedModeName);
if (modeID != null)
surface.activateMode(modeID);
}
Aggregations