use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class NoteRepeatMode method onKnobValue.
/**
* {@inheritDoc}
*/
@Override
public void onKnobValue(final int index, final int value) {
if (index != 7 && !this.increaseKnobMovement())
return;
final PushConfiguration configuration = this.surface.getConfiguration();
final IValueChanger valueChanger = this.model.getValueChanger();
switch(index) {
case 0:
case 1:
final int sel = Resolution.change(Resolution.getMatch(configuration.getNoteRepeatPeriod().getValue()), valueChanger.isIncrease(value));
configuration.setNoteRepeatPeriod(Resolution.values()[sel]);
break;
case 2:
case 3:
if (this.host.supports(Capability.NOTE_REPEAT_LENGTH)) {
final int sel2 = Resolution.change(Resolution.getMatch(configuration.getNoteRepeatLength().getValue()), valueChanger.calcKnobChange(value) > 0);
configuration.setNoteRepeatLength(Resolution.values()[sel2]);
}
break;
case 5:
if (this.host.supports(Capability.NOTE_REPEAT_MODE))
configuration.setPrevNextNoteRepeatMode(valueChanger.isIncrease(value));
break;
case 6:
if (this.host.supports(Capability.NOTE_REPEAT_OCTAVES))
configuration.setNoteRepeatOctave(configuration.getNoteRepeatOctave() + (valueChanger.calcKnobChange(value) > 0 ? 1 : -1));
break;
case 7:
if (this.host.supports(Capability.NOTE_REPEAT_SWING))
this.model.getGroove().getParameter(GrooveParameterID.SHUFFLE_AMOUNT).changeValue(value);
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class NoteRepeatMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event != ButtonEvent.UP || this.noteRepeat == null)
return;
final PushConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case 0:
case 1:
final int sel = Resolution.change(Resolution.getMatch(this.noteRepeat.getPeriod()), index == 1);
configuration.setNoteRepeatPeriod(Resolution.values()[sel]);
break;
case 2:
case 3:
if (this.host.supports(Capability.NOTE_REPEAT_LENGTH)) {
final int sel2 = Resolution.change(Resolution.getMatch(this.noteRepeat.getNoteLength()), index == 3);
configuration.setNoteRepeatLength(Resolution.values()[sel2]);
}
break;
case 5:
if (this.host.supports(Capability.NOTE_REPEAT_USE_PRESSURE_TO_VELOCITY))
this.noteRepeat.toggleUsePressure();
break;
case 6:
if (this.host.supports(Capability.NOTE_REPEAT_IS_FREE_RUNNING))
this.noteRepeat.toggleIsFreeRunning();
break;
case 7:
if (this.host.supports(Capability.NOTE_REPEAT_SWING))
this.noteRepeat.toggleShuffle();
break;
default:
// Unused
break;
}
}
use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class ScalesMode method update.
private void update() {
this.surface.getViewManager().getActive().updateNoteMapping();
final PushConfiguration config = this.surface.getConfiguration();
config.setScale(this.scales.getScale().getName());
config.setScaleBase(Scales.BASES.get(this.scales.getScaleOffset()));
config.setScaleInKey(!this.scales.isChromatic());
}
use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class SessionViewSelectMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event != ButtonEvent.UP)
return;
final PushConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case 0:
case 1:
configuration.setFlipSession(index == 1);
this.activateView(VIEWS[index]);
break;
case 2:
configuration.setSceneView();
this.surface.getModeManager().restore();
break;
case 6:
this.surface.getModeManager().setActive(Modes.MARKERS);
break;
case 7:
this.surface.getModeManager().restore();
configuration.toggleScenesClipMode();
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.
the class TrackCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final PushConfiguration config = this.surface.getConfiguration();
if (this.surface.isShiftPressed()) {
config.setVUMetersEnabled(!config.isEnableVUMeters());
return;
}
final ModeManager modeManager = this.surface.getModeManager();
final Modes currentMode = modeManager.getActiveID();
if (currentMode != null) {
if (config.isPush2()) {
if (Modes.TRACK.equals(currentMode) || Modes.VOLUME.equals(currentMode) || Modes.CROSSFADER.equals(currentMode) || Modes.PAN.equals(currentMode)) {
this.model.toggleCurrentTrackBank();
} else if (currentMode.ordinal() >= Modes.SEND1.ordinal() && currentMode.ordinal() <= Modes.SEND8.ordinal()) {
modeManager.setActive(Modes.TRACK);
this.model.toggleCurrentTrackBank();
} else
modeManager.setActive(config.getCurrentMixMode());
} else {
// Layer mode selection for Push 1
if (this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
modeManager.setActive(Modes.DEVICE_LAYER);
return;
}
if (Modes.TRACK.equals(currentMode))
this.model.toggleCurrentTrackBank();
else
modeManager.setActive(Modes.TRACK);
}
} else
modeManager.setActive(Modes.TRACK);
config.setDebugMode(modeManager.getActiveID());
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> track = tb.getSelectedItem();
if (track.isEmpty())
tb.getItem(0).select();
}
Aggregations