use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateKnobLEDs.
/**
* {@inheritDoc}
*/
@Override
public void updateKnobLEDs() {
final int upperBound = this.model.getValueChanger().getUpperBound();
final ICursorDevice cd = this.model.getCursorDevice();
final int extenderOffset = this.surface.getExtenderOffset();
final IParameterBank parameterBank = cd.getParameterBank();
for (int i = 0; i < 8; i++) {
final IParameter param = parameterBank.getItem(extenderOffset + i);
this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_SINGLE_DOT, param.doesExist() ? Math.max(1, param.getValue()) : 0, upperBound);
}
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class DeviceParamsMode method onKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
this.isKnobTouched[index] = isTouched;
final ICursorDevice cd = this.model.getCursorDevice();
final IParameter param = cd.getParameterBank().getItem(index);
if (param.doesExist())
param.touchValue(isTouched);
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class GrooveCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final IParameter parameter = this.model.getGroove().getParameter(GrooveParameterID.ENABLED);
parameter.setValue(parameter.getValue() == 0 ? this.model.getValueChanger().getUpperBound() - 1 : 0);
}
use of de.mossgrabers.framework.daw.data.IParameter 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.IParameter 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