Skip to content
Mark Slee edited this page Nov 24, 2020 · 3 revisions

Custom output mapping may be handled inside of the initialize callback method when using a static model. Inside this method, you should construct the appropriate LXOutput and LXDatagram objects and add them to the LX output engine.

ArtNet via UDP

void initialize(heronarts.lx.studio.LXStudio lx, heronarts.lx.studio.LXStudio.UI ui) {
  final String ARTNET_IP = "192.168.1.1";
  try {
    // Add an ArtNetDatagram which sends all of the points in our model
    ArtNetDatagram datagram = new ArtNetDatagram(lx, lx.model);
    datagram.setAddress(ARTNET_IP);
    lx.addOutput(datagram);

    // Here's an example of a custom ArtNetDatagram which only sends specific points
    int universeNumber = 0;
    int[] first100Points = new int[100];
    for (int i = 0; i < first100Points.length; ++i) {
      first100Points[i] = i;
    }
    ArtNetDatagram first100PointsDatagram = new ArtNetDatagram(lx, first100Points, universeNumber);
    first100PointsDatagram.setAddress(ARTNET_IP);
    lx.addOutput(first100PointsDatagram);    

  } catch (Exception x) {
    x.printStackTrace();
  }
}