use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceParamsMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event == ButtonEvent.DOWN)
return;
if (event == ButtonEvent.UP) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.hasSelectedDevice())
return;
if (!this.showDevices) {
cd.setSelectedParameterPageInBank(index);
return;
}
if (cd.getPositionInBank() != index) {
cd.selectSibling(index);
return;
}
final ModeManager modeManager = this.surface.getModeManager();
if (!cd.hasLayers()) {
((DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS)).setShowDevices(false);
return;
}
final IChannel layer = cd.getSelectedLayerOrDrumPad();
if (layer == null)
cd.selectLayerOrDrumPad(0);
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
return;
}
// LONG press - move upwards
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_ROW1_1 + index);
this.moveUp();
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class TrackTogglesMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITrack t = this.model.getCurrentTrackBank().getSelectedTrack();
final Display d = this.surface.getDisplay();
if (t == null) {
d.setRow(0, " Please select a track... ").clearRow(2).done(2);
} else {
final ICursorDevice device = this.model.getCursorDevice();
d.setCell(0, 0, " Mute");
d.setCell(2, 0, t.isMute() ? " On" : " Off");
d.setCell(0, 1, " Solo");
d.setCell(2, 1, t.isSolo() ? " On" : " Off");
d.setCell(0, 2, "Rec Arm");
d.setCell(2, 2, t.isRecArm() ? " On" : " Off");
d.setCell(0, 3, " Write");
d.setCell(2, 3, this.model.getTransport().isWritingArrangerAutomation() ? " On" : " Off");
d.setCell(0, 4, " Browse");
d.setCell(2, 4, "");
d.setCell(0, 5, device.getName().length() > 0 ? device.getName().length() > 8 ? device.getName().substring(0, 8) : device.getName() : "None");
d.setCell(2, 5, device.isEnabled() ? "Enabled" : "Disabled");
d.setCell(0, 6, "<<Device").setCell(2, 6, "");
d.setCell(0, 7, "Device>>").setCell(2, 7, "").done(0).done(2);
}
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class ControlView method updateButtons.
/**
* {@inheritDoc}
*/
@Override
public void updateButtons() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ICursorDevice cd = this.model.getCursorDevice();
final ITransport transport = this.model.getTransport();
final int clipLength = this.surface.getConfiguration().getNewClipLength();
final Integer mode = this.surface.getModeManager().getActiveModeId();
final boolean isTrack = mode == Modes.MODE_TRACK;
final boolean isTrackToggles = mode == Modes.MODE_TRACK_TOGGLES;
final boolean isVolume = mode == Modes.MODE_VOLUME;
final boolean isMaster = mode == Modes.MODE_MASTER;
final boolean isFixed = mode == Modes.MODE_FIXED;
final boolean isFrame = mode == Modes.MODE_FRAME;
final boolean isPreset = mode == Modes.MODE_BROWSER;
final boolean isDevice = mode == Modes.MODE_PARAMS;
final boolean isFunctions = mode == Modes.MODE_FUNCTIONS;
if (mode == Modes.MODE_VIEW_SELECT) {
for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
} else {
// Button row 1: Clip length or functions
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_1, !isFunctions && clipLength == 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_2, !isFunctions && clipLength == 1 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_3, !isFunctions && clipLength == 2 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_4, !isFunctions && clipLength == 3 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_5, !isFunctions && clipLength == 4 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_6, isFunctions && this.model.getCursorDevice().isWindowOpen() || !isFunctions && clipLength == 5 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_7, isFunctions && transport.isMetronomeOn() || !isFunctions && clipLength == 6 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW1_8, !isFunctions && clipLength == 7 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
}
// Button row 2: Track toggles / Browse
if (mode == Modes.MODE_BROWSER) {
final int selMode = ((DevicePresetsMode) this.surface.getModeManager().getMode(Modes.MODE_BROWSER)).getSelectionMode();
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_1, SLControlSurface.MKII_BUTTON_STATE_ON);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_2, SLControlSurface.MKII_BUTTON_STATE_ON);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_3, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_4, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_5, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_6, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_7, selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_8, SLControlSurface.MKII_BUTTON_STATE_ON);
} else {
final boolean isNoOverlayMode = mode != Modes.MODE_FRAME && mode != Modes.MODE_BROWSER;
final ITrack track = tb.getSelectedTrack();
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_1, isNoOverlayMode && track != null && track.isMute() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_2, isNoOverlayMode && track != null && track.isSolo() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_3, isNoOverlayMode && track != null && track.isRecArm() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_4, transport.isWritingArrangerAutomation() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_5, SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_6, this.model.getCursorDevice().isEnabled() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_7, isNoOverlayMode && cd.canSelectPreviousFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW2_8, isNoOverlayMode && cd.canSelectNextFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
}
// Button row 3: Selected track indication
for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + i, tb.getTrack(i).isSelected() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
// LED indications for device parameters
((DeviceParamsMode) this.surface.getModeManager().getMode(Modes.MODE_PARAMS)).setLEDs();
// Transport buttons
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_3, !transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_4, transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_5, transport.isLoop() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_6, transport.isRecording() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL1, isFunctions || isFixed ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL2, isDevice ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL3, isTrackToggles || isFrame || isPreset ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL4, isTrack || isMaster ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL6, isVolume ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF);
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROWSEL7, SLControlSurface.MKII_BUTTON_STATE_OFF);
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class PlayView method drawDrumGrid.
/**
* 'Draw' the drum grid sequencer.
*/
public void drawDrumGrid() {
if (!this.model.canSelectedTrackHoldNotes()) {
for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
return;
}
if (this.isPlayMode) {
final ICursorDevice primary = this.model.getPrimaryDevice();
final boolean hasDrumPads = primary.hasDrumPads();
boolean isSoloed = false;
if (hasDrumPads) {
for (int i = 0; i < 16; i++) {
if (primary.getDrumPad(i).isSolo()) {
isSoloed = true;
break;
}
}
}
for (int y = 0; y < 2; y++) {
for (int x = 0; x < 8; x++) {
final int index = 8 * y + x;
final int color = this.getPadColor(index, primary, isSoloed);
if (y == 0)
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + x, color);
else
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + x, color);
}
}
} else {
final ICursorClip clip = this.getClip();
// Paint the sequencer steps
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % PlayView.NUM_DISPLAY_COLS : -1;
for (int col = 0; col < PlayView.NUM_DISPLAY_COLS; col++) {
final int isSet = clip.getStep(col, this.offsetY + this.selectedPad);
final boolean hilite = col == hiStep;
final int x = col % 8;
final double y = col / 8.0;
final int color = isSet > 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : hilite ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
if (y == 0)
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + x, color);
else
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + x, color);
}
}
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class SLControllerSetup method updateIndication.
private void updateIndication() {
final SLControlSurface surface = this.getSurface();
final Integer mode = surface.getModeManager().getActiveModeId();
final IMasterTrack mt = this.model.getMasterTrack();
mt.setVolumeIndication(Modes.MODE_MASTER.equals(mode));
mt.setPanIndication(Modes.MODE_MASTER.equals(mode));
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final boolean isEffect = this.model.isEffectTrackBankActive();
final boolean isVolume = Modes.MODE_VOLUME.equals(mode);
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final ITrack selectedTrack = tb.getSelectedTrack();
for (int i = 0; i < 8; i++) {
final boolean hasTrackSel = selectedTrack != null && selectedTrack.getIndex() == i && Modes.MODE_TRACK.equals(mode);
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect && (isVolume || hasTrackSel));
track.setPanIndication(!isEffect && hasTrackSel);
for (int j = 0; j < 6; j++) track.getSend(j).setIndication(!isEffect && hasTrackSel);
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect);
fxTrack.setPanIndication(isEffect);
cursorDevice.indicateParameter(i, true);
}
}
Aggregations