use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class DeviceConfigView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (!cursorDevice.doesExist()) {
for (int i = 0; i < 16; i++) padGrid.light(36 + i, LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_BLACK);
}
final IParameterPageBank parameterPageBank = cursorDevice.getParameterPageBank();
final int sel = parameterPageBank.getSelectedItemIndex();
final int lastPage = Math.min(16, parameterPageBank.getItemCount());
for (int i = 0; i < lastPage; i++) padGrid.lightEx(i % 8, i / 8, i == sel ? LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_MAGENTA_HI : LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_MAGENTA_LO);
for (int i = lastPage; i < 16; i++) padGrid.lightEx(i % 8, i / 8, LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_GREY_LO);
}
use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1(final ITextDisplay display) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!this.checkExists1(display, cd))
return;
// Row 1 & 2
final IParameterBank parameterBank = cd.getParameterBank();
for (int i = 0; i < 8; i++) {
final IParameter param = parameterBank.getItem(i);
display.setCell(0, i, param.doesExist() ? StringUtils.fixASCII(param.getName()) : "").setCell(1, i, StringUtils.fixASCII(param.getDisplayedValue(8)));
}
// Row 3
display.setBlock(2, 0, "Selected Device:").setBlock(2, 1, cd.getName());
// Row 4
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()) {
if (i == cd.getIndex())
sb.append(Push1Display.SELECT_ARROW);
sb.append(device.getName());
}
display.setCell(3, i, sb.toString());
}
return;
}
final IParameterPageBank bank = cd.getParameterPageBank();
final int selectedItemIndex = bank.getSelectedItemIndex();
for (int i = 0; i < bank.getPageSize(); i++) {
final String item = bank.getItem(i);
final String selectedStr = i == selectedItemIndex ? Push1Display.SELECT_ARROW : "";
display.setCell(3, i, item.isEmpty() ? "" : selectedStr + item);
}
}
use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class ParametersMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final SLMkIIIDisplay d = this.surface.getDisplay();
d.clear();
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist()) {
d.setBlock(1, 1, " Please select or").setBlock(1, 2, "add a device.");
d.setCell(0, 8, "No device");
d.hideAllElements();
// Row 4
this.drawRow4(d, cd, null);
} else {
final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
final Optional<String> selectedPage = parameterPageBank.getSelectedItem();
d.setCell(0, 8, cd.getName(9)).setCell(1, 8, selectedPage.isPresent() ? selectedPage.get() : "");
// Row 1 & 2
for (int i = 0; i < 8; i++) {
final IParameterBank parameterBank = cd.getParameterBank();
final IParameter param = parameterBank.getItem(i);
d.setCell(0, i, param.doesExist() ? StringUtils.fixASCII(param.getName(9)) : "").setCell(1, i, param.getDisplayedValue(9));
final int color = param.doesExist() ? SLMkIIIColorManager.SLMKIII_PURPLE : SLMkIIIColorManager.SLMKIII_BLACK;
d.setPropertyColor(i, 0, color);
d.setPropertyColor(i, 1, color);
}
// Row 4
this.drawRow4(d, cd, parameterPageBank);
}
this.setButtonInfo(d);
d.allDone();
}
use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class ParametersMode method onButton.
/**
* {@inheritDoc}
*/
@Override
public void onButton(final int row, final int index, final ButtonEvent event) {
if (event != ButtonEvent.UP)
return;
// Combination with Shift
if (this.surface.isShiftPressed()) {
this.onButtonShifted(index);
return;
}
// Combination with Arrow Up
if (this.surface.isLongPressed(ButtonID.ARROW_UP)) {
this.onButtonArrowUp(index);
return;
}
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist())
return;
// Normal behavior - parameters
if (!this.showDevices) {
final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
if (parameterPageBank.getSelectedItemIndex() == index)
this.setShowDevices(!this.isShowDevices());
else
parameterPageBank.selectPage(index);
return;
}
// Combination with Duplicate
if (this.surface.isPressed(ButtonID.DUPLICATE)) {
this.surface.setTriggerConsumed(ButtonID.DUPLICATE);
cd.duplicate();
return;
}
// Combination with Delete
if (this.surface.isPressed(ButtonID.DELETE)) {
this.surface.setTriggerConsumed(ButtonID.DELETE);
cd.getDeviceBank().getItem(index).remove();
return;
}
// Normal behavior - devices
if (cd.getIndex() == index)
this.setShowDevices(!this.isShowDevices());
else
cd.getDeviceBank().getItem(index).select();
}
use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class ParamsMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final IValueChanger valueChanger = this.model.getValueChanger();
final IParameterPageBank parameterPageBank = this.cursorDevice.getParameterPageBank();
final Optional<String> selectedItem = parameterPageBank.getSelectedItem();
final String selectedPage = selectedItem.isPresent() ? StringUtils.optimizeName(selectedItem.get(), 8) : "";
final int[] vuData = new int[16];
for (int i = 0; i < 8; i++) {
final IParameter parameter = this.bank.getItem(i);
// Track Available
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_AVAILABLE, TrackType.GENERIC, i);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_SELECTED, parameter.isSelected() ? 1 : 0, i);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_RECARM, 0, i);
final boolean exists = parameter.doesExist();
final String info = exists ? parameter.getDisplayedValue(8) : " ";
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME_TEXT, 0, i, info);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_PAN_TEXT, 0, i, info);
final String name = exists ? this.cursorDevice.getName(8) + "\n" + selectedPage + "\n" + parameter.getName(16) : "None";
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_NAME, 0, i, name);
final int j = 2 * i;
vuData[j] = valueChanger.toMidiValue(parameter.getModulatedValue());
vuData[j + 1] = valueChanger.toMidiValue(parameter.getModulatedValue());
}
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_VU, 2, 0, vuData);
}
Aggregations