hiroyuki / ofxArtnet

ultra simple artnet addon for openFrameworks
MIT License
68 stars 31 forks source link

ofxArtnetMessage setData size issue #34

Open dimitre opened 3 years ago

dimitre commented 3 years ago

Correct me if I'm wrong but right now if I allocate a message with a number of bytes, ex: 512, and try to setData with the same number of bytes it actually returns a warning and does nothing, so I have to allocate the message with the size 513 to be able to copy. maybe the <= in this line should be only a less than

    if (getSize() <= index) {

Cheers Dimitre

KabooHahahein commented 2 years ago

You should never be setting index 512 on an array/vector of size 512 because the array/vector is 0 indexed.

The code is correct.

dimitre commented 2 years ago

ok I thought ofxArtnet started in channel 1.

KabooHahahein commented 2 years ago

"physical is an information packet showing the original physical universe of this data, if required. Then follows up to 512 lighting values in the range 0 to 255."

https://en.wikipedia.org/wiki/Art-Net

I don't see any reason why the data should skip a byte. If that's the case, it would be controller specific, and based on the implementation.

If you're using 1-indexed arrays, your array should be size + 1.