use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class PlayView method onButtonRow2.
/**
* {@inheritDoc}
*/
@Override
public void onButtonRow2(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final Modes cm = modeManager.getActiveID();
if (!Modes.PLAY_OPTIONS.equals(cm))
modeManager.setActive(Modes.PLAY_OPTIONS);
switch(index) {
// Down
case 0:
this.clearPressedKeys();
this.scales.decDrumOctave();
this.model.getDrumDevice().getDrumPadBank().selectPreviousPage();
this.updateNoteMapping();
this.surface.getDisplay().notify(this.scales.getDrumRangeText());
break;
// Up
case 1:
this.clearPressedKeys();
this.scales.incDrumOctave();
this.model.getDrumDevice().getDrumPadBank().selectNextPage();
this.updateNoteMapping();
this.surface.getDisplay().notify(this.scales.getDrumRangeText());
break;
case 2:
this.changeResolution(0);
this.surface.getDisplay().notify(Resolution.getNameAt(this.selectedResolutionIndex));
break;
case 3:
this.changeResolution(127);
this.surface.getDisplay().notify(Resolution.getNameAt(this.selectedResolutionIndex));
break;
case 4:
this.changeScrollPosition(0);
break;
case 5:
this.changeScrollPosition(127);
break;
case 6:
break;
// Toggle play / sequencer
case 7:
this.isPlayMode = !this.isPlayMode;
this.surface.getDisplay().notify(this.isPlayMode ? "Play/Select" : "Sequence");
this.updateNoteMapping();
break;
default:
// Intentionally empty
break;
}
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class PlayView method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final int buttonIDOrdinal = buttonID.ordinal();
// Button row 2: Track toggles
if (buttonIDOrdinal >= ButtonID.ROW1_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW1_8.ordinal() || buttonIDOrdinal >= ButtonID.ROW2_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW2_8.ordinal())
return SLControlSurface.MKII_BUTTON_STATE_OFF;
final Modes mode = this.surface.getModeManager().getActiveID();
final boolean isSession = Modes.SESSION == mode;
final boolean isDevice = Modes.DEVICE_PARAMS == mode;
final boolean isPlayOptions = Modes.PLAY_OPTIONS == mode;
final boolean isTrack = Modes.TRACK == mode;
final boolean isVolume = Modes.VOLUME == mode;
switch(buttonID) {
case ROW_SELECT_1:
return isSession ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_2:
return isDevice ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_3:
return isPlayOptions ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_4:
return isTrack ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_5:
return SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_6:
return isVolume ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_7:
case ROW_SELECT_8:
return SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
// Fall through
break;
}
// Transport buttons
if (this.surface.isTransportActive()) {
if (buttonIDOrdinal >= ButtonID.ROW3_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW3_8.ordinal())
return SLControlSurface.MKII_BUTTON_STATE_OFF;
final ITransport transport = this.model.getTransport();
switch(buttonID) {
case ROW4_3:
return !transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_4:
return transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_5:
return transport.isLoop() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_6:
return transport.isRecording() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
return 0;
}
}
// Draw sequencer
return this.drawDrumGrid(buttonIDOrdinal);
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class PushConfiguration method activateDebugSettings.
/**
* Activate the debug settings.
*
* @param settingsUI The settings
*/
private void activateDebugSettings(final ISettingsUI settingsUI) {
final String[] modes = new String[DEBUG_MODES.size()];
int i = 0;
for (final Modes mode : DEBUG_MODES) {
modes[i] = mode.toString();
i++;
}
this.debugModeSetting = settingsUI.getEnumSetting("Display Mode", CATEGORY_DEBUG, modes, Modes.TRACK.toString());
this.debugModeSetting.addValueObserver(value -> {
try {
this.debugMode = Modes.valueOf(value);
} catch (final IllegalArgumentException ex) {
this.debugMode = Modes.TRACK;
}
this.notifyObservers(DEBUG_MODE);
});
if (!this.isPush2)
return;
settingsUI.getSignalSetting(" ", CATEGORY_DEBUG, "Display window").addSignalObserver(value -> this.notifyObservers(DEBUG_WINDOW));
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class SetupCommand 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 mode = this.getMode();
if (modeManager.isActive(mode))
modeManager.restore();
else
modeManager.setTemporary(mode);
}
use of de.mossgrabers.framework.mode.Modes 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();
}
Aggregations