Search in sources :

Example 11 with LightInfo

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;
}
Also used : ArrayList(java.util.ArrayList) LightInfo(de.mossgrabers.framework.controller.grid.LightInfo)

Aggregations

LightInfo (de.mossgrabers.framework.controller.grid.LightInfo)11 ArrayList (java.util.ArrayList)2 BeatstepControlSurface (de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface)1 BeatstepPadGrid (de.mossgrabers.controller.arturia.beatstep.controller.BeatstepPadGrid)1 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)1 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)1 ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)1