use of de.mossgrabers.framework.daw.ITransport in project DrivenByMoss by git-moss.
the class OptionsMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITransport transport = this.model.getTransport();
final SLMkIIIDisplay d = this.surface.getDisplay();
d.clear();
d.setCell(3, 0, "Undo");
d.setPropertyColor(0, 2, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyValue(0, 1, 0);
d.setCell(3, 1, "Redo");
d.setPropertyColor(1, 2, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyValue(1, 1, 0);
d.setCell(3, 2, "<<Project");
d.setPropertyColor(2, 2, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyValue(2, 1, 0);
d.setCell(3, 3, "Project>>");
d.setPropertyColor(3, 2, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyValue(3, 1, 0);
d.setCell(3, 4, "Tap");
d.setPropertyColor(4, 2, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyValue(4, 1, 0);
d.setCell(3, 5, transport.isMetronomeOn() ? "On" : "Off");
d.setPropertyColor(5, 2, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyValue(5, 1, transport.isMetronomeOn() ? 1 : 0);
d.setCell(3, 6, "Engine");
d.setPropertyColor(6, 2, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyValue(6, 1, this.model.getApplication().isEngineActive() ? 1 : 0);
d.setCell(3, 7, "Quantize");
d.setPropertyColor(7, 2, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyValue(7, 1, 0);
final IMasterTrack master = this.model.getMasterTrack();
d.setCell(0, 0, StringUtils.fixASCII("Mstr Vol")).setCell(1, 0, master.getVolumeStr(9));
d.setPropertyColor(0, 0, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyColor(0, 1, SLMkIIIColorManager.SLMKIII_BROWN);
d.setCell(0, 1, StringUtils.fixASCII("Mstr Pan")).setCell(1, 1, master.getPanStr(9));
d.setPropertyColor(1, 0, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyColor(1, 1, SLMkIIIColorManager.SLMKIII_BROWN);
d.setCell(0, 4, StringUtils.fixASCII("Tempo")).setCell(1, 4, transport.formatTempo(transport.getTempo()));
d.setPropertyColor(4, 0, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyColor(4, 1, SLMkIIIColorManager.SLMKIII_BROWN);
d.setCell(0, 5, StringUtils.fixASCII("Metronome")).setCell(1, 5, transport.getMetronomeVolumeStr());
d.setPropertyColor(5, 0, SLMkIIIColorManager.SLMKIII_BROWN);
d.setPropertyColor(5, 1, SLMkIIIColorManager.SLMKIII_BROWN);
d.setCell(0, 8, "Master");
this.setButtonInfo(d);
d.allDone();
}
use of de.mossgrabers.framework.daw.ITransport in project DrivenByMoss by git-moss.
the class OptionsMode method getKnobValue.
/**
* {@inheritDoc}
*/
@Override
public int getKnobValue(final int index) {
final ITransport transport = this.model.getTransport();
final IMasterTrack master = this.model.getMasterTrack();
switch(index) {
case 0:
return master.getVolume();
case 1:
return master.getPan();
case 4:
return (int) transport.scaleTempo(transport.getTempo(), this.model.getValueChanger().getUpperBound());
case 5:
return transport.getMetronomeVolume();
default:
return 0;
}
}
use of de.mossgrabers.framework.daw.ITransport in project DrivenByMoss by git-moss.
the class ControlView method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final ICursorDevice cd = this.model.getCursorDevice();
final ITransport transport = this.model.getTransport();
final int clipLength = this.surface.getConfiguration().getNewClipLength();
final Modes mode = this.surface.getModeManager().getActiveID();
final boolean isFunctions = Modes.FUNCTIONS.equals(mode);
final boolean isViewSelectMode = Modes.VIEW_SELECT.equals(mode);
switch(buttonID) {
case ROW1_1:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_2:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 1 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_3:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 2 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_4:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 3 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_5:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 4 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_6:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return isFunctions && this.model.getCursorDevice().isWindowOpen() || !isFunctions && clipLength == 5 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_7:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return isFunctions && transport.isMetronomeOn() || !isFunctions && clipLength == 6 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW1_8:
if (isViewSelectMode)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
return !isFunctions && clipLength == 7 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
// Fall through
break;
}
// Button row 2: Track toggles / Browse
if (Modes.BROWSER.equals(mode)) {
final int selMode = ((DevicePresetsMode) this.surface.getModeManager().get(Modes.BROWSER)).getSelectionMode();
switch(buttonID) {
case ROW2_1:
case ROW2_2:
case ROW2_8:
return SLControlSurface.MKII_BUTTON_STATE_ON;
case ROW2_3:
case ROW2_4:
case ROW2_5:
case ROW2_6:
case ROW2_7:
return selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
// Fall through
break;
}
} else {
final boolean isNoOverlayMode = !Modes.FRAME.equals(mode) && !Modes.BROWSER.equals(mode);
final Optional<ITrack> track = tb.getSelectedItem();
switch(buttonID) {
case ROW2_1:
return isNoOverlayMode && track.isPresent() && track.get().isMute() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_2:
return isNoOverlayMode && track.isPresent() && track.get().isSolo() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_3:
return isNoOverlayMode && track.isPresent() && track.get().isRecArm() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_4:
return transport.isWritingArrangerAutomation() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_5:
return SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_6:
return this.model.getCursorDevice().isEnabled() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_7:
return isNoOverlayMode && cd.canSelectPreviousFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW2_8:
return isNoOverlayMode && cd.canSelectNextFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
// Fall through
break;
}
}
// Button row 3: Selected track indication
final int buttonIDOrdinal = buttonID.ordinal();
if (buttonIDOrdinal >= ButtonID.ROW3_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW3_8.ordinal()) {
final int index = buttonIDOrdinal - ButtonID.ROW3_1.ordinal();
return tb.getItem(index).isSelected() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
}
final boolean isTrack = Modes.TRACK.equals(mode);
final boolean isTrackToggles = Modes.TRACK_DETAILS.equals(mode);
final boolean isVolume = Modes.VOLUME.equals(mode);
final boolean isFixed = Modes.FIXED.equals(mode);
final boolean isFrame = Modes.FRAME.equals(mode);
final boolean isPreset = Modes.BROWSER.equals(mode);
final boolean isDevice = Modes.DEVICE_PARAMS.equals(mode);
// Transport buttons
switch(buttonID) {
case ROW4_3:
return !transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_4:
return transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_5:
return transport.isLoop() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW4_6:
return transport.isRecording() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_1:
return isFunctions || isFixed ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_2:
return isDevice ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_3:
return isTrackToggles || isFrame || isPreset ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_4:
return isTrack ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_6:
return isVolume ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
case ROW_SELECT_7:
return SLControlSurface.MKII_BUTTON_STATE_OFF;
default:
return 0;
}
}
use of de.mossgrabers.framework.daw.ITransport in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method registerTriggerCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerTriggerCommands() {
final MaschineControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
final ViewManager viewManager = surface.getViewManager();
final ITransport t = this.model.getTransport();
this.addButton(ButtonID.SHIFT, "SHIFT", new ToggleShiftViewCommand<>(this.model, surface), this.maschine == Maschine.STUDIO ? MaschineControlSurface.NAVIGATE_BACK : -1, () -> viewManager.isActive(Views.SHIFT) || surface.isShiftPressed());
// Transport
this.addButton(ButtonID.PLAY, "PLAY", new PlayCommand<>(this.model, surface), MaschineControlSurface.PLAY, t::isPlaying);
final ConfiguredRecordCommand<MaschineControlSurface, MaschineConfiguration> recordCommand = new ConfiguredRecordCommand<>(this.model, surface);
this.addButton(ButtonID.RECORD, "RECORD", recordCommand, MaschineControlSurface.REC, recordCommand::isLit);
this.addButton(ButtonID.STOP, "STOP", new MaschineStopCommand(this.model, surface), MaschineControlSurface.STOP, () -> !t.isPlaying());
this.addButton(ButtonID.LOOP, "LOOP", new ToggleLoopCommand<>(this.model, surface), MaschineControlSurface.RESTART, t::isLoop);
this.addButton(ButtonID.DELETE, "ERASE", NopCommand.INSTANCE, MaschineControlSurface.ERASE);
final MetronomeCommand<MaschineControlSurface, MaschineConfiguration> metroCommand = new MetronomeCommand<>(this.model, surface, false);
final TapTempoCommand<MaschineControlSurface, MaschineConfiguration> tapTempoCommand = new TapTempoCommand<>(this.model, surface);
this.addButton(ButtonID.TAP_TEMPO, "TAP/METRO", (event, velocity) -> {
if (event != ButtonEvent.UP)
return;
if (surface.isShiftPressed()) {
surface.setStopConsumed();
metroCommand.executeNormal(event);
} else
tapTempoCommand.execute(ButtonEvent.DOWN, velocity);
}, MaschineControlSurface.TAP_METRO, t::isMetronomeOn);
this.addButton(ButtonID.FLIP, this.maschine == Maschine.STUDIO || this.maschine == Maschine.MK2 ? "GRID" : "FOLLOW", (event, velocity) -> {
if (event != ButtonEvent.UP)
return;
if (viewManager.isActive(Views.DRUM, Views.PLAY))
((DrumView) viewManager.get(Views.DRUM)).toggleGridEditor();
}, MaschineControlSurface.FOLLOW, () -> viewManager.isActive(Views.DRUM, Views.PLAY) && ((DrumView) viewManager.get(Views.DRUM)).isGridEditor());
this.addButton(ButtonID.NEW, this.maschine.hasCursorKeys() ? "MACRO" : "GROUP", new NewCommand<>(this.model, surface), MaschineControlSurface.GROUP);
final AutomationCommand<MaschineControlSurface, MaschineConfiguration> automationCommand = new AutomationCommand<>(this.model, surface) {
@Override
protected void cleanupShift() {
this.surface.setStopConsumed();
}
};
this.addButton(ButtonID.AUTOMATION, "AUTO", automationCommand, MaschineControlSurface.AUTO, automationCommand::isLit);
this.addButton(ButtonID.OVERDUB, this.maschine == Maschine.STUDIO || this.maschine == Maschine.MK2 ? "ENTER" : "LOCK", new OverdubCommand<>(this.model, surface) {
@Override
protected void shiftedFunction() {
this.surface.setStopConsumed();
super.shiftedFunction();
}
}, MaschineControlSurface.LOCK, () -> surface.isShiftPressed() ? t.isLauncherOverdub() : t.isArrangerOverdub());
this.addButton(ButtonID.REPEAT, "NOTE REPEAT", new FillModeNoteRepeatCommand<>(this.model, surface, this.maschine.hasMCUDisplay()), MaschineControlSurface.NOTE_REPEAT, this.configuration::isNoteRepeatActive);
// Ribbon
this.addButton(ButtonID.F1, "PITCH", new RibbonCommand(this.model, surface, RIBBON_MODES_PITCH), MaschineControlSurface.PITCH, () -> this.isRibbonMode(new HashSet<>(RIBBON_MODES_PITCH)));
this.addButton(ButtonID.F2, "MOD", new RibbonCommand(this.model, surface, RIBBON_MODES_CC), MaschineControlSurface.MOD, () -> this.isRibbonMode(new HashSet<>(RIBBON_MODES_CC)));
this.addButton(ButtonID.F3, "PERFORM", new RibbonCommand(this.model, surface, RIBBON_MODES_MASTER_VOLUME), MaschineControlSurface.PERFORM, () -> this.isRibbonMode(new HashSet<>(RIBBON_MODES_MASTER_VOLUME)));
this.addButton(ButtonID.F4, "NOTES", new RibbonCommand(this.model, surface, RIBBON_MODES_NOTE_REPEAT), MaschineControlSurface.NOTES, () -> this.isRibbonMode(new HashSet<>(RIBBON_MODES_NOTE_REPEAT)));
this.addButton(ButtonID.FADER_TOUCH_1, "ENCODER PRESS", (event, velocity) -> {
if (event != ButtonEvent.DOWN)
return;
if (modeManager.getActiveID() == Modes.BROWSER) {
this.model.getBrowser().stopBrowsing(true);
modeManager.restore();
} else {
final boolean isSlow = !surface.isKnobSensitivitySlow();
surface.setKnobSensitivityIsSlow(isSlow);
surface.getDisplay().notify("Value change speed: " + (isSlow ? "Slow" : "Fast"));
}
}, MaschineControlSurface.ENCODER_PUSH);
// Encoder Modes
this.addButton(ButtonID.VOLUME, "VOLUME", new VolumePanSendCommand(this.model, surface), MaschineControlSurface.VOLUME, () -> Modes.isTrackMode(modeManager.getActiveID()));
this.addButton(ButtonID.SWING, "SWING", new SwingCommand(this.model, surface), MaschineControlSurface.SWING, () -> modeManager.isActive(Modes.POSITION, Modes.LOOP_START, Modes.LOOP_LENGTH));
this.addButton(ButtonID.TEMPO_TOUCH, "TEMPO", new TempoCommand(this.model, surface), MaschineControlSurface.TEMPO, () -> modeManager.isActive(Modes.TEMPO));
this.addButton(ButtonID.DEVICE, "PLUG-IN", (event, velocity) -> {
if (this.maschine.hasMCUDisplay() || surface.isShiftPressed())
new PanelLayoutCommand<>(this.model, surface).executeNormal(event);
else
new ModeSelectCommand<>(this.model, surface, Modes.DEVICE_PARAMS).execute(event, velocity);
}, MaschineControlSurface.PLUGIN, () -> this.maschine.hasMCUDisplay() || surface.isShiftPressed() ? this.model.getCursorDevice().isWindowOpen() : modeManager.isActive(Modes.DEVICE_PARAMS));
this.addButton(ButtonID.DEVICE_ON_OFF, "SAMPLING", new ConvertCommand<>(this.model, surface) {
@Override
protected void sliceToSampler() {
this.surface.setStopConsumed();
super.sliceToSampler();
}
}, MaschineControlSurface.SAMPLING);
// Browser
final String fileLabel;
if (this.maschine.hasCursorKeys()) {
if (this.maschine == Maschine.STUDIO || this.maschine == Maschine.MK2)
fileLabel = "ALL/SAVE";
else
fileLabel = "FILE";
} else
fileLabel = "PROJECT";
this.addButton(ButtonID.ADD_TRACK, fileLabel, new ProjectButtonCommand(this.model, surface), MaschineControlSurface.PROJECT);
this.addButton(ButtonID.ADD_EFFECT, this.maschine.hasCursorKeys() ? "SETTINGS" : "FAVORITES", new AddDeviceCommand(this.model, surface), MaschineControlSurface.FAVORITES);
this.addButton(ButtonID.BROWSE, this.maschine == Maschine.STUDIO || this.maschine == Maschine.MK2 ? "BROWSE" : "BROWSER", new BrowserCommand<>(this.model, surface, ButtonID.SHIFT, ButtonID.SELECT) {
/**
* {@inheritDoc}
*/
@Override
protected boolean getCommit() {
// Discard browser, confirmation is via encoder
return false;
}
}, MaschineControlSurface.BROWSER, this.model.getBrowser()::isActive);
// Pad modes
this.addButton(ButtonID.ACCENT, "ACCENT", new ToggleFixedVelCommand(this.model, surface), MaschineControlSurface.FIXED_VEL, this.configuration::isAccentActive);
this.addButton(ButtonID.SCENE1, "SCENE", new ViewMultiSelectCommand<>(this.model, surface, true, Views.SCENE_PLAY), MaschineControlSurface.SCENE, () -> viewManager.isActive(Views.SCENE_PLAY));
this.addButton(ButtonID.CLIP, "PATTERN", new ViewMultiSelectCommand<>(this.model, surface, true, Views.CLIP), MaschineControlSurface.PATTERN, () -> viewManager.isActive(Views.CLIP));
this.addButton(ButtonID.NOTE, "EVENTS", new ModeSelectCommand<>(this.model, surface, Modes.NOTE, true), MaschineControlSurface.EVENTS, () -> modeManager.isActive(Modes.NOTE));
this.addButton(ButtonID.TOGGLE_DEVICE, this.maschine == Maschine.STUDIO || this.maschine == Maschine.MK2 ? "NAVIGATE" : "VARIATION", new ViewMultiSelectCommand<>(this.model, surface, true, Views.DEVICE), MaschineControlSurface.VARIATION, () -> viewManager.isActive(Views.DEVICE));
this.addButton(ButtonID.DUPLICATE, "DUPLICATE", NopCommand.INSTANCE, MaschineControlSurface.DUPLICATE);
if (this.maschine.hasGroupButtons()) {
this.addButton(ButtonID.SELECT, "SELECT", new MaschineSelectButtonCommand(this.model, surface), MaschineControlSurface.SELECT);
this.addButton(ButtonID.SOLO, "SOLO", (event, velocity) -> {
if (event == ButtonEvent.UP && surface.isShiftPressed()) {
surface.setStopConsumed();
this.model.getProject().clearSolo();
}
}, MaschineControlSurface.SOLO);
this.addButton(ButtonID.MUTE, "MUTE", (event, velocity) -> {
if (event == ButtonEvent.UP && surface.isShiftPressed()) {
surface.setStopConsumed();
this.model.getProject().clearMute();
}
}, MaschineControlSurface.MUTE);
} else {
this.addButton(ButtonID.SELECT, "SELECT", new ViewMultiSelectCommand<>(this.model, surface, true, Views.TRACK_SELECT), MaschineControlSurface.SELECT, () -> viewManager.isActive(Views.TRACK_SELECT));
this.addButton(ButtonID.SOLO, "SOLO", new ViewMultiSelectCommand<>(this.model, surface, true, Views.TRACK_SOLO), MaschineControlSurface.SOLO, () -> viewManager.isActive(Views.TRACK_SOLO));
this.addButton(ButtonID.MUTE, "MUTE", new ViewMultiSelectCommand<>(this.model, surface, true, Views.TRACK_MUTE), MaschineControlSurface.MUTE, () -> viewManager.isActive(Views.TRACK_MUTE));
}
final KeyboardCommand keyboardCommand = new KeyboardCommand(this.model, surface);
this.addButton(ButtonID.ROW1_1, "PAD MODE", new PadModeCommand(keyboardCommand, this.model, surface), MaschineControlSurface.PAD_MODE, () -> viewManager.isActive(Views.DRUM));
this.addButton(ButtonID.ROW1_2, "KEYBOARD", keyboardCommand, MaschineControlSurface.KEYBOARD, () -> viewManager.isActive(Views.PLAY));
this.addButton(ButtonID.ROW1_3, "CHORDS", (event, velocity) -> {
if (velocity == 0)
((PlayView) viewManager.get(Views.PLAY)).toggleChordMode();
}, MaschineControlSurface.CHORDS, ((PlayView) viewManager.get(Views.PLAY))::isChordMode);
final DrumView drumView = (DrumView) viewManager.get(Views.DRUM);
this.addButton(ButtonID.ROW1_4, "STEP", (event, velocity) -> {
if (event == ButtonEvent.UP)
drumView.toggleSequencerVisible();
}, MaschineControlSurface.STEP, drumView::isSequencerVisible);
this.registerCursorKeys(surface);
this.registerDisplayButtons(surface, modeManager);
this.registerGroupButtons(surface);
if (this.maschine == Maschine.STUDIO)
this.registerMaschineStudioButtons(surface);
// Register foot switches
final int footswitches = this.maschine.getFootswitches();
if (footswitches >= 2) {
this.addButton(ButtonID.FOOTSWITCH1, "Foot Controller (Tip)", new FootswitchCommand<>(this.model, surface, 0), MaschineControlSurface.FOOTSWITCH1_TIP);
this.addButton(ButtonID.FOOTSWITCH2, "Foot Controller (Ring)", new FootswitchCommand<>(this.model, surface, 1), MaschineControlSurface.FOOTSWITCH1_RING);
if (footswitches == 4) {
this.addButton(ButtonID.FOOTSWITCH3, "Foot Controller 2 (Tip)", new FootswitchCommand<>(this.model, surface, 2), MaschineControlSurface.FOOTSWITCH2_TIP);
this.addButton(ButtonID.FOOTSWITCH4, "Foot Controller 2 (Ring)", new FootswitchCommand<>(this.model, surface, 3), MaschineControlSurface.FOOTSWITCH2_RING);
}
}
}
use of de.mossgrabers.framework.daw.ITransport 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