use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class ParameterView method executeFunction.
/**
* {@inheritDoc}
*/
@Override
protected void executeFunction(final int padIndex) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final IHost host = this.model.getHost();
if (!cursorDevice.doesExist()) {
host.showNotification("No device selected.");
return;
}
switch(padIndex) {
case 12:
cursorDevice.selectPrevious();
break;
case 13:
cursorDevice.selectNext();
break;
case 14:
cursorDevice.getParameterBank().scrollBackwards();
this.mvHelper.notifySelectedParameterPage();
break;
case 15:
cursorDevice.getParameterBank().scrollForwards();
this.mvHelper.notifySelectedParameterPage();
break;
default:
// Not used
break;
}
if (padIndex >= 8)
return;
// Flip row 2 and 1 to look the same as in the Bitwig device display
final int selectedParameter = padIndex < 4 ? padIndex + 4 : padIndex - 4;
((SelectedDeviceMode<?, ?>) this.surface.getModeManager().get(Modes.DEVICE_PARAMS)).selectParameter(selectedParameter);
this.model.getHost().scheduleTask(() -> {
final StringBuilder message = new StringBuilder();
final Optional<String> selectedPage = cursorDevice.getParameterPageBank().getSelectedItem();
if (selectedPage.isEmpty())
message.append("No parameters available.");
else {
message.append(selectedPage.get()).append(": ");
final IParameter item = cursorDevice.getParameterBank().getItem(selectedParameter);
if (item.doesExist())
message.append(item.getName());
else
message.append("None");
}
host.showNotification(message.toString());
}, 200);
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class BrowseMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final IBrowser browser = this.model.getBrowser();
final ITextDisplay d = this.surface.getTextDisplay();
final boolean isPresetSession = browser.isPresetContentType();
final ICursorDevice cd = this.model.getCursorDevice();
if (isPresetSession && !(browser.isActive() && cd.doesExist())) {
d.notify("No active Browsing Session. Select device and press Browser...");
return;
}
d.clear();
for (int i = 0; i < 7; i++) {
final Optional<IBrowserColumn> column = this.getFilterColumn(i);
String value = "";
String name = "";
if (column.isPresent()) {
final IBrowserColumn browserColumn = column.get();
if (browserColumn.doesCursorExist())
value = browserColumn.getCursorName().equals(browserColumn.getWildcard()) ? "-" : browserColumn.getCursorName();
name = StringUtils.shortenAndFixASCII(browserColumn.getName(), 6);
}
if (i == this.getSelectedParameter())
name = ">" + name;
d.setCell(0, i, name).setCell(1, i, value);
}
final String selectedResult = browser.getSelectedResult();
String selectedContentType = browser.getSelectedContentType();
if (this.getSelectedParameter() == 7)
selectedContentType = ">" + selectedContentType;
d.setCell(0, 7, selectedContentType).setCell(1, 7, selectedResult == null || selectedResult.length() == 0 ? "-" : selectedResult);
d.allDone();
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceConfigView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
final int n = note - 36;
final int page = n < 8 ? n + 8 : n - 8;
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (cursorDevice.doesExist())
cursorDevice.getParameterPageBank().selectPage(page);
}
use of de.mossgrabers.framework.daw.data.ICursorDevice 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.ICursorDevice in project DrivenByMoss by git-moss.
the class MaschineParametersMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITextDisplay d = this.surface.getTextDisplay().clear();
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist()) {
d.notify("Please select a device...");
return;
}
// Row 1 & 2
final IParameterBank parameterBank = cd.getParameterBank();
for (int i = 0; i < 8; i++) {
final IParameter param = parameterBank.getItem(i);
String name = param.doesExist() ? StringUtils.shortenAndFixASCII(param.getName(), 6) : "";
if (i == this.getSelectedParameter())
name = ">" + name;
d.setCell(0, i, name).setCell(1, i, StringUtils.shortenAndFixASCII(param.getDisplayedValue(8), 8));
}
d.allDone();
}
Aggregations