use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateKnobLEDs.
/**
* {@inheritDoc}
*/
@Override
protected void updateKnobLEDs() {
final int upperBound = this.model.getValueChanger().getUpperBound();
final ICursorDevice cd = this.model.getCursorDevice();
final int extenderOffset = this.surface.getExtenderOffset();
for (int i = 0; i < 8; i++) {
final IParameter param = cd.getFXParam(extenderOffset + i);
this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_WRAP, param.doesExist() ? param.getValue() : 0, upperBound);
}
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class DeviceParamsMode method onValueKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onValueKnobTouch(final int index, final boolean isTouched) {
this.isKnobTouched[index] = isTouched;
final ICursorDevice cd = this.model.getCursorDevice();
if (isTouched) {
if (this.surface.isDeletePressed()) {
this.surface.setButtonConsumed(this.surface.getDeleteButtonId());
cd.resetParameter(index);
return;
}
final IParameter param = cd.getFXParam(index);
if (!param.getName().isEmpty())
this.surface.getDisplay().notify(param.getName() + ": " + param.getDisplayedValue());
}
cd.touchParameter(index, isTouched);
this.checkStopAutomationOnKnobRelease(isTouched);
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
final ICursorDevice cd = this.model.getCursorDevice();
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 IChannelBank tb = this.model.getCurrentTrackBank();
final String color = tb.getSelectedTrackColorEntry();
final IValueChanger valueChanger = this.model.getValueChanger();
final String[] pages = cd.getParameterPageNames();
final int page = Math.min(Math.max(0, cd.getSelectedParameterPage()), pages.length - 1);
final int start = page / 8 * 8;
final boolean hasPinning = this.model.getHost().hasPinning();
for (int i = 0; i < 8; i++) {
boolean isTopMenuOn;
switch(i) {
case 0:
isTopMenuOn = cd.isEnabled();
break;
case 1:
isTopMenuOn = cd.isParameterPageSectionVisible();
break;
case 2:
isTopMenuOn = cd.isExpanded();
break;
case 4:
isTopMenuOn = !this.showDevices;
break;
case 5:
isTopMenuOn = hasPinning && cd.isPinned();
break;
case 6:
isTopMenuOn = cd.isWindowOpen();
break;
case 7:
isTopMenuOn = true;
break;
default:
// Not used
isTopMenuOn = false;
break;
}
String bottomMenu;
final String bottomMenuIcon = "";
boolean isBottomMenuOn;
if (this.showDevices) {
bottomMenu = cd.doesSiblingExist(i) ? cd.getSiblingDeviceName(i, 12) : "";
isBottomMenuOn = i == cd.getPositionInBank();
} else {
final int index = start + i;
bottomMenu = index < pages.length ? pages[index] : "";
if (bottomMenu.length() > 12)
bottomMenu = bottomMenu.substring(0, 12);
isBottomMenuOn = index == page;
}
final double[] bottomMenuColor = BitwigColors.getColorEntry(color);
final IParameter param = cd.getFXParam(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);
message.addParameterElement(i != 5 || hasPinning ? MENU[i] : "", isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
}
display.send(message);
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class GrooveMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final IParameter[] parameters = this.model.getGroove().getParameters();
final int quantizeAmount = this.surface.getConfiguration().getQuantizeAmount();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
message.addParameterElement("Quant Amnt", quantizeAmount * 1023 / 100, quantizeAmount + "%", this.isKnobTouched[0], -1);
message.addOptionElement(" Groove", "", false, "", "", false, false);
for (int i = 0; i < parameters.length; i++) message.addParameterElement(parameters[i].getName(10), parameters[i].getValue(), parameters[i].getDisplayedValue(8), this.isKnobTouched[i], -1);
for (int i = parameters.length; i < 6; i++) message.addEmptyElement();
display.send(message);
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final Display d = this.surface.getDisplay().clearRow(0).clearRow(2);
final ICursorDevice cd = this.model.getCursorDevice();
if (cd.hasSelectedDevice()) {
for (int i = 0; i < 8; i++) {
final IParameter param = cd.getFXParam(i);
d.setCell(0, i, param.doesExist() ? StringUtils.shortenAndFixASCII(param.getName(), 8) : "").setCell(2, i, param.getDisplayedValue(8));
}
} else
d.setRow(0, " Please select a device... ");
d.done(0).done(2);
}
Aggregations