use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class FireUserMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final IGraphicDisplay display = this.surface.getGraphicsDisplay();
final IParameterBank userBank = this.model.getUserParameterBank();
final int page = userBank.getScrollPosition() / userBank.getPageSize();
final String desc = "User Page: " + (page + 1);
String paramLine = "";
int value = -1;
final int touchedKnob = this.getTouchedKnob();
if (touchedKnob > -1) {
final IParameter p = userBank.getItem(touchedKnob);
paramLine = p.getName(5);
if (paramLine.isEmpty())
paramLine = "Not mapped";
else {
value = p.getValue();
paramLine += ": " + p.getDisplayedValue(6);
}
}
display.addElement(new TitleValueComponent(desc, paramLine, value, false));
display.send();
}
use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class SLControllerSetup method registerContinuousCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerContinuousCommands() {
final SLControlSurface surface = this.getSurface();
for (int i = 0; i < 8; i++) {
final int index = i;
this.addFader(ContinuousID.get(ContinuousID.FADER1, i), "Fader " + (i + 1), null, BindType.CC, SLControlSurface.MKII_SLIDER1 + i);
final IHwRelativeKnob relativeKnob = this.addRelativeKnob(ContinuousID.get(ContinuousID.DEVICE_KNOB1, i), "Device Knob " + (i + 1), null, SLControlSurface.MKII_KNOB_ROW1_1 + i, RelativeEncoding.SIGNED_BIT);
relativeKnob.addOutput(() -> {
final boolean hasDevice = this.model.hasSelectedDevice();
final IParameterBank parameterBank = this.model.getCursorDevice().getParameterBank();
return hasDevice ? parameterBank.getItem(index).getValue() : 0;
}, value -> surface.getMidiOutput().sendCC(0x70 + index, Math.min(value * 11 / 127, 11)));
this.addAbsoluteKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), null, SLControlSurface.MKII_KNOB_ROW2_1 + i);
}
this.addFader(ContinuousID.TOUCHPAD_X, "Touchpad X", new TouchpadCommand(true, this.model, surface), BindType.CC, SLControlSurface.MKII_TOUCHPAD_X);
this.addFader(ContinuousID.TOUCHPAD_Y, "Touchpad Y", new TouchpadCommand(false, this.model, surface), BindType.CC, SLControlSurface.MKII_TOUCHPAD_Y);
// These are no faders but cannot be mapped to any meaningful control anyway
this.addFader(ContinuousID.HELLO, "Tap Init", new TapTempoInitMkICommand(this.model, surface), BindType.CC, SLControlSurface.MKI_BUTTON_TAP_TEMPO);
this.addFader(ContinuousID.TEMPO, "Tap Tempo", new TapTempoMkICommand(this.model, surface), BindType.CC, SLControlSurface.MKI_BUTTON_TAP_TEMPO_VALUE);
// Volume, Track and Parameter modes are always bound since they have dedicated controls
final ModeManager modeManager = surface.getModeManager();
modeManager.get(Modes.VOLUME).onActivate();
modeManager.get(Modes.TRACK).onActivate();
modeManager.get(Modes.DEVICE_PARAMS).onActivate();
}
use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class MVHelper method notifySelectedUserPage.
/**
* Display the name of the selected user parameter page.
*/
public void notifySelectedUserPage() {
this.delayDisplay(() -> {
final IParameterBank userBank = this.model.getUserParameterBank();
final int page = userBank.getScrollPosition() / userBank.getPageSize();
return "User Page: " + (page + 1);
});
}
use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class UserMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
this.drawDisplay2();
final ITextDisplay d = this.surface.getTextDisplay().clear();
// Row 1 & 2
final int extenderOffset = this.surface.getExtenderOffset();
final IParameterBank parameterBank = this.model.getUserParameterBank();
for (int i = 0; i < 8; i++) {
final IParameter param = parameterBank.getItem(extenderOffset + i);
d.setCell(0, i, param.doesExist() ? StringUtils.shortenAndFixASCII(param.getName(6), 6) : "").setCell(1, i, StringUtils.shortenAndFixASCII(param.getDisplayedValue(6), 6));
}
d.allDone();
}
use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class UserMode method updateKnobLEDs.
/**
* {@inheritDoc}
*/
@Override
public void updateKnobLEDs() {
final int upperBound = this.model.getValueChanger().getUpperBound();
final int extenderOffset = this.surface.getExtenderOffset();
final IParameterBank parameterBank = this.model.getUserParameterBank();
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);
}
}
Aggregations