use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerModeVolume method onValueKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onValueKnobTouch(final int index, final boolean isTouched) {
this.isKnobTouched[index] = isTouched;
final ICursorDevice cd = this.model.getCursorDevice();
// Drum Pad Bank has size of 16, layers only 8
final int offset = getDrumPadIndex(cd);
final IChannel layer = cd.getLayerOrDrumPad(offset + index);
if (!layer.doesExist())
return;
if (isTouched) {
if (this.surface.isDeletePressed()) {
this.surface.setButtonConsumed(this.surface.getDeleteButtonId());
cd.resetLayerOrDrumPadVolume(offset + index);
return;
}
this.surface.getDisplay().notify("Volume: " + layer.getVolumeStr());
}
cd.touchLayerOrDrumPadVolume(layer.getIndex(), isTouched);
this.checkStopAutomationOnKnobRelease(isTouched);
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerModeVolume method onValueKnob.
/**
* {@inheritDoc}
*/
@Override
public void onValueKnob(final int index, final int value) {
final ICursorDevice cd = this.model.getCursorDevice();
// Drum Pad Bank has size of 16, layers only 8
final int offset = getDrumPadIndex(cd);
final IChannel layer = cd.getLayerOrDrumPad(offset + index);
if (layer.doesExist())
cd.changeLayerOrDrumPadVolume(offset + index, value);
}
use of de.mossgrabers.framework.daw.ICursorDevice 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.ICursorDevice 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.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceParamsMode method moveUp.
/**
* Move up the hierarchy.
*/
protected void moveUp() {
// There is no device on the track move upwards to the track view
final ICursorDevice cd = this.model.getCursorDevice();
final View activeView = this.surface.getViewManager().getActiveView();
if (!cd.hasSelectedDevice()) {
activeView.executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
return;
}
// Parameter banks are shown -> show devices
final ModeManager modeManager = this.surface.getModeManager();
final DeviceParamsMode deviceParamsMode = (DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS);
if (!deviceParamsMode.isShowDevices()) {
deviceParamsMode.setShowDevices(true);
return;
}
// Devices are shown, if nested show the layers otherwise move up to the tracks
if (cd.isNested()) {
cd.selectParent();
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
deviceParamsMode.setShowDevices(false);
cd.selectChannel();
return;
}
// Move up to the track
if (this.model.isCursorDeviceOnMasterTrack()) {
activeView.executeTriggerCommand(Commands.COMMAND_MASTERTRACK, ButtonEvent.DOWN);
activeView.executeTriggerCommand(Commands.COMMAND_MASTERTRACK, ButtonEvent.UP);
} else
activeView.executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
}
Aggregations