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();
}
use of de.mossgrabers.controller.ableton.push.PushConfiguration 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.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class TouchstripCommand method onPitchbend.
/**
* {@inheritDoc}
*/
@Override
public void onPitchbend(final int data1, final int data2) {
if (this.surface.getViewManager().isActive(Views.SESSION)) {
final int value = this.surface.isShiftPressed() ? 63 : data2;
this.model.getTransport().setCrossfade(this.model.getValueChanger().toDAWValue(value));
this.surface.setRibbonValue(value);
return;
}
// Don't get in the way of configuration
if (this.surface.isShiftPressed())
return;
final PushConfiguration config = this.surface.getConfiguration();
final double scaled = data2 / 127.0;
// Check if Note Repeat is active and its settings should be changed
final int ribbonNoteRepeat = config.getRibbonNoteRepeat();
if (config.isNoteRepeatActive() && ribbonNoteRepeat > PushConfiguration.NOTE_REPEAT_OFF) {
final Resolution[] values = Resolution.values();
final int index = (int) Math.round(scaled * (values.length - 1));
final double value = values[values.length - 1 - index].getValue();
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
if (ribbonNoteRepeat == PushConfiguration.NOTE_REPEAT_PERIOD)
noteRepeat.setPeriod(value);
else
noteRepeat.setNoteLength(value);
return;
}
switch(config.getRibbonMode()) {
case PushConfiguration.RIBBON_MODE_PITCH:
this.surface.sendMidiEvent(0xE0, data1, data2);
break;
case PushConfiguration.RIBBON_MODE_CC:
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), data2);
this.pitchValue = data2;
break;
case PushConfiguration.RIBBON_MODE_CC_PB:
if (data2 > 64)
this.surface.sendMidiEvent(0xE0, data1, data2);
else if (data2 < 64)
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 127 - data2 * 2);
else {
this.surface.sendMidiEvent(0xE0, data1, data2);
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
}
break;
case PushConfiguration.RIBBON_MODE_PB_CC:
if (data2 > 64)
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), (data2 - 64) * 2);
else if (data2 < 64)
this.surface.sendMidiEvent(0xE0, data1, data2);
else {
this.surface.sendMidiEvent(0xE0, data1, data2);
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
}
break;
case PushConfiguration.RIBBON_MODE_FADER:
this.model.getCursorTrack().setVolume(this.model.getValueChanger().toDAWValue(data2));
return;
default:
// Not used
break;
}
this.surface.getMidiOutput().sendPitchbend(data1, data2);
}
Aggregations