use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class AccentCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
switch(event) {
case DOWN:
this.quitAccentMode = false;
break;
case LONG:
this.quitAccentMode = true;
this.surface.getModeManager().setTemporary(Modes.ACCENT);
break;
case UP:
if (this.quitAccentMode)
this.surface.getModeManager().restore();
else {
final PushConfiguration config = this.surface.getConfiguration();
config.setAccentEnabled(!config.isAccentActive());
}
break;
}
}
use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class SoloCommand 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().clearSolo();
return;
}
final PushConfiguration config = this.surface.getConfiguration();
if (!config.isPush2()) {
config.setTrackState(TrackState.SOLO);
return;
}
// Toggle solo lock mode
if (this.surface.isShiftPressed()) {
if (event == ButtonEvent.UP) {
if (config.isMuteSoloLocked() && config.isSoloState())
config.setMuteSoloLocked(false);
else {
config.setMuteSoloLocked(true);
config.setTrackState(TrackState.SOLO);
}
}
return;
}
// Behaviour like Push 1
if (config.isMuteSoloLocked()) {
config.setTrackState(TrackState.SOLO);
return;
}
if (event == ButtonEvent.DOWN) {
config.setIsSoloLongPressed(false);
return;
}
if (event == ButtonEvent.LONG) {
config.setIsSoloLongPressed(true);
config.setTrackState(TrackState.SOLO);
return;
}
if (config.isSoloLongPressed()) {
config.setIsSoloLongPressed(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()).toggleSolo();
} else if (Modes.MASTER.equals(activeModeId))
this.model.getMasterTrack().toggleSolo();
else
this.model.getCursorTrack().toggleSolo();
}
use of de.mossgrabers.controller.ableton.push.PushConfiguration 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.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class SelectSessionViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event == ButtonEvent.DOWN) {
this.isTemporary = false;
final ViewManager viewManager = this.surface.getViewManager();
final ModeManager modeManager = this.surface.getModeManager();
if (Views.isSessionView(viewManager.getActiveID())) {
if (modeManager.isActive(Modes.SESSION_VIEW_SELECT))
modeManager.restore();
else
modeManager.setTemporary(Modes.SESSION_VIEW_SELECT);
return;
}
// Switch to the preferred session view and display scene/clip mode if enabled
final PushConfiguration configuration = this.surface.getConfiguration();
viewManager.setActive(configuration.isScenesClipViewSelected() ? Views.SCENE_PLAY : Views.SESSION);
if (configuration.shouldDisplayScenesOrClips())
modeManager.setActive(Modes.SESSION);
return;
}
if (event == ButtonEvent.UP && this.isTemporary)
this.surface.getViewManager().restore();
}
use of de.mossgrabers.controller.ableton.push.PushConfiguration 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();
}
Aggregations