tigoe / sACNSource

A library for sending DMX-512 messages in an sACN packet over UDP
https://tigoe.github.io/sACNSource/
MIT License
16 stars 4 forks source link

Multiple Universes #3

Closed Olivierdemoustier closed 1 year ago

Olivierdemoustier commented 2 years ago

Would like to see a way to send more than 1 universe. Tried using more than 1 instance of sacnsource. But seconde universe would not do anything usefull. Sorry, multiple instances does work..... I had problem with the receivers.... Tip: set ip in secrets to 2.255.255.255 for multicast

tigoe commented 1 year ago

Sorry, I haven't looked at this repo in a while. You should be able to do multiple universes by calling setUniverse() before you start each packet. Something like this (warning: untested, as I don't have the equipment at home to test multiple universes):

// for universes 1-3:
for (int universe = 1; universe < 4; universe++) {
  myController.setUniverse(universe);
  // set DMX channel values to 0:
    for (int dmxChannel = 0; dmxChannel < 513; dmxChannel++) {
      myController.setChannel(dmxChannel, 0);
    }
   // send data frame for this universe:
    myController.sendPacket(SECRET_SACN_RECV);
} // iterate to the next universe

You can do the same with sourceName and UUID using setSourceName() and setUuid(). None of these three commands require a new initializer to change the property.

tigoe commented 1 year ago

By the way, on multicast, the sACN standard formula is 239.255.universeHighByte.universeLowByte. ETC has a calculator for this

tigoe commented 1 year ago

Hope that helps.