use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2(final IGraphicDisplay display) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!this.checkExists2(display, cd))
return;
final String color = this.model.getCurrentTrackBank().getSelectedChannelColorEntry();
final ColorEx bottomMenuColor = DAWColor.getColorEntry(color);
final IDeviceBank deviceBank = cd.getDeviceBank();
final IParameterBank parameterBank = cd.getParameterBank();
final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
final int selectedPage = parameterPageBank.getSelectedItemIndex();
final boolean hasPinning = this.model.getHost().supports(Capability.HAS_PINNING);
final IValueChanger valueChanger = this.model.getValueChanger();
for (int i = 0; i < parameterBank.getPageSize(); i++) {
final boolean isTopMenuOn = this.getTopMenuEnablement(cd, hasPinning, i);
String bottomMenu;
final String bottomMenuIcon;
boolean isBottomMenuOn;
if (this.showDevices) {
final IDevice item = deviceBank.getItem(i);
bottomMenuIcon = item.getName();
bottomMenu = item.doesExist() ? item.getName(12) : "";
isBottomMenuOn = i == cd.getIndex();
} else {
bottomMenuIcon = cd.getName();
bottomMenu = parameterPageBank.getItem(i);
if (bottomMenu.length() > 12)
bottomMenu = bottomMenu.substring(0, 12);
isBottomMenuOn = i == selectedPage;
}
final IParameter param = parameterBank.getItem(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);
display.addParameterElement(this.hostMenu[i], isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
}
}
use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class SLParameterMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITextDisplay d = this.surface.getTextDisplay().clearRow(0).clearRow(1);
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist()) {
d.setRow(0, " Please select a device... ");
d.done(0).done(1);
return;
}
final IParameterBank parameterBank = cd.getParameterBank();
for (int i = 0; i < 8; i++) {
final IParameter param = parameterBank.getItem(i);
d.setCell(0, i, param.doesExist() ? StringUtils.shortenAndFixASCII(param.getName(), 8) : "");
d.setCell(1, i, StringUtils.shortenAndFixASCII(param.getDisplayedValue(8), 8));
}
d.done(0).done(1);
}
use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class UserModule method parseUserValue.
private void parseUserValue(final LinkedList<String> path, final Object value) throws UnknownCommandException, MissingCommandException, IllegalParameterException {
final IParameterBank parameterBank = this.model.getUserParameterBank();
final String subCommand = getSubCommand(path);
try {
final int paramNo = Integer.parseInt(subCommand) - 1;
parseFXParamValue(parameterBank.getItem(paramNo), path, value);
} catch (final NumberFormatException ex) {
switch(subCommand) {
case "+":
if (isTrigger(value))
parameterBank.selectNextPage();
break;
case "-":
if (isTrigger(value))
parameterBank.selectPreviousPage();
break;
case "page":
final String pageCommand = getSubCommand(path);
if ("select".equals(pageCommand) || "selected".equals(pageCommand)) {
this.selectPage(parameterBank, toInteger(value) - 1);
} else {
try {
final int index = Integer.parseInt(pageCommand) - 1;
this.selectPage(parameterBank, index);
} catch (final NumberFormatException ex2) {
throw new UnknownCommandException(pageCommand);
}
}
break;
default:
throw new UnknownCommandException(subCommand);
}
}
}
use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class GenericFlexiControllerSetup method updateIndication.
protected void updateIndication() {
final Set<FlexiCommand> commands = this.configuration.getMappedCommands();
final FlexiCommand[] allCommands = FlexiCommand.values();
final ITrackBank trackBank = this.model.getTrackBank();
final Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
for (int i = 0; i < trackBank.getPageSize(); i++) {
final boolean hasTrackSel = selectedTrack.isPresent() && selectedTrack.get().getIndex() == i;
final ITrack track = trackBank.getItem(i);
track.setVolumeIndication(this.testVolumeIndication(commands, allCommands, i, hasTrackSel));
track.setPanIndication(this.testPanIndication(commands, allCommands, i, hasTrackSel));
final ISendBank sendBank = track.getSendBank();
final int sendPageSize = sendBank.getPageSize();
for (int j = 0; j < sendPageSize; j++) sendBank.getItem(j).setIndication(this.testSendIndication(commands, allCommands, i, hasTrackSel, sendPageSize, j));
}
final IMasterTrack masterTrack = this.model.getMasterTrack();
masterTrack.setVolumeIndication(commands.contains(FlexiCommand.MASTER_SET_VOLUME));
masterTrack.setPanIndication(commands.contains(FlexiCommand.MASTER_SET_PANORAMA));
final IParameterBank parameterBank = this.model.getCursorDevice().getParameterBank();
for (int i = 0; i < parameterBank.getPageSize(); i++) parameterBank.getItem(i).setIndication(this.testParameterIndication(commands, allCommands, i));
}
use of de.mossgrabers.framework.daw.data.bank.IParameterBank in project DrivenByMoss by git-moss.
the class UserHandler method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
final IParameterBank userParameterBank = this.model.getUserParameterBank();
if (userParameterBank == null)
return;
switch(command) {
case USER_SET_PARAMETER_1:
case USER_SET_PARAMETER_2:
case USER_SET_PARAMETER_3:
case USER_SET_PARAMETER_4:
case USER_SET_PARAMETER_5:
case USER_SET_PARAMETER_6:
case USER_SET_PARAMETER_7:
case USER_SET_PARAMETER_8:
final int index = command.ordinal() - FlexiCommand.USER_SET_PARAMETER_1.ordinal();
final IParameter userParam = userParameterBank.getItem(index);
final int val = value.getValue();
if (isAbsolute(knobMode))
userParam.setValue(this.getAbsoluteValueChanger(value), val);
else
userParam.changeValue(this.getRelativeValueChanger(knobMode), val);
break;
case USER_TOGGLE_PARAMETER_1:
case USER_TOGGLE_PARAMETER_2:
case USER_TOGGLE_PARAMETER_3:
case USER_TOGGLE_PARAMETER_4:
case USER_TOGGLE_PARAMETER_5:
case USER_TOGGLE_PARAMETER_6:
case USER_TOGGLE_PARAMETER_7:
case USER_TOGGLE_PARAMETER_8:
final IParameter userToggleParam = userParameterBank.getItem(command.ordinal() - FlexiCommand.USER_TOGGLE_PARAMETER_1.ordinal());
if (this.isButtonPressed(knobMode, value)) {
final int v = userToggleParam.getValue();
userToggleParam.setValue(v > 0 ? 0 : this.model.getValueChanger().getUpperBound() - 1);
}
break;
case USER_SELECT_PREVIOUS_PAGE:
userParameterBank.scrollBackwards();
this.displaySelectedPage(userParameterBank);
break;
case USER_SELECT_NEXT_PAGE:
userParameterBank.scrollForwards();
this.displaySelectedPage(userParameterBank);
break;
default:
throw new FlexiHandlerException(command);
}
}
Aggregations