use of de.mossgrabers.framework.controller.grid.LightInfo in project DrivenByMoss by git-moss.
the class LaunchpadProControllerDefinition method buildLEDUpdate.
/**
* {@inheritDoc}
*/
@Override
public List<String> buildLEDUpdate(final Map<Integer, LightInfo> padInfos) {
final StringBuilder sbNormal = new StringBuilder();
final StringBuilder sbFlash = new StringBuilder();
final StringBuilder sbPulse = new StringBuilder();
for (final Entry<Integer, LightInfo> e : padInfos.entrySet()) {
final int note = e.getKey().intValue();
final LightInfo info = e.getValue();
sbNormal.append(StringUtils.toHexStr(note)).append(' ').append(StringUtils.toHexStr(info.getColor())).append(' ');
if (info.getBlinkColor() > 0) {
if (info.isFast())
sbFlash.append(StringUtils.toHexStr(note)).append(' ').append(StringUtils.toHexStr(info.getBlinkColor())).append(' ');
else
sbPulse.append(StringUtils.toHexStr(note)).append(' ').append(StringUtils.toHexStr(info.getBlinkColor())).append(' ');
}
}
final List<String> result = new ArrayList<>(3);
final String sysExHeader = this.getSysExHeader();
if (sbNormal.length() > 0)
result.add(new StringBuilder(sysExHeader).append("0A ").append(sbNormal).append("F7").toString());
if (sbFlash.length() > 0)
result.add(new StringBuilder(sysExHeader).append("23 ").append(sbFlash).append("F7").toString());
if (sbPulse.length() > 0)
result.add(new StringBuilder(sysExHeader).append("28 ").append(sbPulse).append("F7").toString());
return result;
}
Aggregations