use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class ShiftView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
int viewIndex;
View view;
switch(note - 36) {
// Play
case 0:
this.playCommand.executeNormal(ButtonEvent.DOWN);
break;
// Record
case 1:
this.model.getTransport().record();
break;
// Repeat
case 2:
this.model.getTransport().toggleLoop();
break;
// Click
case 3:
this.model.getTransport().toggleMetronome();
break;
// Tap Tempo
case 4:
this.model.getTransport().tapTempo();
break;
// Insert device before current
case 5:
this.model.getBrowser().browseToInsertBeforeDevice();
this.activateBrowserView();
break;
// Insert device after current
case 6:
this.model.getBrowser().browseToInsertAfterDevice();
this.activateBrowserView();
break;
// Open the browser
case 7:
this.model.getBrowser().browseForPresets();
this.activateBrowserView();
break;
// Toggle window of VSTs
case 15:
this.model.getCursorDevice().toggleWindowOpen();
break;
default:
viewIndex = note - 44;
if (viewIndex < 0 || viewIndex >= 6)
return;
final ViewManager viewManager = this.surface.getViewManager();
final Integer viewId = Integer.valueOf(viewIndex);
viewManager.setPreviousView(viewId);
view = viewManager.getView(viewId);
this.surface.getDisplay().notify(view.getName());
break;
}
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class PushControllerSetup method flush.
/**
* {@inheritDoc}
*/
@Override
public void flush() {
this.flushSurfaces();
this.updateButtons();
final PushControlSurface surface = this.getSurface();
this.updateMode(surface.getModeManager().getActiveModeId());
final View activeView = surface.getViewManager().getActiveView();
if (activeView == null)
return;
final de.mossgrabers.framework.command.core.PitchbendCommand pitchbendCommand = activeView.getPitchbendCommand();
if (pitchbendCommand != null)
pitchbendCommand.updateValue();
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class PushControllerSetup method updateButtons.
private void updateButtons() {
final ITransport t = this.model.getTransport();
final PushControlSurface surface = this.getSurface();
surface.updateButton(PushControlSurface.PUSH_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_PLAY, t.isPlaying() ? PushColors.PUSH_BUTTON_STATE_PLAY_HI : PushColors.PUSH_BUTTON_STATE_PLAY_ON);
final boolean isShift = surface.isShiftPressed();
final boolean isFlipRecord = this.configuration.isFlipRecord();
final boolean isRecordShifted = isShift && !isFlipRecord || !isShift && isFlipRecord;
if (isRecordShifted)
surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingClipLauncherAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
else
surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingArrangerAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_RECORD, isRecordShifted ? t.isLauncherOverdub() ? PushColors.PUSH_BUTTON_STATE_OVR_HI : PushColors.PUSH_BUTTON_STATE_OVR_ON : t.isRecording() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, this.configuration.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
final PushConfiguration config = surface.getConfiguration();
if (this.isPush2) {
final ModeManager modeManager = surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER)) {
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel layer = cd.getSelectedLayerOrDrumPad();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, layer != null && layer.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, layer != null && layer.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
} else {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = modeManager.isActiveMode(Modes.MODE_MASTER) ? this.model.getMasterTrack() : tb.getSelectedTrack();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, selTrack != null && selTrack.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, selTrack != null && selTrack.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
}
surface.updateButton(PushControlSurface.PUSH_BUTTON_CONVERT, this.model.canConvertClip() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
final boolean isMuteState = config.isMuteState();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, isMuteState ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, !isMuteState ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
}
final ViewManager viewManager = surface.getViewManager();
final boolean isSessionView = Views.isSessionView(viewManager.getActiveViewId());
surface.updateButton(PushControlSurface.PUSH_BUTTON_NOTE, isSessionView ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
if (this.host.hasClips()) {
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) ? PushColors.PUSH_BUTTON_STATE_STOP_HI : PushColors.PUSH_BUTTON_STATE_STOP_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, isSessionView ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
} else {
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, ColorManager.BUTTON_STATE_OFF);
}
surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, config.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
final View activeView = viewManager.getActiveView();
if (activeView != null) {
((PushCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
((SceneView) activeView).updateSceneButtons();
}
final ICursorClip clip = activeView instanceof AbstractSequencerView && !(activeView instanceof ClipView) ? ((AbstractSequencerView<?, ?>) activeView).getClip() : null;
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_LEFT, clip != null && clip.canScrollStepsBackwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_RIGHT, clip != null && clip.canScrollStepsForwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class ShiftView method handleControlModes.
private boolean handleControlModes(final int note, final int velocity) {
final ButtonEvent event = velocity == 0 ? ButtonEvent.UP : ButtonEvent.DOWN;
final View view = this.surface.getViewManager().getActiveView();
switch(note) {
case 36:
view.getTriggerCommand(Commands.COMMAND_REC_ARM).execute(event);
break;
case 37:
view.getTriggerCommand(Commands.COMMAND_TRACK).execute(event);
break;
case 38:
view.getTriggerCommand(Commands.COMMAND_MUTE).execute(event);
break;
case 39:
view.getTriggerCommand(Commands.COMMAND_SOLO).execute(event);
break;
case 40:
view.getTriggerCommand(Commands.COMMAND_VOLUME).execute(event);
break;
case 41:
view.getTriggerCommand(Commands.COMMAND_PAN_SEND).execute(event);
break;
case 42:
view.getTriggerCommand(Commands.COMMAND_SENDS).execute(event);
break;
case 43:
view.getTriggerCommand(Commands.COMMAND_STOP_CLIP).execute(event);
break;
default:
return false;
}
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.getPreviousModeId() == modeManager.getActiveModeId())
modeManager.setActiveMode(null);
return true;
}
use of de.mossgrabers.framework.view.View 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();
}
Aggregations