use of de.mossgrabers.mcu.command.trigger.AssignableCommand in project DrivenByMoss by git-moss.
the class MCUControllerSetup method registerTriggerCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerTriggerCommands() {
// Assignments to the main device
final MCUControlSurface surface = this.getSurface();
// Footswitches
this.addTriggerCommand(COMMAND_FOOTSWITCH1, MCUControlSurface.MCU_USER_A, new AssignableCommand(0, this.model, surface));
this.addTriggerCommand(COMMAND_FOOTSWITCH2, MCUControlSurface.MCU_USER_B, new AssignableCommand(1, this.model, surface));
// Navigation
this.addTriggerCommand(Commands.COMMAND_REWIND, MCUControlSurface.MCU_REWIND, new WindCommand<>(this.model, surface, false));
this.addTriggerCommand(Commands.COMMAND_FORWARD, MCUControlSurface.MCU_FORWARD, new WindCommand<>(this.model, surface, true));
this.addTriggerCommand(Commands.COMMAND_LOOP, MCUControlSurface.MCU_REPEAT, new ToggleLoopCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_STOP, MCUControlSurface.MCU_STOP, new StopCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_PLAY, MCUControlSurface.MCU_PLAY, new PlayCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_RECORD, MCUControlSurface.MCU_RECORD, new MCURecordCommand(this.model, surface));
this.addTriggerCommand(COMMAND_SCRUB, MCUControlSurface.MCU_SCRUB, new ScrubCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ARROW_LEFT, MCUControlSurface.MCU_ARROW_LEFT, new CursorCommand(Direction.LEFT, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ARROW_RIGHT, MCUControlSurface.MCU_ARROW_RIGHT, new CursorCommand(Direction.RIGHT, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ARROW_UP, MCUControlSurface.MCU_ARROW_UP, new CursorCommand(Direction.UP, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ARROW_DOWN, MCUControlSurface.MCU_ARROW_DOWN, new CursorCommand(Direction.DOWN, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_ZOOM, MCUControlSurface.MCU_ZOOM, new ZoomCommand(this.model, surface));
// Display Mode
this.addTriggerCommand(COMMAND_TOGGLE_DISPLAY, MCUControlSurface.MCU_NAME_VALUE, new ToggleDisplayCommand(this.model, surface));
this.addTriggerCommand(COMMAND_TEMPO_TICKS, MCUControlSurface.MCU_SMPTE_BEATS, new TempoTicksCommand(this.model, surface));
// Functions
this.addTriggerCommand(Commands.COMMAND_SHIFT, MCUControlSurface.MCU_SHIFT, new ShiftCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_SELECT, MCUControlSurface.MCU_OPTION, new NopCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_PUNCH_IN, MCUControlSurface.MCU_F6, new PunchInCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_PUNCH_OUT, MCUControlSurface.MCU_F7, new PunchOutCommand<>(this.model, surface));
this.addTriggerCommand(COMMAND_F1, MCUControlSurface.MCU_F1, new AssignableCommand(2, this.model, surface));
this.addTriggerCommand(COMMAND_F2, MCUControlSurface.MCU_F2, new AssignableCommand(3, this.model, surface));
this.addTriggerCommand(COMMAND_F3, MCUControlSurface.MCU_F3, new AssignableCommand(4, this.model, surface));
this.addTriggerCommand(COMMAND_F4, MCUControlSurface.MCU_F4, new AssignableCommand(5, this.model, surface));
this.addTriggerCommand(COMMAND_F5, MCUControlSurface.MCU_F5, new AssignableCommand(6, this.model, surface));
// Assignment
this.addTriggerCommand(Commands.COMMAND_TRACK, MCUControlSurface.MCU_MODE_IO, new TracksCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_PAN_SEND, MCUControlSurface.MCU_MODE_PAN, new ModeSelectCommand<>(Modes.MODE_PAN, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_SENDS, MCUControlSurface.MCU_MODE_SENDS, new SendSelectCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_DEVICE, MCUControlSurface.MCU_MODE_PLUGIN, new DevicesCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_MOVE_TRACK_LEFT, MCUControlSurface.MCU_MODE_EQ, new MoveTrackBankCommand<>(this.model, surface, Modes.MODE_DEVICE_PARAMS, true, true));
this.addTriggerCommand(Commands.COMMAND_MOVE_TRACK_RIGHT, MCUControlSurface.MCU_MODE_DYN, new MoveTrackBankCommand<>(this.model, surface, Modes.MODE_DEVICE_PARAMS, true, false));
// Automation
this.addTriggerCommand(Commands.COMMAND_AUTOMATION_READ, MCUControlSurface.MCU_READ, new AutomationCommand(0, this.model, surface));
final AutomationCommand writeCommand = new AutomationCommand(1, this.model, surface);
this.addTriggerCommand(Commands.COMMAND_AUTOMATION_WRITE, MCUControlSurface.MCU_WRITE, writeCommand);
this.addTriggerCommand(Commands.COMMAND_AUTOMATION_WRITE, MCUControlSurface.MCU_GROUP, writeCommand);
this.addTriggerCommand(Commands.COMMAND_AUTOMATION_TRIM, MCUControlSurface.MCU_TRIM, new AutomationCommand(2, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_AUTOMATION_TOUCH, MCUControlSurface.MCU_TOUCH, new AutomationCommand(3, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_AUTOMATION_LATCH, MCUControlSurface.MCU_LATCH, new AutomationCommand(4, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_UNDO, MCUControlSurface.MCU_UNDO, new UndoCommand<>(this.model, surface));
// Panes
this.addTriggerCommand(COMMAND_NOTE_EDITOR, MCUControlSurface.MCU_MIDI_TRACKS, new PaneCommand<>(PaneCommand.Panels.NOTE, this.model, surface));
this.addTriggerCommand(COMMAND_AUTOMATION_EDITOR, MCUControlSurface.MCU_INPUTS, new PaneCommand<>(PaneCommand.Panels.AUTOMATION, this.model, surface));
this.addTriggerCommand(COMMAND_TOGGLE_DEVICE, MCUControlSurface.MCU_AUDIO_TRACKS, new PaneCommand<>(PaneCommand.Panels.DEVICE, this.model, surface));
this.addTriggerCommand(COMMAND_MIXER, MCUControlSurface.MCU_AUDIO_INSTR, new PaneCommand<>(PaneCommand.Panels.MIXER, this.model, surface));
// Layouts
this.addTriggerCommand(COMMAND_LAYOUT_ARRANGE, MCUControlSurface.MCU_AUX, new LayoutCommand<>(IApplication.PANEL_LAYOUT_ARRANGE, this.model, surface));
this.addTriggerCommand(COMMAND_LAYOUT_MIX, MCUControlSurface.MCU_BUSSES, new LayoutCommand<>(IApplication.PANEL_LAYOUT_MIX, this.model, surface));
this.addTriggerCommand(COMMAND_LAYOUT_EDIT, MCUControlSurface.MCU_OUTPUTS, new LayoutCommand<>(IApplication.PANEL_LAYOUT_EDIT, this.model, surface));
// Utilities
this.addTriggerCommand(Commands.COMMAND_BROWSE, MCUControlSurface.MCU_USER, new BrowserCommand<>(Modes.MODE_BROWSER, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_METRONOME, MCUControlSurface.MCU_CLICK, new MetronomeCommand<>(this.model, surface));
this.addTriggerCommand(COMMAND_GROOVE, MCUControlSurface.MCU_SOLO, new GrooveCommand(this.model, surface));
this.addTriggerCommand(COMMAND_OVERDUB, MCUControlSurface.MCU_REPLACE, new OverdubCommand(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_TAP_TEMPO, MCUControlSurface.MCU_NUDGE, new TapTempoCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_DUPLICATE, MCUControlSurface.MCU_DROP, new DuplicateCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_DEVICE_ON_OFF, MCUControlSurface.MCU_F8, new DeviceOnOffCommand<>(this.model, surface));
// Currently not used but prevent error in console
this.addTriggerCommand(COMMAND_CONTROL, MCUControlSurface.MCU_CONTROL, new NopCommand<>(this.model, surface));
this.addTriggerCommand(COMMAND_ALT, MCUControlSurface.MCU_ALT, new NopCommand<>(this.model, surface));
// Fader Controls
this.addTriggerCommand(COMMAND_FLIP, MCUControlSurface.MCU_FLIP, new ToggleTrackBanksCommand<>(this.model, surface));
this.addTriggerCommand(COMMAND_CANCEL, MCUControlSurface.MCU_CANCEL, new KeyCommand(Key.ESCAPE, this.model, surface));
this.addTriggerCommand(COMMAND_ENTER, MCUControlSurface.MCU_ENTER, new KeyCommand(Key.ENTER, this.model, surface));
this.addTriggerCommand(Commands.COMMAND_MOVE_BANK_LEFT, MCUControlSurface.MCU_BANK_LEFT, new MoveTrackBankCommand<>(this.model, surface, Modes.MODE_DEVICE_PARAMS, false, true));
this.addTriggerCommand(Commands.COMMAND_MOVE_BANK_RIGHT, MCUControlSurface.MCU_BANK_RIGHT, new MoveTrackBankCommand<>(this.model, surface, Modes.MODE_DEVICE_PARAMS, false, false));
this.addTriggerCommand(Commands.COMMAND_MOVE_TRACK_LEFT, MCUControlSurface.MCU_TRACK_LEFT, new MoveTrackBankCommand<>(this.model, surface, Modes.MODE_DEVICE_PARAMS, true, true));
this.addTriggerCommand(Commands.COMMAND_MOVE_TRACK_RIGHT, MCUControlSurface.MCU_TRACK_RIGHT, new MoveTrackBankCommand<>(this.model, surface, Modes.MODE_DEVICE_PARAMS, true, false));
// Additional commands for footcontrollers
final ViewManager viewManager = surface.getViewManager();
viewManager.registerTriggerCommand(Commands.COMMAND_NEW, new NewCommand<>(this.model, surface));
viewManager.registerTriggerCommand(Commands.COMMAND_TAP_TEMPO, new TapTempoCommand<>(this.model, surface));
// Only MCU
this.addTriggerCommand(Commands.COMMAND_SAVE, MCUControlSurface.MCU_SAVE, new SaveCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_MARKER, MCUControlSurface.MCU_MARKER, new MarkerCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_TOGGLE_VU, MCUControlSurface.MCU_EDIT, new ToggleVUCommand<>(this.model, surface));
this.addTriggerCommand(Commands.COMMAND_MASTERTRACK, MCUControlSurface.MCU_FADER_MASTER, new SelectCommand(8, this.model, surface));
this.registerTriggerCommandsToAllDevices();
}
Aggregations