use of de.mossgrabers.framework.featuregroup.ModeManager 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.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class MastertrackCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
// Avoid accidentally leaving the browser
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActive(Modes.BROWSER))
return;
switch(event) {
case DOWN:
this.quitMasterMode = false;
break;
case UP:
this.handleButtonUp(modeManager);
break;
case LONG:
this.quitMasterMode = true;
modeManager.setTemporary(Modes.FRAME);
break;
}
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class SLControllerSetup method flush.
/**
* {@inheritDoc}
*/
@Override
public void flush() {
super.flush();
// Always refresh volume mode
final ModeManager modeManager = this.getSurface().getModeManager();
if (!modeManager.isActive(Modes.VOLUME))
modeManager.get(Modes.VOLUME).updateDisplay();
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class SLControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final SLControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
modeManager.register(Modes.VOLUME, new SLVolumeMode(surface, this.model));
modeManager.register(Modes.TRACK, new SLTrackMode(surface, this.model));
modeManager.register(Modes.DEVICE_PARAMS, new SLParameterMode(surface, this.model));
modeManager.register(Modes.FIXED, new FixedMode(surface, this.model));
modeManager.register(Modes.FRAME, new FrameMode(surface, this.model));
modeManager.register(Modes.FUNCTIONS, new FunctionMode(surface, this.model));
modeManager.register(Modes.PLAY_OPTIONS, new PlayOptionsMode(surface, this.model));
modeManager.register(Modes.SESSION, new SessionMode(surface, this.model));
modeManager.register(Modes.TRACK_DETAILS, new TrackTogglesMode(surface, this.model));
modeManager.register(Modes.VIEW_SELECT, new ViewSelectMode(surface, this.model));
modeManager.register(Modes.BROWSER, new DevicePresetsMode(surface, this.model));
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class SLControllerSetup method registerContinuousCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerContinuousCommands() {
final SLControlSurface surface = this.getSurface();
for (int i = 0; i < 8; i++) {
final int index = i;
this.addFader(ContinuousID.get(ContinuousID.FADER1, i), "Fader " + (i + 1), null, BindType.CC, SLControlSurface.MKII_SLIDER1 + i);
final IHwRelativeKnob relativeKnob = this.addRelativeKnob(ContinuousID.get(ContinuousID.DEVICE_KNOB1, i), "Device Knob " + (i + 1), null, SLControlSurface.MKII_KNOB_ROW1_1 + i, RelativeEncoding.SIGNED_BIT);
relativeKnob.addOutput(() -> {
final boolean hasDevice = this.model.hasSelectedDevice();
final IParameterBank parameterBank = this.model.getCursorDevice().getParameterBank();
return hasDevice ? parameterBank.getItem(index).getValue() : 0;
}, value -> surface.getMidiOutput().sendCC(0x70 + index, Math.min(value * 11 / 127, 11)));
this.addAbsoluteKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), null, SLControlSurface.MKII_KNOB_ROW2_1 + i);
}
this.addFader(ContinuousID.TOUCHPAD_X, "Touchpad X", new TouchpadCommand(true, this.model, surface), BindType.CC, SLControlSurface.MKII_TOUCHPAD_X);
this.addFader(ContinuousID.TOUCHPAD_Y, "Touchpad Y", new TouchpadCommand(false, this.model, surface), BindType.CC, SLControlSurface.MKII_TOUCHPAD_Y);
// These are no faders but cannot be mapped to any meaningful control anyway
this.addFader(ContinuousID.HELLO, "Tap Init", new TapTempoInitMkICommand(this.model, surface), BindType.CC, SLControlSurface.MKI_BUTTON_TAP_TEMPO);
this.addFader(ContinuousID.TEMPO, "Tap Tempo", new TapTempoMkICommand(this.model, surface), BindType.CC, SLControlSurface.MKI_BUTTON_TAP_TEMPO_VALUE);
// Volume, Track and Parameter modes are always bound since they have dedicated controls
final ModeManager modeManager = surface.getModeManager();
modeManager.get(Modes.VOLUME).onActivate();
modeManager.get(Modes.TRACK).onActivate();
modeManager.get(Modes.DEVICE_PARAMS).onActivate();
}
Aggregations