use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class ShiftView method onSelectTrack.
/**
* {@inheritDoc}
*/
@Override
public void onSelectTrack(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ITrackBank tb = this.model.getCurrentTrackBank();
final ModeManager modeManager = this.surface.getModeManager();
switch(index) {
case 0:
tb.getSceneBank().selectPreviousPage();
break;
case 1:
tb.getSceneBank().selectNextPage();
break;
case 2:
tb.selectPreviousPage();
break;
case 3:
tb.selectNextPage();
break;
case 4:
modeManager.setActive(Modes.VOLUME);
this.surface.getConfiguration().setFaderCtrl("Volume");
this.surface.getDisplay().notify("Volume");
break;
case 5:
modeManager.setActive(Modes.PAN);
this.surface.getConfiguration().setFaderCtrl("Pan");
this.surface.getDisplay().notify("Pan");
break;
case 6:
if (this.model.isEffectTrackBankActive())
return;
Modes mode = Modes.get(modeManager.getActiveID(), 1);
// Wrap
if (!Modes.isSendMode(mode))
mode = Modes.SEND1;
// Check if Send channel exists
if (Modes.isSendMode(mode) && tb.canEditSend(mode.ordinal() - Modes.SEND1.ordinal()))
mode = Modes.SEND1;
modeManager.setActive(mode);
final String name = "Send " + (mode.ordinal() - Modes.SEND1.ordinal() + 1);
this.surface.getConfiguration().setFaderCtrl(name);
this.surface.getDisplay().notify(name);
break;
case 7:
if (modeManager.isActive(Modes.DEVICE_PARAMS))
this.model.getBrowser().replace(this.model.getCursorDevice());
else {
modeManager.setActive(Modes.DEVICE_PARAMS);
this.surface.getConfiguration().setFaderCtrl("Device");
this.surface.getDisplay().notify("Device");
}
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class Drum64View method handleSelectButton.
/**
* {@inheritDoc}
*/
@Override
protected void handleSelectButton(final int playedPad) {
// Do we have drum pads?
final IDrumDevice primary = this.model.getDrumDevice64();
if (!primary.hasDrumPads())
return;
final ICursorDevice cd = this.model.getCursorDevice();
final boolean isNested = cd.isNested();
if (isNested) {
// We have to move up to compare the main drum devices
cd.selectParent();
}
// Can only scroll to the channel if the cursor device is the primary device
if (primary.getPosition() != cd.getPosition())
return;
// Align the primary and cursor device drum bank view
final IDrumPadBank drumPadBank = primary.getDrumPadBank();
final int scrollPos = drumPadBank.getScrollPosition();
final IDrumPadBank cdDrumPadBank = cd.getDrumPadBank();
final int pageSize = cdDrumPadBank.getPageSize();
final int adjustedPage = playedPad / pageSize * pageSize;
cdDrumPadBank.scrollTo(scrollPos + adjustedPage, false);
// Do not reselect, if pad is already selected
final IDrumPad drumPad = drumPadBank.getItem(playedPad);
if (drumPad.isSelected()) {
// If the instrument of the pad was selected for editing, try to select it again
if (isNested) {
final IDrumPad selectedItem = cdDrumPadBank.getItem(playedPad % pageSize);
if (selectedItem != null)
selectedItem.enter();
}
return;
}
// Only activate layer mode if not one of the layer modes is already active
final ModeManager modeManager = this.surface.getModeManager();
if (!Modes.isLayerMode(modeManager.getActiveID()))
modeManager.setActive(Modes.DEVICE_LAYER);
drumPad.select();
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class FireModeCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (this.surface.isPressed(ButtonID.ALT)) {
if (event == ButtonEvent.UP)
return;
// Toggle 16 track displays in channel and mixer modes
final ModeManager modeManager = this.surface.getModeManager();
switch(modeManager.getActiveID()) {
case DEVICE_LAYER:
modeManager.setActive(Modes.DEVICE_LAYER_VOLUME);
break;
case DEVICE_LAYER_VOLUME:
modeManager.setActive(Modes.DEVICE_LAYER);
break;
case TRACK:
modeManager.setActive(Modes.VOLUME);
break;
case VOLUME:
modeManager.setActive(Modes.TRACK);
break;
default:
// Do nothing
break;
}
this.model.getHost().showNotification(modeManager.getActive().getName());
return;
}
super.execute(event, velocity);
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class SelectTrackSendOrClipLengthCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.UP)
return;
final ModeManager modeManager = this.surface.getModeManager();
if (this.surface.isPressed(ButtonID.SEND1)) {
final Modes sendModeId = Modes.get(Modes.SEND1, this.index);
this.surface.setTriggerConsumed(ButtonID.SEND1);
// Keep the send step selection in sync
if (this.surface.isMkII())
((ModeMultiSelectCommand<?, ?>) this.surface.getButton(ButtonID.SEND1).getCommand()).activateMode(sendModeId);
else
modeManager.setActive(sendModeId);
// Display the sends name
String modeName = "Send " + (this.index + 1) + ": ";
final ITrackBank trackBank = this.model.getTrackBank();
Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
if (selectedTrack.isEmpty()) {
final ITrack item = trackBank.getItem(0);
selectedTrack = item.doesExist() ? Optional.of(item) : Optional.empty();
}
if (selectedTrack.isEmpty())
modeName += "-";
else
modeName += selectedTrack.get().getSendBank().getItem(this.index).getName();
this.surface.getDisplay().notify(modeName);
return;
}
if (this.surface.isMkII() && this.surface.isPressed(ButtonID.SEND2)) {
modeManager.setActive(Modes.USER);
this.surface.setTriggerConsumed(ButtonID.USER);
modeManager.get(Modes.USER).selectItemPage(this.index);
return;
}
this.model.getCurrentTrackBank().getItem(this.index).selectOrExpandGroup();
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class GenericFlexiControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final GenericFlexiControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
modeManager.register(Modes.TRACK, new TrackMode<>(surface, this.model, true));
modeManager.register(Modes.VOLUME, new TrackVolumeMode<>(surface, this.model, true));
modeManager.register(Modes.PAN, new TrackPanMode<>(surface, this.model, true));
for (int i = 0; i < 8; i++) modeManager.register(Modes.get(Modes.SEND1, i), new TrackSendMode<>(i, surface, this.model, true));
modeManager.register(Modes.DEVICE_PARAMS, new ParameterMode<>(surface, this.model, true));
modeManager.register(Modes.BROWSER, new BrowserMode<>(surface, this.model));
modeManager.setDefaultID(Modes.VOLUME);
}
Aggregations