use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class BrowserView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
final IBrowser browser = this.model.getBrowser();
if (!browser.isActive()) {
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActiveView(Views.VIEW_BROWSER))
viewManager.restoreView();
return;
}
switch(note) {
// Cancel
case 36:
if (velocity == 0)
return;
this.model.getBrowser().stopBrowsing(false);
this.surface.getViewManager().restoreView();
break;
// OK
case 43:
if (velocity == 0)
return;
this.model.getBrowser().stopBrowsing(true);
this.surface.getViewManager().restoreView();
break;
case 38:
this.surface.sendMidiEvent(0x90, 48, velocity);
break;
case 39:
this.surface.sendMidiEvent(0x90, 60, velocity);
break;
case 40:
this.surface.sendMidiEvent(0x90, 72, velocity);
break;
case 41:
this.surface.sendMidiEvent(0x90, 84, velocity);
break;
}
if (velocity == 0)
return;
if (note >= 52 && note < 84) {
final int n = note - 52;
final int row = n / 8;
final int col = n % 8;
switch(col) {
case 6:
return;
case 7:
if (row == 0)
browser.selectNextResult();
else if (row == 1) {
for (int i = 0; i < 8; i++) browser.selectNextResult();
} else if (row == 2) {
for (int i = 0; i < 8; i++) browser.selectPreviousResult();
} else if (row == 3)
browser.selectPreviousResult();
break;
default:
if (row == 0)
browser.selectNextFilterItem(BrowserView.COLUMN_ORDER[col]);
else if (row == 1) {
for (int i = 0; i < 8; i++) browser.selectNextFilterItem(BrowserView.COLUMN_ORDER[col]);
} else if (row == 2) {
for (int i = 0; i < 8; i++) browser.selectPreviousFilterItem(BrowserView.COLUMN_ORDER[col]);
} else if (row == 3)
browser.selectPreviousFilterItem(BrowserView.COLUMN_ORDER[col]);
break;
}
return;
}
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class TrackDetailsMode method onFirstRowTrack.
private void onFirstRowTrack(final int index) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack t = tb.getSelectedTrack();
if (t == null)
return;
switch(index) {
case 0:
t.toggleIsActivated();
break;
case 1:
t.toggleRecArm();
break;
case 2:
t.toggleMute();
break;
case 3:
t.toggleSolo();
break;
case 4:
t.toggleMonitor();
break;
case 5:
t.toggleAutoMonitor();
break;
case 6:
this.model.toggleCursorTrackPinned();
break;
case 7:
final ViewManager viewManager = this.surface.getViewManager();
((ColorView) viewManager.getView(Views.VIEW_COLOR)).setMode(ColorView.SelectMode.MODE_TRACK);
viewManager.setActiveView(Views.VIEW_COLOR);
break;
}
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class PushControllerSetup method handleTrackChange.
/**
* Handle a track selection change.
*
* @param index The index of the track
* @param isSelected Has the track been selected?
*/
private void handleTrackChange(final int index, final boolean isSelected) {
if (!isSelected)
return;
final PushControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final ModeManager modeManager = surface.getModeManager();
// Recall last used view (if we are not in session mode)
if (!viewManager.isActiveView(Views.VIEW_SESSION)) {
final ITrack selectedTrack = this.model.getCurrentTrackBank().getSelectedTrack();
if (selectedTrack != null) {
final Integer preferredView = viewManager.getPreferredView(selectedTrack.getPosition());
viewManager.setActiveView(preferredView == null ? this.configuration.getDefaultNoteView() : preferredView);
}
}
if (modeManager.isActiveMode(Modes.MODE_MASTER))
modeManager.setActiveMode(Modes.MODE_TRACK);
if (viewManager.isActiveView(Views.VIEW_PLAY))
viewManager.getActiveView().updateNoteMapping();
// Reset drum octave because the drum pad bank is also reset
this.scales.setDrumOctave(0);
if (viewManager.isActiveView(Views.VIEW_DRUM))
viewManager.getView(Views.VIEW_DRUM).updateNoteMapping();
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class PushControllerSetup method registerTriggerCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerTriggerCommands() {
final PushControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
this.addTriggerCommand(Commands.COMMAND_PLAY, PushControlSurface.PUSH_BUTTON_PLAY, new PlayCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_RECORD, PushControlSurface.PUSH_BUTTON_RECORD, new RecordCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_NEW, PushControlSurface.PUSH_BUTTON_NEW, new NewCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_DUPLICATE, PushControlSurface.PUSH_BUTTON_DUPLICATE, new DuplicateCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_AUTOMATION, PushControlSurface.PUSH_BUTTON_AUTOMATION, new AutomationCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_FIXED_LENGTH, PushControlSurface.PUSH_BUTTON_FIXED_LENGTH, new FixedLengthCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_QUANTIZE, PushControlSurface.PUSH_BUTTON_QUANTIZE, new PushQuantizeCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_DELETE, PushControlSurface.PUSH_BUTTON_DELETE, new DeleteCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_DOUBLE, PushControlSurface.PUSH_BUTTON_DOUBLE, new DoubleCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_UNDO, PushControlSurface.PUSH_BUTTON_UNDO, new UndoCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_DEVICE, PushControlSurface.PUSH_BUTTON_DEVICE, new DeviceCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_BROWSE, PushControlSurface.PUSH_BUTTON_BROWSE, new BrowserCommand<>(Modes.MODE_BROWSER, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_TRACK, PushControlSurface.PUSH_BUTTON_TRACK, new TrackCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_CLIP, PushControlSurface.PUSH_BUTTON_CLIP, new ClipCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_VOLUME, PushControlSurface.PUSH_BUTTON_VOLUME, new VolumeCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_PAN_SEND, PushControlSurface.PUSH_BUTTON_PAN_SEND, new PanSendCommand(this.model, surface));
for (int i = 0; i < 8; i++) {
this.addTriggerCommand(Integer.valueOf(Commands.COMMAND_ROW1_1.intValue() + i), PushControlSurface.PUSH_BUTTON_ROW1_1 + i, new ButtonRowModeCommand<>(0, i, this.model, surface));
this.addTriggerCommand(Integer.valueOf(Commands.COMMAND_ROW2_1.intValue() + i), PushControlSurface.PUSH_BUTTON_ROW2_1 + i, new ButtonRowModeCommand<>(1, i, this.model, surface));
this.addTriggerCommand(Integer.valueOf(Commands.COMMAND_SCENE1.intValue() + i), PushControlSurface.PUSH_BUTTON_SCENE1 + i, new SceneCommand<>(i, this.model, surface));
}
this.addTriggerCommand(Commands.COMMAND_SHIFT, PushControlSurface.PUSH_BUTTON_SHIFT, new ShiftCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_LAYOUT, PushControlSurface.PUSH_BUTTON_LAYOUT, new LayoutCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_SELECT, PushControlSurface.PUSH_BUTTON_SELECT, new SelectCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_TAP_TEMPO, PushControlSurface.PUSH_BUTTON_TAP, new TapTempoCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_METRONOME, PushControlSurface.PUSH_BUTTON_METRONOME, new MetronomeCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_MASTERTRACK, PushControlSurface.PUSH_BUTTON_MASTER, new MastertrackCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_PAGE_LEFT, PushControlSurface.PUSH_BUTTON_DEVICE_LEFT, new PageLeftCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_PAGE_RIGHT, PushControlSurface.PUSH_BUTTON_DEVICE_RIGHT, new PageRightCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_MUTE, PushControlSurface.PUSH_BUTTON_MUTE, new MuteCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_SOLO, PushControlSurface.PUSH_BUTTON_SOLO, new SoloCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_SCALES, PushControlSurface.PUSH_BUTTON_SCALES, new ScalesCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ACCENT, PushControlSurface.PUSH_BUTTON_ACCENT, new AccentCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ADD_EFFECT, PushControlSurface.PUSH_BUTTON_ADD_EFFECT, new AddEffectCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ADD_TRACK, PushControlSurface.PUSH_BUTTON_ADD_TRACK, new AddTrackCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_SELECT_PLAY_VIEW, PushControlSurface.PUSH_BUTTON_NOTE, new SelectPlayViewCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ARROW_DOWN, PushControlSurface.PUSH_BUTTON_DOWN, new PushCursorCommand(Direction.DOWN, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ARROW_UP, PushControlSurface.PUSH_BUTTON_UP, new PushCursorCommand(Direction.UP, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ARROW_LEFT, PushControlSurface.PUSH_BUTTON_LEFT, new PushCursorCommand(Direction.LEFT, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ARROW_RIGHT, PushControlSurface.PUSH_BUTTON_RIGHT, new PushCursorCommand(Direction.RIGHT, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_OCTAVE_DOWN, PushControlSurface.PUSH_BUTTON_OCTAVE_DOWN, new OctaveCommand(false, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_OCTAVE_UP, PushControlSurface.PUSH_BUTTON_OCTAVE_UP, new OctaveCommand(true, this.model, surface));
viewManager.registerTriggerCommand(Commands.COMMAND_SETUP, new SetupCommand(this.isPush2, this.model, surface));
if (this.isPush2) {
surface.assignTriggerCommand(PushControlSurface.PUSH_BUTTON_SETUP, Commands.COMMAND_SETUP);
this.addTriggerCommand(Commands.COMMAND_CONVERT, PushControlSurface.PUSH_BUTTON_CONVERT, new ConvertCommand<>(this.model, surface));
} else
surface.assignTriggerCommand(PushControlSurface.PUSH_BUTTON_USER_MODE, Commands.COMMAND_SETUP);
if (this.host.hasClips()) {
this.addTriggerCommand(Commands.COMMAND_STOP_CLIP, PushControlSurface.PUSH_BUTTON_CLIP_STOP, new StopClipCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_SELECT_SESSION_VIEW, PushControlSurface.PUSH_BUTTON_SESSION, new SelectSessionViewCommand(this.model, surface));
} else
this.addTriggerCommand(Commands.COMMAND_SELECT_SESSION_VIEW, PushControlSurface.PUSH_BUTTON_SESSION, new NopCommand<>(this.model, surface));
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class PushControllerSetup method createViews.
/**
* {@inheritDoc}
*/
@Override
protected void createViews() {
final PushControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
viewManager.registerView(Views.VIEW_PLAY, new PlayView(surface, this.model));
viewManager.registerView(Views.VIEW_PIANO, new PianoView(surface, this.model));
viewManager.registerView(Views.VIEW_PRG_CHANGE, new PrgChangeView(surface, this.model));
viewManager.registerView(Views.VIEW_CLIP, new ClipView(surface, this.model));
viewManager.registerView(Views.VIEW_COLOR, new ColorView(surface, this.model));
if (this.host.hasClips()) {
viewManager.registerView(Views.VIEW_SESSION, new SessionView(surface, this.model));
viewManager.registerView(Views.VIEW_SEQUENCER, new SequencerView(surface, this.model));
viewManager.registerView(Views.VIEW_DRUM, new DrumView(surface, this.model));
viewManager.registerView(Views.VIEW_DRUM4, new DrumView4(surface, this.model));
viewManager.registerView(Views.VIEW_DRUM8, new DrumView8(surface, this.model));
viewManager.registerView(Views.VIEW_DRUM64, new DrumView64(surface, this.model));
viewManager.registerView(Views.VIEW_RAINDROPS, new RaindropsView(surface, this.model));
viewManager.registerView(Views.VIEW_SCENE_PLAY, new ScenePlayView(surface, this.model));
}
}
Aggregations