use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class MasterCommand method executeShifted.
/**
* {@inheritDoc}
*/
@Override
public void executeShifted(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
this.model.toggleCurrentTrackBank();
if (this.model.isEffectTrackBankActive()) {
// No Sends on effect tracks
final ModeManager modeManager = this.surface.getModeManager();
final int mode = modeManager.getActiveModeId().intValue();
if (mode >= Modes.MODE_SEND1.intValue() && mode <= Modes.MODE_SEND8.intValue())
modeManager.setActiveMode(Modes.MODE_PAN);
}
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getSelectedTrack();
if (track == null)
tb.getTrack(0).select();
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class LaunchpadControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final LaunchpadControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
modeManager.registerMode(Modes.MODE_REC_ARM, new RecArmMode(surface, this.model));
modeManager.registerMode(Modes.MODE_TRACK_SELECT, new TrackMode(surface, this.model));
modeManager.registerMode(Modes.MODE_MUTE, new MuteMode(surface, this.model));
modeManager.registerMode(Modes.MODE_SOLO, new SoloMode(surface, this.model));
modeManager.registerMode(Modes.MODE_VOLUME, new VolumeMode(surface, this.model));
modeManager.registerMode(Modes.MODE_PAN, new PanMode(surface, this.model));
modeManager.registerMode(Modes.MODE_SENDS, new SendMode(surface, this.model));
modeManager.registerMode(Modes.MODE_STOP_CLIP, new StopClipMode(surface, this.model));
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class DeviceLayerMode method onSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void onSecondRow(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final PushConfiguration config = this.surface.getConfiguration();
if (!this.isPush2 || config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
final ICursorDevice cd = this.model.getCursorDevice();
final int offset = getDrumPadIndex(cd);
if (config.isMuteState())
cd.toggleLayerOrDrumPadMute(offset + index);
else
cd.toggleLayerOrDrumPadSolo(offset + index);
return;
}
final ModeManager modeManager = this.surface.getModeManager();
IChannelBank fxTrackBank;
switch(index) {
case 0:
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME);
break;
case 1:
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_PAN))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_PAN);
break;
case 2:
// Not used
break;
case 3:
if (!this.model.isEffectTrackBankActive()) {
// Check if there are more than 4 FX channels
if (!config.isSendsAreToggled()) {
fxTrackBank = this.model.getEffectTrackBank();
if (!fxTrackBank.getTrack(4).doesExist())
return;
}
config.setSendsAreToggled(!config.isSendsAreToggled());
if (!modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER))
modeManager.setActiveMode(Integer.valueOf(Modes.MODE_DEVICE_LAYER_SEND1.intValue() + (config.isSendsAreToggled() ? 4 : 0)));
}
break;
case 7:
this.moveUp();
break;
default:
if (!this.model.isEffectTrackBankActive()) {
final int sendOffset = config.isSendsAreToggled() ? 0 : 4;
final int sendIndex = index - sendOffset;
fxTrackBank = this.model.getEffectTrackBank();
if (fxTrackBank.getTrack(sendIndex).doesExist()) {
final Integer si = Integer.valueOf(Modes.MODE_DEVICE_LAYER_SEND1.intValue() + sendIndex);
if (modeManager.isActiveMode(si))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(si);
}
}
break;
}
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class DeviceLayerMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event == ButtonEvent.DOWN)
return;
if (event == ButtonEvent.UP) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.hasSelectedDevice())
return;
final int offset = getDrumPadIndex(cd);
final IChannel layer = cd.getLayerOrDrumPad(offset + index);
if (!layer.doesExist())
return;
final int layerIndex = layer.getIndex();
if (!layer.isSelected()) {
cd.selectLayerOrDrumPad(layerIndex);
return;
}
cd.enterLayerOrDrumPad(layer.getIndex());
cd.selectFirstDeviceInLayerOrDrumPad(layer.getIndex());
final ModeManager modeManager = this.surface.getModeManager();
modeManager.setActiveMode(Modes.MODE_DEVICE_PARAMS);
((DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS)).setShowDevices(true);
return;
}
// LONG press
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_ROW1_1 + index);
this.moveUp();
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class DeviceLayerMode method moveUp.
/**
* Move up the hierarchy.
*/
protected void moveUp() {
// There is no device on the track move upwards to the track view
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.hasSelectedDevice()) {
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
return;
}
final ModeManager modeManager = this.surface.getModeManager();
modeManager.setActiveMode(Modes.MODE_DEVICE_PARAMS);
cd.selectChannel();
((DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS)).setShowDevices(true);
}
Aggregations