use of de.mossgrabers.push.controller.PushDisplay in project DrivenByMoss by git-moss.
the class ScalesMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final Scale scale = this.scales.getScale();
final int offset = this.scales.getScaleOffset();
final Scale[] scaleValues = Scale.values();
final String rangeText = this.scales.getRangeText();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
final String[] items = new String[6];
final boolean[] selected = new boolean[6];
for (int i = 0; i < 6; i++) {
final int pos = scale.ordinal() + i;
items[i] = pos < scaleValues.length ? scaleValues[pos].getName() : "";
selected[i] = i == 0;
}
message.addListElement(items, selected);
for (int i = 0; i < 6; i++) message.addOptionElement(i == 3 ? "Note range: " + rangeText : "", Scales.BASES[6 + i], offset == 6 + i, "", Scales.BASES[i], offset == i, false);
message.addOptionElement("", this.scales.isChromatic() ? "Chromatc" : "In Key", this.scales.isChromatic(), "", "", false, false);
display.send(message);
}
use of de.mossgrabers.push.controller.PushDisplay in project DrivenByMoss by git-moss.
the class SessionViewSelectMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final ViewManager viewManager = this.surface.getViewManager();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
for (int i = 0; i < VIEWS.length; i++) {
final boolean isMenuBottomSelected = VIEWS[i] != null && this.isSelected(viewManager, i);
message.addOptionElement("", "", false, i == 0 ? "Session view" : "", VIEW_NAMES[i], isMenuBottomSelected, false);
}
display.send(message);
}
use of de.mossgrabers.push.controller.PushDisplay in project DrivenByMoss by git-moss.
the class SetupMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final PushConfiguration config = this.surface.getConfiguration();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
message.addOptionElement("", "Setup", true, "", "", false, true);
message.addOptionElement("Brightness", "Info", false, "", "", false, true);
message.addParameterElement("Display", config.getDisplayBrightness() * 1023 / 100, config.getDisplayBrightness() + "%", this.isKnobTouched[2], -1);
message.addParameterElement("LEDs", config.getLedBrightness() * 1023 / 100, config.getLedBrightness() + "%", this.isKnobTouched[3], -1);
message.addOptionElement(" Pads", "", false, "", "", false, false);
message.addParameterElement("Sensitivity", config.getPadSensitivity() * 1023 / 10, Integer.toString(config.getPadSensitivity()), this.isKnobTouched[5], -1);
message.addParameterElement("Gain", config.getPadGain() * 1023 / 10, Integer.toString(config.getPadGain()), this.isKnobTouched[6], -1);
message.addParameterElement("Dynamics", config.getPadDynamics() * 1023 / 10, Integer.toString(config.getPadDynamics()), this.isKnobTouched[7], -1);
display.send(message);
}
use of de.mossgrabers.push.controller.PushDisplay in project DrivenByMoss by git-moss.
the class DeviceBrowserMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final IBrowser browser = this.model.getBrowser();
if (!browser.isActive()) {
this.surface.getModeManager().restoreMode();
return;
}
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
switch(this.selectionMode) {
case DeviceBrowserMode.SELECTION_OFF:
String selectedResult = browser.getSelectedResult();
if (selectedResult == null || selectedResult.length() == 0)
selectedResult = "None";
final boolean isPresetSession = browser.isPresetContentType();
final String deviceName = this.model.getCursorDevice().getName();
for (int i = 0; i < 7; i++) {
final IBrowserColumn column = this.getFilterColumn(i);
final String headerTopName = i == 0 ? "Device: " + (deviceName.isEmpty() ? "None" : deviceName) : "";
final String headerBottomName = i == 0 && isPresetSession ? "Preset: " + selectedResult : "";
final String menuBottomName = getColumnName(column);
message.addOptionElement(headerTopName, column == null ? "" : column.getName(), i == this.filterColumn, headerBottomName, menuBottomName, !menuBottomName.equals(" "), false);
}
message.addOptionElement("", browser.getSelectedContentType(), this.filterColumn == -1, "", "", false, false);
break;
case DeviceBrowserMode.SELECTION_PRESET:
final IBrowserColumnItem[] results = browser.getResultColumnItems();
if (!results[0].doesExist()) {
for (int i = 0; i < 8; i++) message.addOptionElement(i == 3 ? "No results available..." : "", "", false, "", "", false, false);
display.send(message);
return;
}
for (int i = 0; i < 8; i++) {
final String[] items = new String[6];
final boolean[] selected = new boolean[6];
for (int item = 0; item < 6; item++) {
final int pos = i * 6 + item;
items[item] = pos < results.length ? results[pos].getName(16) : "";
selected[item] = pos < results.length ? results[pos].isSelected() : false;
}
message.addListElement(items, selected);
}
break;
case DeviceBrowserMode.SELECTION_FILTER:
final IBrowserColumnItem[] item = browser.getFilterColumn(this.filterColumn).getItems();
for (int i = 0; i < 8; i++) {
final String[] items = new String[6];
final boolean[] selected = new boolean[6];
for (int itemIndex = 0; itemIndex < 6; itemIndex++) {
final int pos = i * 6 + itemIndex;
String text = StringUtils.optimizeName(item[pos].getName(), 10);
if (!text.isEmpty())
text = text + " (" + item[pos].getHitCount() + ")";
items[itemIndex] = text;
selected[itemIndex] = item[pos].isSelected();
}
message.addListElement(items, selected);
}
break;
}
display.send(message);
}
use of de.mossgrabers.push.controller.PushDisplay in project DrivenByMoss by git-moss.
the class DeviceLayerMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final ICursorDevice cd = this.model.getCursorDevice();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
if (!cd.hasSelectedDevice()) {
for (int i = 0; i < 8; i++) message.addOptionElement(i == 2 ? "Please select a device or press 'Add Device'..." : "", i == 7 ? "Up" : "", true, "", "", false, true);
display.send(message);
return;
}
final boolean noLayers = cd.hasLayers() && cd.hasZeroLayers();
if (noLayers) {
for (int i = 0; i < 8; i++) message.addOptionElement(i == 3 ? "Please create a " + (cd.hasDrumPads() ? "Drum Pad..." : "Device Layer...") : "", i == 7 ? "Up" : "", true, "", "", false, true);
display.send(message);
return;
}
this.updateMenu();
this.updateDisplayElements(message, cd, cd.getSelectedLayerOrDrumPad());
display.send(message);
}
Aggregations