use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class ParamsMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final Kontrol1Display d = (Kontrol1Display) this.surface.getDisplay();
d.clear();
if (this.model.hasSelectedDevice()) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
d.setCell(0, 0, cursorDevice.getName(8).toUpperCase(Locale.US));
final Optional<String> selectedItem = cursorDevice.getParameterPageBank().getSelectedItem();
if (selectedItem.isPresent())
d.setCell(1, 0, selectedItem.get().toUpperCase(Locale.US));
for (int i = 0; i < 8; i++) {
final IParameter p = this.bank.getItem(i);
final String name = StringUtils.shortenAndFixASCII(p.getName(8), 8).toUpperCase(Locale.US);
if (!name.isEmpty())
d.setCell(0, 1 + i, name).setCell(1, 1 + i, checkForUpperCase(StringUtils.shortenAndFixASCII(p.getDisplayedValue(8), 8)));
d.setBar(1 + i, this.surface.getContinuous(ContinuousID.get(ContinuousID.KNOB1, i)).isTouched() && p.doesExist(), p.getValue());
}
} else
d.setCell(0, 3, " PLEASE").setCell(0, 4, "SELECT A").setCell(0, 5, "DEVICE").allDone();
d.allDone();
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class ParamsMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final IValueChanger valueChanger = this.model.getValueChanger();
final IParameterPageBank parameterPageBank = this.cursorDevice.getParameterPageBank();
final Optional<String> selectedItem = parameterPageBank.getSelectedItem();
final String selectedPage = selectedItem.isPresent() ? StringUtils.optimizeName(selectedItem.get(), 8) : "";
final int[] vuData = new int[16];
for (int i = 0; i < 8; i++) {
final IParameter parameter = this.bank.getItem(i);
// Track Available
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_AVAILABLE, TrackType.GENERIC, i);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_SELECTED, parameter.isSelected() ? 1 : 0, i);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_RECARM, 0, i);
final boolean exists = parameter.doesExist();
final String info = exists ? parameter.getDisplayedValue(8) : " ";
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME_TEXT, 0, i, info);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_PAN_TEXT, 0, i, info);
final String name = exists ? this.cursorDevice.getName(8) + "\n" + selectedPage + "\n" + parameter.getName(16) : "None";
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_NAME, 0, i, name);
final int j = 2 * i;
vuData[j] = valueChanger.toMidiValue(parameter.getModulatedValue());
vuData[j + 1] = valueChanger.toMidiValue(parameter.getModulatedValue());
}
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_VU, 2, 0, vuData);
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class MaschineJamSwingCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (this.surface.isSelectPressed()) {
if (event == ButtonEvent.DOWN) {
final IParameter parameter = this.model.getGroove().getParameter(GrooveParameterID.ENABLED);
parameter.setValue(parameter.getValue() == 0 ? this.model.getValueChanger().getUpperBound() - 1 : 0);
this.mvHelper.delayDisplay(() -> parameter.getName() + ": " + parameter.getDisplayedValue());
}
return;
}
if (event == ButtonEvent.DOWN) {
this.surface.getViewManager().setTemporary(Views.SHUFFLE);
this.encoderManager.enableTemporaryEncodeMode(EncoderMode.TEMPORARY_SWING);
} else if (event == ButtonEvent.UP) {
this.surface.getViewManager().restore();
this.encoderManager.disableTemporaryEncodeMode();
}
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class LaunchkeyMk3ParameterMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITextDisplay d = this.surface.getTextDisplay();
if (this.areKnobs) {
// Display device and current parameter page
final StringBuilder sb = new StringBuilder();
if (this.cursorDevice.doesExist())
sb.append(this.cursorDevice.getName(8)).append(' ').append(this.cursorDevice.getParameterPageBank().getSelectedItem());
else
sb.append("No device");
d.setCell(LaunchkeyMk3Display.SCREEN_ROW_BASE, 0, sb.toString());
final ICursorTrack cursorTrack = this.model.getCursorTrack();
final String trackText = cursorTrack.doesExist() ? String.format("%d: %s", Integer.valueOf(cursorTrack.getPosition() + 1), cursorTrack.getName()) : "No sel. track";
d.setCell(LaunchkeyMk3Display.SCREEN_ROW_BASE + 1, 0, trackText);
}
final int row = this.areKnobs ? LaunchkeyMk3Display.SCREEN_ROW_POTS : LaunchkeyMk3Display.SCREEN_ROW_FADERS;
// Format track names
final IParameterBank parameterBank = this.cursorDevice.getParameterBank();
for (int i = 0; i < 8; i++) {
final IParameter item = parameterBank.getItem(i);
final boolean exists = item.doesExist();
final int offset = i * 2;
d.setCell(row + offset, 0, exists ? item.getName() : "No parameter");
d.setCell(row + offset + 1, 0, exists ? item.getDisplayedValue() : "");
}
// Add master fader
if (!this.areKnobs) {
final IMasterTrack masterTrack = this.model.getMasterTrack();
d.setCell(row + 16, 0, "Master");
d.setCell(row + 16 + 1, 0, "Vol: " + masterTrack.getVolumeStr());
}
d.allDone();
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class ParameterMode method onKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
this.isKnobTouched[index] = isTouched;
if (!this.cursorDevice.doesExist())
return;
final IParameter item = this.cursorDevice.getParameterBank().getItem(index);
if (!item.doesExist())
return;
if (isTouched && this.surface.isDeletePressed()) {
this.surface.setTriggerConsumed(ButtonID.DELETE);
item.resetValue();
}
item.touchValue(isTouched);
}
Aggregations