use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class AssignableCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
final MCUConfiguration configuration = this.surface.getConfiguration();
switch(this.getSetting()) {
case MCUConfiguration.FOOTSWITCH_2_PREV_MODE:
if (event == ButtonEvent.DOWN)
this.switcher.scrollDown();
break;
case MCUConfiguration.FOOTSWITCH_2_NEXT_MODE:
if (event == ButtonEvent.DOWN)
this.switcher.scrollUp();
break;
case MCUConfiguration.FOOTSWITCH_2_SHOW_MARKER_MODE:
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActive(Modes.MARKERS))
modeManager.restore();
else
modeManager.setActive(Modes.MARKERS);
final IMode mode = modeManager.getActive();
if (mode != null)
this.surface.getDisplay().notify(mode.getName());
break;
case MCUConfiguration.FOOTSWITCH_2_USE_FADERS_LIKE_EDIT_KNOBS:
this.flipCommand.executeNormal(event);
break;
case MCUConfiguration.FOOTSWITCH_2_TOGGLE_MOTOR_FADERS_ON_OFF:
if (event != ButtonEvent.DOWN)
return;
configuration.toggleMotorFaders();
this.mvHelper.delayDisplay(() -> "Motor Faders: " + (configuration.hasMotorFaders() ? "On" : "Off"));
break;
case MCUConfiguration.FOOTSWITCH_2_ACTION:
if (event != ButtonEvent.DOWN)
return;
final String assignableActionID = configuration.getAssignableAction(this.index);
if (assignableActionID != null)
this.model.getApplication().invokeAction(assignableActionID);
break;
default:
super.execute(event, velocity);
break;
}
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class ModeSwitcher method scrollUp.
/**
* Scroll upwards through the modes.
*/
public void scrollUp() {
final ModeManager modeManager = this.surface.getModeManager();
final Modes activeModeId = modeManager.getActiveID();
if (Modes.PAN == activeModeId) {
modeManager.setActive(Modes.VOLUME);
this.surface.getDisplay().notify("Volume");
} else if (Modes.VOLUME == activeModeId) {
modeManager.setActive(Modes.TRACK);
this.surface.getDisplay().notify("Track");
} else if (Modes.TRACK == activeModeId) {
modeManager.setActive(Modes.DEVICE_PARAMS);
this.surface.getDisplay().notify("Parameters");
} else {
modeManager.setActive(Modes.PAN);
this.surface.getDisplay().notify("Panorama");
}
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class FaderTouchCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
final MCUConfiguration configuration = this.surface.getConfiguration();
if (event == ButtonEvent.LONG || configuration.useFadersAsKnobs())
return;
final boolean isTouched = event == ButtonEvent.DOWN;
// Master Channel
if (this.index == 8) {
if (isTouched && configuration.isTouchChannel())
this.model.getMasterTrack().select();
return;
}
// Select channel
if (configuration.isTouchChannel() && event == ButtonEvent.DOWN)
this.getTrackBank().getItem(this.channel).select();
final ModeManager modeManager = this.surface.getModeManager();
if (configuration.useFadersAsKnobs()) {
modeManager.getActive().onKnobTouch(this.index, isTouched);
return;
}
modeManager.get(Modes.VOLUME).onKnobTouch(this.index, isTouched);
final int pos = this.surface.getSurfaceID() * 8 + this.index;
// Temporarily enable volume mode
if (isTouched) {
if (!hasTouchedFader()) {
if (modeManager.isActive(Modes.VOLUME))
modeManager.setPreviousID(Modes.VOLUME);
else
modeManager.setActive(Modes.VOLUME);
}
setTouchedFader(pos, true);
} else {
setTouchedFader(pos, false);
if (!hasTouchedFader())
modeManager.restore();
}
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class LaunchkeyMk3ControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final LaunchkeyMk3ControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
modeManager.register(Modes.VOLUME, new LaunchkeyMk3VolumeMode(surface, this.model, AbstractMode.DEFAULT_KNOB_IDS));
modeManager.register(Modes.PAN, new LaunchkeyMk3PanoramaMode(surface, this.model, AbstractMode.DEFAULT_KNOB_IDS));
modeManager.register(Modes.SEND1, new LaunchkeyMk3SendMode(0, surface, this.model, AbstractMode.DEFAULT_KNOB_IDS));
modeManager.register(Modes.SEND2, new LaunchkeyMk3SendMode(1, surface, this.model, AbstractMode.DEFAULT_KNOB_IDS));
modeManager.register(Modes.DEVICE_PARAMS, new LaunchkeyMk3ParameterMode(surface, this.model, AbstractMode.DEFAULT_KNOB_IDS));
// Layer send X IDs are used for custom modes
modeManager.register(Modes.DEVICE_LAYER_SEND1, new CustomMode(1, surface, this.model));
modeManager.register(Modes.DEVICE_LAYER_SEND2, new CustomMode(2, surface, this.model));
modeManager.register(Modes.DEVICE_LAYER_SEND3, new CustomMode(3, surface, this.model));
modeManager.register(Modes.DEVICE_LAYER_SEND4, new CustomMode(4, surface, this.model));
final ModeManager faderModeManager = surface.getFaderModeManager();
faderModeManager.register(Modes.DEVICE_PARAMS, new LaunchkeyMk3ParameterMode(surface, this.model, DEFAULT_FADER_IDS));
faderModeManager.register(Modes.VOLUME, new LaunchkeyMk3VolumeMode(surface, this.model, DEFAULT_FADER_IDS));
faderModeManager.register(Modes.SEND1, new LaunchkeyMk3SendMode(0, surface, this.model, DEFAULT_FADER_IDS));
faderModeManager.register(Modes.SEND2, new LaunchkeyMk3SendMode(1, surface, this.model, DEFAULT_FADER_IDS));
faderModeManager.register(Modes.DEVICE_LAYER_SEND1, new CustomMode(1, surface, this.model));
faderModeManager.register(Modes.DEVICE_LAYER_SEND2, new CustomMode(2, surface, this.model));
faderModeManager.register(Modes.DEVICE_LAYER_SEND3, new CustomMode(3, surface, this.model));
faderModeManager.register(Modes.DEVICE_LAYER_SEND4, new CustomMode(4, surface, this.model));
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class AbstractTrackCommand method onModeButton.
protected void onModeButton(final ButtonEvent event, final Modes controlMode, final String notification) {
final ModeManager modeManager = this.surface.getModeManager();
final ViewManager viewManager = this.surface.getViewManager();
switch(event) {
case DOWN:
this.firstRowUsed = false;
if (modeManager.isActive(controlMode)) {
modeManager.setActive(Modes.DUMMY);
return;
}
modeManager.setActive(controlMode);
this.wasSession = viewManager.isActive(Views.SESSION);
if (!this.wasSession)
viewManager.setActive(Views.SESSION);
this.surface.getDisplay().notify(notification);
break;
case LONG:
this.firstRowUsed = true;
break;
case UP:
if (this.firstRowUsed) {
modeManager.setActive(Modes.DUMMY);
if (!this.wasSession)
viewManager.restore();
}
break;
}
}
Aggregations