use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method createViews.
/**
* {@inheritDoc}
*/
@Override
protected void createViews() {
final BeatstepControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
viewManager.registerView(Views.VIEW_TRACK, new TrackView(surface, this.model));
viewManager.registerView(Views.VIEW_DEVICE, new DeviceView(surface, this.model));
viewManager.registerView(Views.VIEW_PLAY, new PlayView(surface, this.model));
viewManager.registerView(Views.VIEW_DRUM, new DrumView(surface, this.model));
viewManager.registerView(Views.VIEW_SEQUENCER, new SequencerView(surface, this.model));
viewManager.registerView(Views.VIEW_SESSION, new SessionView(surface, this.model));
viewManager.registerView(Views.VIEW_BROWSER, new BrowserView(surface, this.model));
viewManager.registerView(Views.VIEW_SHIFT, new ShiftView(surface, this.model));
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method registerContinuousCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerContinuousCommands() {
final BeatstepControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
for (int i = 0; i < 8; i++) {
this.addContinuousCommand(Integer.valueOf(Commands.CONT_COMMAND_KNOB1.intValue() + i), BeatstepControlSurface.BEATSTEP_KNOB_1 + i, new KnobRowViewCommand(i, this.model, surface));
this.addContinuousCommand(Integer.valueOf(Commands.CONT_COMMAND_DEVICE_KNOB1.intValue() + i), BeatstepControlSurface.BEATSTEP_KNOB_9 + i, new KnobRowViewCommand(i + 8, this.model, surface));
}
this.addContinuousCommand(Commands.CONT_COMMAND_MASTER_KNOB, BeatstepControlSurface.BEATSTEP_KNOB_MAIN, new BeatstepPlayPositionCommand(this.model, surface));
final PlayView playView = (PlayView) viewManager.getView(Views.VIEW_PLAY);
playView.registerAftertouchCommand(new AftertouchAbstractPlayViewCommand<>(playView, this.model, surface));
}
use of de.mossgrabers.framework.view.ViewManager 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.ViewManager in project DrivenByMoss by git-moss.
the class PushControllerSetup method registerContinuousCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerContinuousCommands() {
final PushControlSurface surface = this.getSurface();
for (int i = 0; i < 8; i++) this.addContinuousCommand(Integer.valueOf(Commands.CONT_COMMAND_KNOB1.intValue() + i), PushControlSurface.PUSH_KNOB1 + i, new KnobRowModeCommand<>(i, this.model, surface));
this.addContinuousCommand(Commands.CONT_COMMAND_MASTER_KNOB, PushControlSurface.PUSH_KNOB9, new MasterVolumeCommand<>(this.model, surface));
this.addContinuousCommand(Commands.CONT_COMMAND_TEMPO, PushControlSurface.PUSH_SMALL_KNOB1, new RasteredKnobCommand(this.model, surface));
this.addContinuousCommand(Commands.CONT_COMMAND_PLAY_POSITION, PushControlSurface.PUSH_SMALL_KNOB2, new PlayPositionCommand<>(this.model, surface));
this.addContinuousCommand(Commands.COMMAND_FOOTSWITCH, PushControlSurface.PUSH_FOOTSWITCH2, new FootswitchCommand<>(this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_KNOB1_TOUCH, PushControlSurface.PUSH_KNOB1_TOUCH, new KnobRowTouchModeCommand<>(0, this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_KNOB2_TOUCH, PushControlSurface.PUSH_KNOB2_TOUCH, new KnobRowTouchModeCommand<>(1, this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_KNOB3_TOUCH, PushControlSurface.PUSH_KNOB3_TOUCH, new KnobRowTouchModeCommand<>(2, this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_KNOB4_TOUCH, PushControlSurface.PUSH_KNOB4_TOUCH, new KnobRowTouchModeCommand<>(3, this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_KNOB5_TOUCH, PushControlSurface.PUSH_KNOB5_TOUCH, new KnobRowTouchModeCommand<>(4, this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_KNOB6_TOUCH, PushControlSurface.PUSH_KNOB6_TOUCH, new KnobRowTouchModeCommand<>(5, this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_KNOB7_TOUCH, PushControlSurface.PUSH_KNOB7_TOUCH, new KnobRowTouchModeCommand<>(6, this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_KNOB8_TOUCH, PushControlSurface.PUSH_KNOB8_TOUCH, new KnobRowTouchModeCommand<>(7, this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_TEMPO_TOUCH, PushControlSurface.PUSH_SMALL_KNOB1_TOUCH, new SmallKnobTouchCommand(this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_PLAYCURSOR_TOUCH, PushControlSurface.PUSH_SMALL_KNOB2_TOUCH, new SmallKnobTouchCommand(this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_CONFIGURE_PITCHBEND, PushControlSurface.PUSH_RIBBON_TOUCH, new ConfigurePitchbendCommand(this.model, surface));
this.addNoteCommand(Commands.CONT_COMMAND_MASTERTRACK_TOUCH, PushControlSurface.PUSH_KNOB9_TOUCH, new MastertrackTouchCommand(this.model, surface));
final ViewManager viewManager = surface.getViewManager();
viewManager.registerPitchbendCommand(new PitchbendCommand(this.model, surface));
final PlayView playView = (PlayView) viewManager.getView(Views.VIEW_PLAY);
playView.registerAftertouchCommand(new AftertouchAbstractPlayViewCommand<>(playView, this.model, surface));
final PlayView pianoView = (PlayView) viewManager.getView(Views.VIEW_PIANO);
pianoView.registerAftertouchCommand(new AftertouchAbstractPlayViewCommand<>(pianoView, this.model, surface));
if (this.host.hasClips()) {
viewManager.getView(Views.VIEW_SESSION).registerPitchbendCommand(new PitchbendSessionCommand(this.model, surface));
}
}
use of de.mossgrabers.framework.view.ViewManager 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);
}
Aggregations