use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceParamsMode method onKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
this.isKnobTouched[index] = isTouched;
final ICursorDevice cd = this.model.getCursorDevice();
final IParameter param = cd.getParameterBank().getItem(index);
if (isTouched && this.surface.isDeletePressed()) {
this.surface.setTriggerConsumed(ButtonID.DELETE);
param.resetValue();
}
param.touchValue(isTouched);
this.checkStopAutomationOnKnobRelease(isTouched);
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceChainsMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1(final ITextDisplay display) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!this.checkExists1(display, cd))
return;
// Row 3
display.setBlock(2, 0, "Device Chains:").setBlock(2, 1, cd.getName());
// Row 4
final String[] slotChains = cd.getSlotChains();
for (int i = 0; i < 8; i++) {
final String bottomMenu = i < slotChains.length ? slotChains[i] : "";
display.setCell(3, i, bottomMenu);
}
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceChainsMode 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.doesExist())
return;
final String[] slotChains = cd.getSlotChains();
if (index >= slotChains.length)
return;
cd.selectSlotChain(slotChains[index]);
this.surface.getModeManager().setActive(Modes.DEVICE_PARAMS);
return;
}
// LONG press - move upwards
this.surface.setTriggerConsumed(ButtonID.get(ButtonID.ROW1_1, index));
this.moveUp();
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerMode method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final ICursorDevice cd = this.model.getCursorDevice();
if (cd == null || !cd.hasLayers())
return super.getButtonColor(buttonID);
// Drum Pad Bank has size of 16, layers only 8
final int offset = this.getDrumPadIndex();
int index = this.isButtonRow(0, buttonID);
if (index >= 0) {
final IChannel dl = this.bank.getItem(offset + buttonID.ordinal() - ButtonID.ROW1_1.ordinal());
if (dl.doesExist() && dl.isActivated()) {
if (dl.isSelected())
return this.isPush2 ? PushColorManager.PUSH2_COLOR_ORANGE_HI : PushColorManager.PUSH1_COLOR_ORANGE_HI;
return this.isPush2 ? PushColorManager.PUSH2_COLOR_YELLOW_LO : PushColorManager.PUSH1_COLOR_YELLOW_LO;
}
return super.getButtonColor(buttonID);
}
index = this.isButtonRow(1, buttonID);
if (index >= 0) {
final boolean muteState = this.configuration.isMuteState();
final IChannel layer = this.bank.getItem(offset + index);
if (this.isPush2) {
if (this.configuration.isMuteLongPressed() || this.configuration.isSoloLongPressed() || this.configuration.isMuteSoloLocked()) {
if (layer.doesExist()) {
if (muteState) {
if (layer.isMute())
return PushColorManager.PUSH2_COLOR2_AMBER_LO;
} else if (layer.isSolo())
return PushColorManager.PUSH2_COLOR2_YELLOW_HI;
}
return PushColorManager.PUSH2_COLOR_BLACK;
}
final ModeManager modeManager = this.surface.getModeManager();
switch(index) {
case 0:
return modeManager.isActive(Modes.DEVICE_LAYER_VOLUME) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
case 1:
return modeManager.isActive(Modes.DEVICE_LAYER_PAN) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
case 4:
case 5:
case 6:
case 7:
return modeManager.isActive(this.getSendMode(index)) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
default:
return PushColorManager.PUSH2_COLOR_BLACK;
}
}
if (!cd.hasLayers())
return index == 7 ? PushColorManager.PUSH1_COLOR2_WHITE : super.getButtonColor(buttonID);
if (layer.doesExist()) {
if (muteState)
return layer.isMute() ? PushColorManager.PUSH1_COLOR_BLACK : PushColorManager.PUSH1_COLOR2_YELLOW_HI;
return layer.isSolo() ? PushColorManager.PUSH1_COLOR2_BLUE_HI : PushColorManager.PUSH1_COLOR2_GREY_LO;
}
}
return super.getButtonColor(buttonID);
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class BaseMode method drawDisplay2.
protected void drawDisplay2() {
if (!this.surface.getConfiguration().hasDisplay2())
return;
final ITrackBank tb = this.getTrackBank();
// Format track names
final ITextDisplay d2 = this.surface.getTextDisplay(1);
final int extenderOffset = this.getExtenderOffset();
final boolean isMainDevice = this.surface.isMainDevice();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(extenderOffset + i);
d2.setCell(0, i, StringUtils.shortenAndFixASCII(t.getName(), isMainDevice ? 6 : 7));
}
if (isMainDevice)
d2.setCell(0, 8, "Maste");
d2.done(0);
d2.clearRow(1);
if (isMainDevice) {
final IMasterTrack masterTrack = this.model.getMasterTrack();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final ITrack selectedTrack;
if (masterTrack.isSelected())
selectedTrack = masterTrack;
else {
final Optional<ITrack> selectedItem = tb.getSelectedItem();
selectedTrack = selectedItem.isPresent() ? selectedItem.get() : EmptyTrack.INSTANCE;
}
d2.setBlock(1, 0, "Sel. track:").setBlock(1, 1, selectedTrack == null ? "None" : StringUtils.shortenAndFixASCII(selectedTrack.getName(), 11));
d2.setBlock(1, 2, "Sel. devce:").setBlock(1, 3, cursorDevice.doesExist() ? StringUtils.shortenAndFixASCII(cursorDevice.getName(), 11) : "None");
}
d2.done(1);
}
Aggregations