can't change address/universe
Hi there, thanks for the lib !
I've tryed replacing homemade solution with libartnet in on one of my project but I'm struggling on something.
I simply try to send some DMX to a universes( subnet+address am I right ?),
after setting up eveything , only the subnet has effect, address doesn't,
as in wireshark I see universe 0 when subnet is 0 and 16 with subnet 1, but changing address doesnt change a thing ...
here is my code , I'm running on windows but I don't see how my config could be responsible .
in advance thanks ;)
` std::vector<uint8_t> data = {127,255};
artnet_node artnet = artnet_new("2.0.0.222", 1);
artnet_set_short_name(artnet, "Test"); artnet_set_long_name(artnet, "TEST"); artnet_set_node_type(artnet, ARTNET_SRV);
artnet_set_subnet_addr(artnet, 0);
artnet_set_port_type(artnet, 0, ARTNET_ENABLE_OUTPUT, ARTNET_PORT_DMX); artnet_set_port_addr(artnet, 0, ARTNET_OUTPUT_PORT, 1);
artnet_dump_config(artnet);
if (artnet_start(artnet) != 0) std::cout << artnet_strerror() << std::endl;
artnet_send_dmx(artnet, 0, data.size(), &data[0]);
artnet_stop(artnet); artnet_destroy(artnet);`
I was running into the same problem. There's a problem in libartnet, using: artnet_set_port_addr(node, 0, ARTNET_OUTPUT_PORT, 5) doesn't work.
But the following does work:
artnet_set_port_addr(node, 0, 1, 5);
Seems that the enum value of ARTNET_OUTPUT_PORT is incorrect for what artnet_set_port_addr is expecting.
The issue is with port direction, not the enum values. The ArtNet specification defines an INPUT port as one that sends ArtNet data and an OUTPUT port as one that receives ArtNet data (confusing I know!)
When sending DMX data via Art-Net (using artnet_send_dmx()), an INPUT port is needed, not an OUTPUT port:
The correct code should be:
artnet_set_port_addr(artnet, 0, ARTNET_INPUT_PORT, 1);
The workaround using 1 worked because ARTNET_INPUT_PORT is typically defined as 1, so this accidentally switched to the correct port direction.