use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class SelectedDeviceMode method onKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (cursorDevice == null)
return;
final IParameter item = cursorDevice.getParameterBank().getItem(index < 0 ? this.selParam : index);
if (!item.doesExist())
return;
if (isTouched && this.surface.isDeletePressed()) {
this.surface.setTriggerConsumed(ButtonID.DELETE);
item.resetValue();
}
item.touchValue(isTouched);
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class FireParameterMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final IGraphicDisplay display = this.surface.getGraphicsDisplay();
String desc = "Select";
String paramLine = "a device";
int value = -1;
if (this.model.hasSelectedDevice()) {
paramLine = "";
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final Optional<String> pageName = cursorDevice.getParameterPageBank().getSelectedItem();
desc = cursorDevice.getName(5) + ": " + (pageName.isPresent() ? StringUtils.optimizeName(pageName.get(), 5) : "None");
int touchedKnob = this.getTouchedKnob();
touchedKnob = this.surface.isPressed(ButtonID.ALT) ? 4 + touchedKnob : touchedKnob;
if (touchedKnob > -1) {
final IParameter p = this.bank.getItem(touchedKnob);
paramLine = p.getName(5);
if (!paramLine.isEmpty()) {
value = p.getValue();
paramLine += ": " + p.getDisplayedValue(6);
}
}
}
display.addElement(new TitleValueComponent(desc, paramLine, value, false));
display.send();
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class FireSelectButtonCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (velocity > 0)
return;
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActive(Modes.NOTE)) {
((NoteMode) modeManager.get(Modes.NOTE)).resetTranspose();
return;
}
if (modeManager.isActive(Modes.BROWSER)) {
((FireBrowserCommand) this.surface.getButton(ButtonID.BROWSE).getCommand()).discardBrowser(true);
return;
}
final FireConfiguration configuration = this.surface.getConfiguration();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (modeManager.isActive(Modes.DEVICE_PARAMS) && configuration.isDeleteModeActive()) {
cursorDevice.remove();
configuration.toggleDeleteModeActive();
return;
}
cursorDevice.toggleWindowOpen();
}
use of de.mossgrabers.framework.daw.data.ICursorDevice 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.ICursorDevice 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);
}
Aggregations