ofxArtnet | control individual channels x512

hi there!

i am getting into ofxArtnet, by hiroyuki, and am only having success to send 3 channels through artnet to a dmx equipment (code below). but, actually, would like to know how to send individual channels throughout all 512 channels of one universe.

it seems that before you could send something like artnet.sendDmx(ip address, dmxData, 512);, but not in this version of the addon, as i found out.

in short, i would like to specify directly channel 1 (value 0-255), channel 2 (value 0-255), … , channel 512 (value 0-255), but only can change 3 channels on the way below by altering red, green and blue of ofColor.

ofApp.h

ofFbo fboArt;
ofxArtnetSender artnet;

ofApp.cpp

#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){
	fboArt.allocate(1, 1, GL_RGB); 
	artnet.setup("192.168.1.200");
}

//--------------------------------------------------------------
void ofApp::update(){
	fboArt.begin();
	ofClear(0);
	ofColor color;
	color.r = 255;
	color.g = 255;
	color.b = 255;
	ofSetColor(color);
	ofDrawRectangle(0, 0, 1, 1);
	fboArt.end();

	ofPixels data;
	fboArt.readToPixels(data);
	artnet.sendArtnet(data);
}

//--------------------------------------------------------------
void ofApp::draw(){
	ofBackground(0);
	ofSetColor(255);
	fboArt.draw(0, 0);
}

also tried to send unsigned char directly into data, but it seems to only receive pixels data.

any tips, would be great!!
thank you!

You can use a few different types to send artnet data. I used this:

std::vector<uint8_t> artnetData

And using an artnet message:
ofxArtnetMessage m;

And filling the vector like this;

for (int i = 0; i <255; i++) {
        artnetData.push_back(uint8_t(0));
    }

And then setting the values as needed and then sending like so:

m.setData(artnetData);
    artnet.sendArtnet(m);

perfect, @fresla!
working fine now

thank you a lot
best!

Hello Novas

Is this what you ended up using - to my eyes it would just make a really long vector?

hi @24601

you can address the channels directly by :

m.setData(artnetData);
    artnet.sendArtnet(m);

i am without my computer now. as soon as i get it, i send some code example here

1 Like