use of de.mossgrabers.framework.daw.data.bank.IDeviceBank in project DrivenByMoss by git-moss.
the class DeviceParamsMode method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final ICursorDevice cd = this.model.getCursorDevice();
int index = this.isButtonRow(0, buttonID);
if (index >= 0) {
if (!cd.doesExist())
return super.getButtonColor(buttonID);
final int selectedColor = this.colorManager.getColorIndex(PushColorManager.PUSH_ORANGE_HI);
final int existsColor = this.colorManager.getColorIndex(PushColorManager.PUSH_YELLOW_LO);
final int offColor = this.colorManager.getColorIndex(PushColorManager.PUSH_BLACK);
if (this.showDevices) {
final IDeviceBank bank = cd.getDeviceBank();
if (!bank.getItem(index).doesExist())
return offColor;
return index == cd.getIndex() ? selectedColor : existsColor;
}
final IParameterPageBank bank = cd.getParameterPageBank();
final int selectedItemIndex = bank.getSelectedItemIndex();
if (bank.getItem(index).isEmpty())
return offColor;
return index == selectedItemIndex ? selectedColor : existsColor;
}
index = this.isButtonRow(1, buttonID);
if (index >= 0) {
final int white = this.isPush2 ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH1_COLOR2_WHITE;
if (!cd.doesExist())
return index == 7 ? white : super.getButtonColor(buttonID);
final int green = this.isPush2 ? PushColorManager.PUSH2_COLOR2_GREEN : PushColorManager.PUSH1_COLOR2_GREEN;
final int grey = this.isPush2 ? PushColorManager.PUSH2_COLOR2_GREY_LO : PushColorManager.PUSH1_COLOR2_GREY_LO;
final int orange = this.isPush2 ? PushColorManager.PUSH2_COLOR2_ORANGE : PushColorManager.PUSH1_COLOR2_ORANGE;
final int off = this.isPush2 ? PushColorManager.PUSH2_COLOR_BLACK : PushColorManager.PUSH1_COLOR_BLACK;
final int turquoise = this.isPush2 ? PushColorManager.PUSH2_COLOR2_TURQUOISE_HI : PushColorManager.PUSH1_COLOR2_TURQUOISE_HI;
switch(index) {
case 0:
return cd.isEnabled() ? green : grey;
case 1:
return cd.isParameterPageSectionVisible() ? orange : white;
case 2:
return cd.isExpanded() ? orange : white;
case 3:
return this.surface.getModeManager().isActive(Modes.DEVICE_CHAINS) ? orange : white;
case 4:
return this.showDevices ? white : orange;
case 5:
if (!this.model.getHost().supports(Capability.HAS_PINNING))
return off;
return cd.isPinned() ? turquoise : grey;
case 6:
return cd.isWindowOpen() ? turquoise : grey;
default:
case 7:
return white;
}
}
return super.getButtonColor(buttonID);
}
use of de.mossgrabers.framework.daw.data.bank.IDeviceBank in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2(final IGraphicDisplay display) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!this.checkExists2(display, cd))
return;
final String color = this.model.getCurrentTrackBank().getSelectedChannelColorEntry();
final ColorEx bottomMenuColor = DAWColor.getColorEntry(color);
final IDeviceBank deviceBank = cd.getDeviceBank();
final IParameterBank parameterBank = cd.getParameterBank();
final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
final int selectedPage = parameterPageBank.getSelectedItemIndex();
final boolean hasPinning = this.model.getHost().supports(Capability.HAS_PINNING);
final IValueChanger valueChanger = this.model.getValueChanger();
for (int i = 0; i < parameterBank.getPageSize(); i++) {
final boolean isTopMenuOn = this.getTopMenuEnablement(cd, hasPinning, i);
String bottomMenu;
final String bottomMenuIcon;
boolean isBottomMenuOn;
if (this.showDevices) {
final IDevice item = deviceBank.getItem(i);
bottomMenuIcon = item.getName();
bottomMenu = item.doesExist() ? item.getName(12) : "";
isBottomMenuOn = i == cd.getIndex();
} else {
bottomMenuIcon = cd.getName();
bottomMenu = parameterPageBank.getItem(i);
if (bottomMenu.length() > 12)
bottomMenu = bottomMenu.substring(0, 12);
isBottomMenuOn = i == selectedPage;
}
final IParameter param = parameterBank.getItem(i);
final boolean exists = param.doesExist();
final String parameterName = exists ? param.getName(9) : "";
final int parameterValue = valueChanger.toDisplayValue(exists ? param.getValue() : 0);
final String parameterValueStr = exists ? param.getDisplayedValue(8) : "";
final boolean parameterIsActive = this.isKnobTouched[i];
final int parameterModulatedValue = valueChanger.toDisplayValue(exists ? param.getModulatedValue() : -1);
display.addParameterElement(this.hostMenu[i], isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
}
}
use of de.mossgrabers.framework.daw.data.bank.IDeviceBank in project DrivenByMoss by git-moss.
the class ParamsMode method getKnobValue.
/**
* {@inheritDoc}
*/
@Override
public int getKnobValue(final int index) {
// Note: Since we need multiple value (more than 8), index is the MIDI CC of the knob
final IValueChanger valueChanger = this.model.getValueChanger();
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
final IParameter parameter = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
return valueChanger.toMidiValue(parameter.getValue());
}
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
final IParameter parameter = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
return valueChanger.toMidiValue(parameter.getValue());
}
final int scrollTracksState = (this.bank.canScrollBackwards() ? 1 : 0) + (this.bank.canScrollForwards() ? 2 : 0);
final IDeviceBank deviceBank = this.cursorDevice.getDeviceBank();
final int scrollScenesState = (deviceBank.canScrollBackwards() ? 1 : 0) + (deviceBank.canScrollForwards() ? 2 : 0);
final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
return (this.cursorDevice.canSelectPreviousFX() ? 1 : 0) + (this.cursorDevice.canSelectNextFX() ? 2 : 0);
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
return configuration.isFlipTrackClipNavigation() ? scrollScenesState : scrollTracksState;
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
return configuration.isFlipTrackClipNavigation() ? scrollTracksState : scrollScenesState;
default:
return 0;
}
}
use of de.mossgrabers.framework.daw.data.bank.IDeviceBank in project DrivenByMoss by git-moss.
the class ParametersMode method drawRow4.
private void drawRow4(final SLMkIIIDisplay d, final ICursorDevice cd, final IParameterPageBank parameterPageBank) {
if (this.surface.isShiftPressed()) {
this.drawRow4Shifted(d, cd);
return;
}
if (this.surface.isLongPressed(ButtonID.ARROW_UP)) {
this.drawRow4ArrowUp(d);
return;
}
if (!cd.doesExist()) {
for (int i = 0; i < 8; i++) {
d.setPropertyColor(i, 2, SLMkIIIColorManager.SLMKIII_BLACK);
d.setPropertyValue(i, 1, 0);
}
return;
}
if (this.showDevices) {
final IDeviceBank deviceBank = cd.getDeviceBank();
for (int i = 0; i < 8; i++) {
final IDevice device = deviceBank.getItem(i);
final StringBuilder sb = new StringBuilder();
if (device.doesExist())
sb.append(device.getName(9));
d.setCell(3, i, sb.toString());
d.setPropertyColor(i, 2, device.doesExist() ? SLMkIIIColorManager.SLMKIII_MINT : SLMkIIIColorManager.SLMKIII_BLACK);
d.setPropertyValue(i, 1, device.doesExist() && i == cd.getIndex() ? 1 : 0);
}
} else {
for (int i = 0; i < parameterPageBank.getPageSize(); i++) {
final String item = parameterPageBank.getItem(i);
d.setCell(3, i, item.isEmpty() ? "" : item);
d.setPropertyColor(i, 2, item.isEmpty() ? SLMkIIIColorManager.SLMKIII_BLACK : SLMkIIIColorManager.SLMKIII_PURPLE);
d.setPropertyValue(i, 1, parameterPageBank.getSelectedItemIndex() == i ? 1 : 0);
}
}
}
use of de.mossgrabers.framework.daw.data.bank.IDeviceBank in project DrivenByMoss by git-moss.
the class ParametersMode method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
// Colors in combination with Shift
if (this.surface.isShiftPressed())
return this.getButtonColorShifted(buttonID);
// Colors in combination with Arrow Up
if (this.surface.isLongPressed(ButtonID.ARROW_UP))
return this.getButtonColorArrowUp(buttonID);
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist())
return 0;
// Colors normal behavior
final int index = buttonID.ordinal() - ButtonID.ROW1_1.ordinal();
if (this.showDevices) {
final IDeviceBank bank = cd.getDeviceBank();
final IDevice item = bank.getItem(index);
if (!item.doesExist())
return SLMkIIIColorManager.SLMKIII_BLACK;
return index == cd.getIndex() ? SLMkIIIColorManager.SLMKIII_MINT : SLMkIIIColorManager.SLMKIII_MINT_HALF;
}
final IParameterPageBank bank = cd.getParameterPageBank();
final int selectedItemIndex = bank.getSelectedItemIndex();
if (bank.getItem(index).isEmpty())
return SLMkIIIColorManager.SLMKIII_BLACK;
return index == selectedItemIndex ? SLMkIIIColorManager.SLMKIII_PURPLE : SLMkIIIColorManager.SLMKIII_PURPLE_HALF;
}
Aggregations