use of de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier in project DrivenByMoss by git-moss.
the class LaunchkeyMiniMk3ControllerSetup method registerTriggerCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerTriggerCommands() {
final LaunchkeyMiniMk3ControlSurface surface = this.getSurface();
final ITransport t = this.model.getTransport();
final ViewManager viewManager = surface.getViewManager();
this.addButton(ButtonID.SHIFT, "Shift", NopCommand.INSTANCE, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_SHIFT);
this.addButton(ButtonID.PLAY, "Play", new PlayCommand<>(this.model, surface), 15, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_PLAY, t::isPlaying);
final ConfiguredRecordCommand<LaunchkeyMiniMk3ControlSurface, LaunchkeyMiniMk3Configuration> recordCommand = new ConfiguredRecordCommand<>(this.model, surface);
this.addButton(ButtonID.RECORD, "Record", recordCommand, 15, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_RECORD, recordCommand::isLit);
final ModeCursorCommand<LaunchkeyMiniMk3ControlSurface, LaunchkeyMiniMk3Configuration> leftCommand = new ModeCursorCommand<>(Direction.LEFT, this.model, surface, true);
this.addButton(ButtonID.MOVE_TRACK_LEFT, "Previous", leftCommand, 15, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_LEFT, leftCommand::canScroll);
final ModeCursorCommand<LaunchkeyMiniMk3ControlSurface, LaunchkeyMiniMk3Configuration> rightCommand = new ModeCursorCommand<>(Direction.RIGHT, this.model, surface, true);
this.addButton(ButtonID.MOVE_TRACK_RIGHT, "Next", rightCommand, 15, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_RIGHT, rightCommand::canScroll);
// Scene buttons
this.addButton(ButtonID.SCENE1, "Scene 1", new ViewButtonCommand<>(ButtonID.SCENE1, surface), LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_SCENE1, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.SCENE1));
this.addButton(ButtonID.SCENE2, "Scene 2", new ViewButtonCommand<>(ButtonID.SCENE2, surface), LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_SCENE2, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.SCENE2));
// View selection with Pads in Shift mode
this.createViewButton(ButtonID.ROW2_1, OutputID.LED_RING1, "Session", Views.SESSION, LaunchkeyMiniMk3ControlSurface.PAD_MODE_SESSION);
this.createViewButton(ButtonID.ROW2_2, OutputID.LED_RING2, "Drum", Views.DRUM, LaunchkeyMiniMk3ControlSurface.PAD_MODE_DRUM);
this.createViewButton(ButtonID.ROW2_3, OutputID.LED_RING3, "Custom", Views.PLAY, LaunchkeyMiniMk3ControlSurface.PAD_MODE_CUSTOM);
// Knob mode selection with Pads in Shift mode
this.createModeButton(ButtonID.ROW1_1, OutputID.LED1, "Device", Modes.DEVICE_PARAMS, LaunchkeyMiniMk3ControlSurface.KNOB_MODE_PARAMS);
this.createModeButton(ButtonID.ROW1_2, OutputID.LED2, "Volume", Modes.VOLUME, LaunchkeyMiniMk3ControlSurface.KNOB_MODE_VOLUME);
this.createModeButton(ButtonID.ROW1_3, OutputID.LED3, "Pan", Modes.PAN, LaunchkeyMiniMk3ControlSurface.KNOB_MODE_PAN);
this.createModeButton(ButtonID.ROW1_4, OutputID.LED4, "Send 1", Modes.SEND1, LaunchkeyMiniMk3ControlSurface.KNOB_MODE_SEND1);
this.createModeButton(ButtonID.ROW1_5, OutputID.LED5, "Send 2", Modes.SEND2, LaunchkeyMiniMk3ControlSurface.KNOB_MODE_SEND2);
this.createModeButton(ButtonID.ROW1_6, OutputID.LED6, "Custom", Modes.USER, LaunchkeyMiniMk3ControlSurface.KNOB_MODE_CUSTOM);
// Online state
this.addButton(ButtonID.CONTROL, "DAW Online", (event, velocity) -> surface.setDAWConnected(velocity > 0), 15, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_DAW_ONLINE, surface::isDAWConnected);
}
use of de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier in project DrivenByMoss by git-moss.
the class SLMkIIIControllerSetup method registerTriggerCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerTriggerCommands() {
final SLMkIIIControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
final ViewManager viewManager = surface.getViewManager();
final ITransport t = this.model.getTransport();
final ITrackBank tb = this.model.getTrackBank();
final WindCommand<SLMkIIIControlSurface, SLMkIIIConfiguration> rewindCommand = new WindCommand<>(this.model, surface, false);
final WindCommand<SLMkIIIControlSurface, SLMkIIIConfiguration> forwardCommand = new WindCommand<>(this.model, surface, true);
this.addButton(ButtonID.REWIND, "<<", rewindCommand, 15, SLMkIIIControlSurface.MKIII_TRANSPORT_REWIND, () -> rewindCommand.isRewinding() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_WIND_ON, SLMkIIIColorManager.BUTTON_STATE_WIND_HI);
this.addButton(ButtonID.FORWARD, ">>", forwardCommand, 15, SLMkIIIControlSurface.MKIII_TRANSPORT_FORWARD, () -> forwardCommand.isForwarding() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_WIND_ON, SLMkIIIColorManager.BUTTON_STATE_WIND_HI);
this.addButton(ButtonID.LOOP, "Loop", new SLMkIIIToggleLoopCommand(this.model, surface), 15, SLMkIIIControlSurface.MKIII_TRANSPORT_LOOP, () -> t.isLoop() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_LOOP_ON, SLMkIIIColorManager.BUTTON_STATE_LOOP_HI);
this.addButton(ButtonID.STOP, "Stop", new StopCommand<>(this.model, surface), 15, SLMkIIIControlSurface.MKIII_TRANSPORT_STOP, () -> !t.isPlaying() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_STOP_ON, SLMkIIIColorManager.BUTTON_STATE_STOP_HI);
this.addButton(ButtonID.PLAY, "Play", new SLMkIIIPlayCommand(this.model, surface), 15, SLMkIIIControlSurface.MKIII_TRANSPORT_PLAY, () -> t.isPlaying() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_PLAY_ON, SLMkIIIColorManager.BUTTON_STATE_PLAY_HI);
this.addButton(ButtonID.RECORD, "Record", new RecordCommand<>(this.model, surface), 15, SLMkIIIControlSurface.MKIII_TRANSPORT_RECORD, () -> {
final boolean isOn = this.isRecordShifted(surface) ? t.isLauncherOverdub() : t.isRecording();
return isOn ? 1 : 0;
}, SLMkIIIColorManager.BUTTON_STATE_REC_ON, SLMkIIIColorManager.BUTTON_STATE_REC_HI, SLMkIIIColorManager.BUTTON_STATE_OVR_ON, SLMkIIIColorManager.BUTTON_STATE_OVR_HI);
for (int i = 0; i < 8; i++) {
final int index = i;
final ButtonID buttonID = ButtonID.get(ButtonID.ROW1_1, i);
this.addButton(buttonID, "Select " + (i + 1), new ButtonRowModeCommand<>(0, i, this.model, surface), 15, SLMkIIIControlSurface.MKIII_DISPLAY_BUTTON_1 + i, new FeatureGroupButtonColorSupplier(modeManager, buttonID));
this.addButton(ButtonID.get(ButtonID.ROW2_1, i), "Mute/Monitor " + (i + 1), new ButtonAreaCommand(0, i, this.model, surface), 15, SLMkIIIControlSurface.MKIII_BUTTON_ROW1_1 + i, () -> {
final ITrack track = tb.getItem(index);
if (!track.doesExist())
return SLMkIIIColorManager.SLMKIII_BLACK;
if (surface.isMuteSolo())
return track.isMute() ? SLMkIIIColorManager.SLMKIII_ORANGE : SLMkIIIColorManager.SLMKIII_ORANGE_HALF;
return track.isMonitor() ? SLMkIIIColorManager.SLMKIII_GREEN : SLMkIIIColorManager.SLMKIII_GREEN_HALF;
});
this.addButton(ButtonID.get(ButtonID.ROW3_1, i), "Solo/Arm" + (i + 1), new ButtonAreaCommand(1, i, this.model, surface), 15, SLMkIIIControlSurface.MKIII_BUTTON_ROW2_1 + i, () -> {
final ITrack track = tb.getItem(index);
if (!track.doesExist())
return SLMkIIIColorManager.SLMKIII_BLACK;
if (surface.isMuteSolo())
return track.isSolo() ? SLMkIIIColorManager.SLMKIII_YELLOW : SLMkIIIColorManager.SLMKIII_YELLOW_HALF;
return track.isRecArm() ? SLMkIIIColorManager.SLMKIII_RED : SLMkIIIColorManager.SLMKIII_RED_HALF;
});
}
this.addButton(ButtonID.ARROW_UP, "Up", new DeviceModeCommand(this.model, surface), 15, SLMkIIIControlSurface.MKIII_DISPLAY_UP, () -> getDeviceModeColor(modeManager));
this.addButton(ButtonID.ARROW_DOWN, "Down", new TrackModeCommand(this.model, surface), 15, SLMkIIIControlSurface.MKIII_DISPLAY_DOWN, () -> getTrackModeColor(modeManager));
this.addButton(ButtonID.SHIFT, "Shift", new ShiftCommand<>(this.model, surface), 15, SLMkIIIControlSurface.MKIII_SHIFT);
this.addButton(ButtonID.USER, "Options", new ModeSelectCommand<>(this.model, surface, Modes.FUNCTIONS, true), 15, SLMkIIIControlSurface.MKIII_OPTIONS, () -> modeManager.isActive(Modes.FUNCTIONS) ? SLMkIIIColorManager.SLMKIII_DARK_BROWN : SLMkIIIColorManager.SLMKIII_DARK_GREY);
this.addButton(ButtonID.OCTAVE_UP, "Up", (event, value) -> {
if (event == ButtonEvent.UP)
surface.toggleMuteSolo();
}, 15, SLMkIIIControlSurface.MKIII_BUTTONS_UP, () -> surface.isMuteSolo() ? SLMkIIIColorManager.SLMKIII_ORANGE : SLMkIIIColorManager.SLMKIII_ORANGE_HALF);
this.addButton(ButtonID.OCTAVE_DOWN, "Down", (event, value) -> {
if (event == ButtonEvent.UP)
surface.toggleMuteSolo();
}, 15, SLMkIIIControlSurface.MKIII_BUTTONS_DOWN, () -> !surface.isMuteSolo() ? SLMkIIIColorManager.SLMKIII_RED : SLMkIIIColorManager.SLMKIII_RED_HALF);
final ModeCursorCommand<SLMkIIIControlSurface, SLMkIIIConfiguration> cursorLeftCommand = new ModeCursorCommand<>(Direction.LEFT, this.model, surface, true);
this.addButton(ButtonID.ARROW_LEFT, "Left", cursorLeftCommand, 15, SLMkIIIControlSurface.MKIII_TRACK_LEFT, () -> getCursorColor(modeManager, cursorLeftCommand));
final ModeCursorCommand<SLMkIIIControlSurface, SLMkIIIConfiguration> cursorRightCommand = new ModeCursorCommand<>(Direction.RIGHT, this.model, surface, true);
this.addButton(ButtonID.ARROW_RIGHT, "Right", cursorRightCommand, 15, SLMkIIIControlSurface.MKIII_TRACK_RIGHT, () -> getCursorColor(modeManager, cursorRightCommand));
for (int i = 0; i < 2; i++) {
final ButtonID sceneButtonID = ButtonID.get(ButtonID.SCENE1, i);
this.addButton(sceneButtonID, "Scene " + (i + 1), new ViewButtonCommand<>(sceneButtonID, surface), 15, SLMkIIIControlSurface.MKIII_SCENE_1 + i, new FeatureGroupButtonColorSupplier(viewManager, sceneButtonID));
}
this.addButton(ButtonID.SCENE7, "Scene Up", (event, value) -> {
if (event != ButtonEvent.DOWN)
return;
if (viewManager.isActive(Views.SESSION))
this.model.getSceneBank().scrollBackwards();
else if (viewManager.isActive(Views.DRUM)) {
final DrumView drumView = (DrumView) viewManager.get(Views.DRUM);
if (drumView.isPlayMode())
drumView.onOctaveUp(ButtonEvent.DOWN);
else
drumView.onLeft(ButtonEvent.DOWN);
} else if (viewManager.isActive(Views.COLOR))
((ColorView<?, ?>) viewManager.get(Views.COLOR)).setPage(0);
}, 15, SLMkIIIControlSurface.MKIII_SCENE_UP, this::getSceneUpColor);
this.addButton(ButtonID.SCENE8, "Scene Down", (event, value) -> {
if (event != ButtonEvent.DOWN)
return;
if (viewManager.isActive(Views.SESSION))
this.model.getSceneBank().scrollForwards();
else if (viewManager.isActive(Views.DRUM)) {
final DrumView drumView = (DrumView) viewManager.get(Views.DRUM);
if (drumView.isPlayMode())
drumView.onOctaveDown(ButtonEvent.DOWN);
else
drumView.onRight(ButtonEvent.DOWN);
} else if (viewManager.isActive(Views.COLOR))
((ColorView<?, ?>) viewManager.get(Views.COLOR)).setPage(1);
}, 15, SLMkIIIControlSurface.MKIII_SCENE_DOWN, this::getSceneDownColor);
this.addButton(ButtonID.SESSION, "Grid", (event, value) -> {
if (event != ButtonEvent.DOWN)
return;
viewManager.setActive(viewManager.isActive(Views.SESSION) ? Views.DRUM : Views.SESSION);
this.getSurface().getDisplay().notify(viewManager.isActive(Views.SESSION) ? "Session" : "Sequencer");
}, 15, SLMkIIIControlSurface.MKIII_GRID, () -> viewManager.isActive(Views.SESSION) ? SLMkIIIColorManager.SLMKIII_GREEN : SLMkIIIColorManager.SLMKIII_BLUE);
this.addButton(ButtonID.DUPLICATE, "Duplicate", NopCommand.INSTANCE, 15, SLMkIIIControlSurface.MKIII_DUPLICATE, () -> surface.isPressed(ButtonID.DUPLICATE) ? SLMkIIIColorManager.SLMKIII_AMBER : SLMkIIIColorManager.SLMKIII_AMBER_HALF);
final SLMkIIIDisplay display = surface.getDisplay();
for (int i = 0; i < 8; i++) {
final int index = i;
surface.createLight(OutputID.get(OutputID.LED1, i), () -> {
final ITrack track = tb.getItem(index);
return track.getColor().dim(this.valueChanger.toNormalizedValue(track.getVolume()));
}, color -> display.setFaderLEDColor(SLMkIIIControlSurface.MKIII_FADER_LED_1 + index, color));
surface.createLight(OutputID.get(OutputID.LED_RING1, i), () -> {
// Note: On mode change the color does not change if the value is the same,
// let's ignore that since it is only visible in the simulation GUI
final IMode mode = modeManager.getActive();
if (mode == null)
return 0;
final int value = Math.max(0, mode.getKnobValue(index));
return this.valueChanger.toMidiValue(value);
}, color -> surface.setTrigger(SLMkIIIControlSurface.MKIII_KNOB_1 + index, color), state -> {
// On the device, the send value is displayed on the display as a knob
// On the simulation GUI represent it as a dimmed color of the mode
final BaseMode<?> mode = (BaseMode<?>) modeManager.getActive();
if (mode == null)
return ColorEx.BLACK;
final ColorEx c = this.colorManager.getColor(mode.getModeColor(), null);
return c.dim(this.valueChanger.toNormalizedValue(this.valueChanger.toDAWValue(state)));
}, null);
}
}
use of de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier in project DrivenByMoss by git-moss.
the class LaunchkeyMk3ControllerSetup method registerTriggerCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerTriggerCommands() {
final LaunchkeyMk3ControlSurface surface = this.getSurface();
final ITransport t = this.model.getTransport();
final ViewManager viewManager = surface.getViewManager();
this.addButton(ButtonID.SHIFT, "Shift", NopCommand.INSTANCE, LaunchkeyMk3ControlSurface.LAUNCHKEY_SHIFT);
this.addButton(ButtonID.PLAY, "Play", new LaunchkeyMk3PlayCommand(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_PLAY, t::isPlaying);
this.addButton(ButtonID.STOP, "Stop", new StopCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_STOP, () -> !t.isPlaying());
final ConfiguredRecordCommand<LaunchkeyMk3ControlSurface, LaunchkeyMk3Configuration> recordCommand = new ConfiguredRecordCommand<>(this.model, surface);
this.addButton(ButtonID.RECORD, "Record", recordCommand, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_RECORD, recordCommand::isLit);
this.addButton(ButtonID.REPEAT, "Repeat", new ToggleLoopCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_LOOP, t::isLoop);
this.addButton(ButtonID.NEW, "Capture MIDI", new NewCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_CAPTURE_MIDI);
this.addButton(ButtonID.QUANTIZE, "Quantize", new QuantizeCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_QUANTIZE);
this.addButton(ButtonID.METRONOME, "Metronome", new MetronomeCommand<>(this.model, surface, true), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_CLICK, t::isMetronomeOn);
this.addButton(ButtonID.UNDO, "Undo", new UndoCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_UNDO);
this.addDummyButton(ButtonID.F3, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DEVICE_SELECT);
this.addButton(ButtonID.TOGGLE_DEVICE, "Device Lock", new DeviceLockCommand(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DEVICE_LOCK, () -> this.model.getCursorDevice().isPinned() ? 127 : 40);
this.addButton(ButtonID.MOVE_TRACK_LEFT, "Previous", new SelectPrevNextTrackCommand<>(this.model, surface, true), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_TRACK_LEFT);
this.addButton(ButtonID.MOVE_TRACK_RIGHT, "Next", new SelectPrevNextTrackCommand<>(this.model, surface, false), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_TRACK_RIGHT);
// Scene buttons
this.addButton(ButtonID.SCENE1, "Scene 1", new ViewButtonCommand<>(ButtonID.SCENE1, surface), LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE1, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.SCENE1));
this.addButton(ButtonID.SCENE2, "Scene 2", new ViewButtonCommand<>(ButtonID.SCENE2, surface), LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE2, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.SCENE2));
this.addButton(surface, ButtonID.ARROW_UP, "Up", new ViewButtonCommand<>(ButtonID.ARROW_UP, surface), 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_ARROW_UP, -1, true, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.ARROW_UP));
this.addButton(surface, ButtonID.ARROW_DOWN, "Down", new ViewButtonCommand<>(ButtonID.ARROW_DOWN, surface), 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_ARROW_DOWN, -1, true, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.ARROW_DOWN));
// Ignore redundant messages sent by arrow up/down buttons
this.addDummyButton(ButtonID.F1, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE1);
this.addDummyButton(ButtonID.F2, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE2);
// View selection with Pads in Shift mode
this.createViewButton(ButtonID.ROW2_1, OutputID.LED_RING1, "Session", Views.SESSION, LaunchkeyMk3ControlSurface.PAD_MODE_SESSION);
this.createViewButton(ButtonID.ROW2_2, OutputID.LED_RING2, "Drum", Views.DRUM, LaunchkeyMk3ControlSurface.PAD_MODE_DRUM);
this.createViewButton(ButtonID.ROW2_3, OutputID.LED_RING3, "Scale Chords", Views.DUMMY1, LaunchkeyMk3ControlSurface.PAD_MODE_SCALE_CHORDS);
this.createViewButton(ButtonID.ROW2_4, OutputID.LED_RING4, "User Chords", Views.DUMMY2, LaunchkeyMk3ControlSurface.PAD_MODE_USER_CHORDS);
this.createViewButton(ButtonID.ROW2_5, OutputID.LED_RING5, NAME_CUSTOM_1, Views.DUMMY3, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE0);
this.createViewButton(ButtonID.ROW2_6, OutputID.LED_RING6, NAME_CUSTOM_2, Views.DUMMY4, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE1);
this.createViewButton(ButtonID.ROW2_7, OutputID.LED_RING7, NAME_CUSTOM_3, Views.DUMMY5, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE2);
this.createViewButton(ButtonID.ROW2_8, OutputID.LED_RING8, NAME_CUSTOM_4, Views.DUMMY6, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE3);
this.createViewButton(ButtonID.DEVICE, OutputID.LED_RING9, "Device Select", Views.DEVICE, LaunchkeyMk3ControlSurface.PAD_MODE_DEVICE_SELECT);
this.createViewButton(ButtonID.BROWSE, OutputID.LED_RING10, "Browser", Views.BROWSER, LaunchkeyMk3ControlSurface.PAD_MODE_NAVIGATION);
// Knob mode selection with Pads in Shift mode
this.createModeButton(ButtonID.ROW1_1, OutputID.LED1, "Device", Modes.DEVICE_PARAMS, LaunchkeyMk3ControlSurface.KNOB_MODE_PARAMS);
this.createModeButton(ButtonID.ROW1_2, OutputID.LED2, "Volume", Modes.VOLUME, LaunchkeyMk3ControlSurface.KNOB_MODE_VOLUME);
this.createModeButton(ButtonID.ROW1_3, OutputID.LED3, "Pan", Modes.PAN, LaunchkeyMk3ControlSurface.KNOB_MODE_PAN);
this.createModeButton(ButtonID.ROW1_4, OutputID.LED4, "Send 1", Modes.SEND1, LaunchkeyMk3ControlSurface.KNOB_MODE_SEND1);
this.createModeButton(ButtonID.ROW1_5, OutputID.LED5, "Send 2", Modes.SEND2, LaunchkeyMk3ControlSurface.KNOB_MODE_SEND2);
this.createModeButton(ButtonID.ROW1_6, OutputID.LED6, NAME_CUSTOM_1, Modes.DEVICE_LAYER_SEND1, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM1);
this.createModeButton(ButtonID.ROW1_7, OutputID.LED7, NAME_CUSTOM_2, Modes.DEVICE_LAYER_SEND2, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM2);
this.createModeButton(ButtonID.ROW1_8, OutputID.LED8, NAME_CUSTOM_3, Modes.DEVICE_LAYER_SEND3, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM3);
this.createModeButton(ButtonID.USER, OutputID.LED9, NAME_CUSTOM_4, Modes.DEVICE_LAYER_SEND4, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM4);
// Fader mode selection with fader buttons in Shift mode
this.createFaderModeButton(ButtonID.ROW3_1, OutputID.LIGHT_GUIDE1, "Device", Modes.DEVICE_PARAMS, LaunchkeyMk3ControlSurface.FADER_MODE_PARAMS);
this.createFaderModeButton(ButtonID.ROW3_2, OutputID.LIGHT_GUIDE2, "Volume", Modes.VOLUME, LaunchkeyMk3ControlSurface.FADER_MODE_VOLUME);
this.createFaderModeButton(ButtonID.ROW3_3, OutputID.LIGHT_GUIDE3, "Send 1", Modes.SEND1, LaunchkeyMk3ControlSurface.FADER_MODE_SEND1);
this.createFaderModeButton(ButtonID.ROW3_4, OutputID.LIGHT_GUIDE4, "Send 2", Modes.SEND2, LaunchkeyMk3ControlSurface.FADER_MODE_SEND2);
this.createFaderModeButton(ButtonID.ROW3_5, OutputID.LIGHT_GUIDE5, NAME_CUSTOM_1, Modes.DEVICE_LAYER_SEND1, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM1);
this.createFaderModeButton(ButtonID.ROW3_6, OutputID.LIGHT_GUIDE6, NAME_CUSTOM_2, Modes.DEVICE_LAYER_SEND2, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM2);
this.createFaderModeButton(ButtonID.ROW3_7, OutputID.LIGHT_GUIDE7, NAME_CUSTOM_3, Modes.DEVICE_LAYER_SEND3, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM3);
this.createFaderModeButton(ButtonID.ROW3_8, OutputID.LIGHT_GUIDE8, NAME_CUSTOM_4, Modes.DEVICE_LAYER_SEND4, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM4);
// Fader mode buttons
for (int i = 0; i < 8; i++) {
final ButtonID row1ButtonID = ButtonID.get(ButtonID.ROW_SELECT_1, i);
final IHwButton button = surface.createButton(row1ButtonID, "Select " + (i + 1));
final ButtonAreaCommand command = new ButtonAreaCommand(i, this.model, surface);
button.bind(command);
final IMidiInput midiInput = surface.getMidiInput();
final BindType triggerBindType = this.getTriggerBindType(row1ButtonID);
final int midiControl = LaunchkeyMk3ControlSurface.LAUNCHKEY_SELECT1 + i;
button.bind(midiInput, triggerBindType, 15, midiControl);
final IntSupplier supplier = command::getButtonColor;
surface.createLight(null, supplier::getAsInt, color -> surface.setTrigger(color >= 0x1000 ? 2 : 0, midiControl, color >= 0x1000 ? color - 0x1000 : color), state -> this.colorManager.getColor(state >= 0x1000 ? state - 0x1000 : state, row1ButtonID), button);
}
this.addButton(surface, ButtonID.MASTERTRACK, "Toggle Select/RecArm", (event, velocity) -> {
if (event == ButtonEvent.DOWN)
ButtonAreaCommand.toggleSelect();
}, 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_TOGGLE_SELECT, -1, true, () -> ButtonAreaCommand.isSelect() ? 40 : 127);
// Online state
this.addButton(ButtonID.CONTROL, "DAW Online", (event, velocity) -> surface.setDAWConnected(velocity > 0), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DAW_ONLINE, surface::isDAWConnected);
}
Aggregations