use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class SelectSessionViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
if (event == ButtonEvent.DOWN) {
this.isTemporary = false;
final ViewManager viewManager = this.surface.getViewManager();
if (Views.isSessionView(viewManager.getActiveViewId())) {
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_SESSION_VIEW_SELECT))
modeManager.restoreMode();
else
modeManager.setActiveMode(Modes.MODE_SESSION_VIEW_SELECT);
} else
viewManager.setActiveView(Views.VIEW_SESSION);
return;
}
if (event == ButtonEvent.UP && this.isTemporary)
this.surface.getViewManager().restoreView();
}
use of de.mossgrabers.framework.mode.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 Integer activeModeId = modeManager.getActiveModeId();
if (Modes.MODE_PAN.equals(activeModeId)) {
modeManager.setActiveMode(Modes.MODE_VOLUME);
this.surface.getDisplay().notify("Volume");
} else if (Modes.MODE_VOLUME.equals(activeModeId)) {
modeManager.setActiveMode(Modes.MODE_TRACK);
this.surface.getDisplay().notify("Track");
} else if (Modes.MODE_TRACK.equals(activeModeId)) {
modeManager.setActiveMode(Modes.MODE_DEVICE_PARAMS);
this.surface.getDisplay().notify("Parameters");
} else {
modeManager.setActiveMode(Modes.MODE_PAN);
this.surface.getDisplay().notify("Panorama");
}
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class ModeSwitcher method scrollDown.
/**
* Scroll downwards through the modes.
*/
public void scrollDown() {
final ModeManager modeManager = this.surface.getModeManager();
final Integer activeModeId = modeManager.getActiveModeId();
if (Modes.MODE_PAN.equals(activeModeId)) {
modeManager.setActiveMode(Modes.MODE_DEVICE_PARAMS);
this.surface.getDisplay().notify("Parameters");
} else if (Modes.MODE_VOLUME.equals(activeModeId)) {
modeManager.setActiveMode(Modes.MODE_PAN);
this.surface.getDisplay().notify("Panorama");
} else if (Modes.MODE_TRACK.equals(activeModeId)) {
modeManager.setActiveMode(Modes.MODE_VOLUME);
this.surface.getDisplay().notify("Volume");
} else {
modeManager.setActiveMode(Modes.MODE_TRACK);
this.surface.getDisplay().notify("Track");
}
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class APCControllerSetup method updateButtons.
private void updateButtons() {
final APCControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final View activeView = viewManager.getActiveView();
if (activeView != null) {
((APCCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
((SceneView) activeView).updateSceneButtons();
}
final boolean isShift = surface.isShiftPressed();
final boolean isSendA = surface.isPressed(APCControlSurface.APC_BUTTON_SEND_A);
final ITransport t = this.model.getTransport();
surface.updateButton(APCControlSurface.APC_BUTTON_PLAY, t.isPlaying() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_RECORD, t.isRecording() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
// Activator, Solo, Record Arm
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
final int clipLength = surface.getConfiguration().getNewClipLength();
final ModeManager modeManager = surface.getModeManager();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
boolean isOn;
if (isShift)
isOn = i == clipLength;
else
isOn = isSendA ? modeManager.isActiveMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + i)) : i == selIndex;
surface.updateButtonEx(APCControlSurface.APC_BUTTON_TRACK_SELECTION, i, isOn ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_SOLO, i, track.doesExist() && (isShift ? track.isAutoMonitor() : track.isSolo()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_ACTIVATOR, i, track.doesExist() && (isShift ? track.isMonitor() : !track.isMute()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
if (this.isMkII) {
surface.updateButtonEx(APCControlSurface.APC_BUTTON_A_B, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
if (isShift)
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
else
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
}
surface.updateButton(APCControlSurface.APC_BUTTON_MASTER, this.model.getMasterTrack().isSelected() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
final ICursorDevice device = this.model.getCursorDevice();
if (this.isMkII) {
surface.updateButton(APCControlSurface.APC_BUTTON_SESSION, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_SEND_C, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_BANK, this.model.getBrowser().isActive() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
}
this.updateDeviceKnobs();
}
use of de.mossgrabers.framework.mode.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;
switch(index) {
case 0:
this.model.getCurrentTrackBank().scrollScenesPageUp();
break;
case 1:
this.model.getCurrentTrackBank().scrollScenesPageDown();
break;
case 2:
this.model.getCurrentTrackBank().scrollTracksPageUp();
break;
case 3:
this.model.getCurrentTrackBank().scrollTracksPageDown();
break;
case 4:
this.surface.getModeManager().setActiveMode(Modes.MODE_VOLUME);
this.surface.getConfiguration().setFaderCtrl("Volume");
this.surface.getDisplay().notify("Volume");
break;
case 5:
this.surface.getModeManager().setActiveMode(Modes.MODE_PAN);
this.surface.getConfiguration().setFaderCtrl("Pan");
this.surface.getDisplay().notify("Pan");
break;
case 6:
if (this.model.isEffectTrackBankActive())
return;
final ModeManager modeManager = this.surface.getModeManager();
Integer mode = Integer.valueOf(modeManager.getActiveModeId().intValue() + 1);
// Wrap
if (!Modes.isSendMode(mode))
mode = Modes.MODE_SEND1;
// Check if Send channel exists
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
if (Modes.isSendMode(mode) && fxTrackBank != null && !fxTrackBank.getTrack(mode.intValue() - Modes.MODE_SEND1.intValue()).doesExist())
mode = Modes.MODE_SEND1;
modeManager.setActiveMode(mode);
final String name = "Send " + (mode.intValue() - Modes.MODE_SEND1.intValue() + 1);
this.surface.getConfiguration().setFaderCtrl(name);
this.surface.getDisplay().notify(name);
break;
case 7:
if (this.surface.getModeManager().isActiveMode(Modes.MODE_DEVICE)) {
this.model.getBrowser().browseForPresets();
final ViewManager viewManager = this.surface.getViewManager();
final Integer previousViewId = viewManager.getPreviousViewId();
viewManager.setActiveView(Views.VIEW_BROWSER);
viewManager.setPreviousView(previousViewId);
} else {
this.surface.getModeManager().setActiveMode(Modes.MODE_DEVICE);
this.surface.getConfiguration().setFaderCtrl("Device");
this.surface.getDisplay().notify("Device");
}
break;
}
}
Aggregations