summaryrefslogtreecommitdiff
path: root/gui/src/ofApp.h
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/ofApp.h')
-rw-r--r--gui/src/ofApp.h89
1 files changed, 76 insertions, 13 deletions
diff --git a/gui/src/ofApp.h b/gui/src/ofApp.h
index 20116a1..181c4c7 100644
--- a/gui/src/ofApp.h
+++ b/gui/src/ofApp.h
@@ -2,22 +2,34 @@
#include "ofMain.h"
#include "ofxDmx.h"
+//#include "ofxArtnet.h"
#include "ofxMidi.h"
#include "chainImage.h"
-class dmxMap{
+class USBdmxMap{
//resolution independent DMX colour tracker
public:
- dmxMap(){
+ USBdmxMap(){
}
- dmxMap(ofxDmx *_dmx,int _chan_R,int _chan_G,int _chan_B,int _chan_intensity,float _x,float _y){
+ USBdmxMap(ofxDmx *_dmx,int chan_base,float _x,float _y){
dmx=_dmx;
- chan_R=_chan_R;
- chan_G=_chan_G;
- chan_B=_chan_B;
- chan_intensity=_chan_intensity;
+
+ // R, G, B, white, dimmer, shutter
+
+ // dimmer, shutter, R, G, B, white
+
+
+ chan_intensity=chan_base;
+ chan_shutter=chan_base+1;
+ chan_R=chan_base+2;
+ chan_G=chan_base+3;
+ chan_B=chan_base+4;
+ chan_white=chan_base+5;
+
+ //dmx->setLevel(chan_shutter,15,0);
+ //dmx->update();
x=_x;
y=_y;
}
@@ -25,17 +37,57 @@ class dmxMap{
unsigned char color[3];
glReadPixels(x*ofGetWidth() , ofGetHeight() - (y*ofGetHeight()) , 1 , 1 , GL_RGB , GL_UNSIGNED_BYTE , color);
//printf("dmxMap %i,%i: colour %i %i %i\n",x,y,color[0],color[1],color[2]);
- dmx->setLevel(chan_R, color[0]);
- dmx->setLevel(chan_G, color[1]);
- dmx->setLevel(chan_B, color[2]);
- dmx->setLevel(chan_intensity, intensity);
+
+ dmx->setLevel(chan_R,color[0]); //,0);
+ dmx->setLevel(chan_G,color[1]); //,0);
+ dmx->setLevel(chan_B,color[2]); //,0);
+ dmx->setLevel(chan_white,0); //,0);
+ dmx->setLevel(chan_intensity,intensity); //,0);
+ dmx->setLevel(chan_shutter,255); //,0);
dmx->update();
+
+ printf("Dmx: %i,%i,%i @ %i \n",color[0],color[1],color[2],intensity);
}
- int chan_R, chan_G, chan_B, chan_intensity;
+ int chan_R, chan_G, chan_B, chan_intensity, chan_shutter, chan_white;
float x,y;
ofxDmx *dmx;
};
+class ArtnetDmxMap{
+ //resolution independent DMX colour tracker
+ public:
+ ArtnetDmxMap(){
+ }
+ ArtnetDmxMap(unsigned char *_dmx_data,int chan_base,float _x,float _y){
+ dmx_data=_dmx_data;
+ chan_shutter=chan_base;
+ chan_intensity=chan_base+1;
+ chan_R=chan_base+2;
+ chan_G=chan_base+3;
+ chan_B=chan_base+4;
+
+ //dmx->setLevel(chan_shutter,15,0);
+ //dmx->update();
+ x=_x;
+ y=_y;
+ }
+ void update(int intensity){
+ unsigned char color[3];
+ glReadPixels(x*ofGetWidth() , ofGetHeight() - (y*ofGetHeight()) , 1 , 1 , GL_RGB , GL_UNSIGNED_BYTE , color);
+ //printf("dmxMap %i,%i: colour %i %i %i\n",x,y,color[0],color[1],color[2]);
+ dmx_data[chan_shutter]=255;
+ dmx_data[chan_intensity]=intensity;
+ dmx_data[chan_R]=color[0];
+ dmx_data[chan_G]=color[1];
+ dmx_data[chan_B]=color[2];
+
+ //printf("Dmx: %i,%i,%i @ %i \n",color[0],color[1],color[2],intensity);
+ }
+ int chan_R, chan_G, chan_B, chan_intensity, chan_shutter;
+ float x,y;
+ unsigned char *dmx_data;
+};
+
class ofApp : public ofBaseApp, public ofxMidiListener{
public:
@@ -46,6 +98,8 @@ class ofApp : public ofBaseApp, public ofxMidiListener{
void drawOutput(ofEventArgs & args);
void exit();
+ void outputKeyPressed(ofKeyEventArgs & args);
+
void keyPressed(ofKeyEventArgs &keyargs);
void keyReleased(int key);
void mouseMoved(int x, int y );
@@ -62,9 +116,14 @@ class ofApp : public ofBaseApp, public ofxMidiListener{
vector<string> arguments;
chainImageSet images;
+ chainImageSet images2;
ofxDmx dmx;
- vector<dmxMap> map;
+ //ofxArtnet artnet;
+
+ //unsigned char dmx_data[512];
+
+ vector<USBdmxMap> map;
void newMidiMessage(ofxMidiMessage& eventArgs);
ofxMidiIn midiIn;
@@ -72,4 +131,8 @@ class ofApp : public ofBaseApp, public ofxMidiListener{
int dmxIntensity;
+ bool outputFS;
+
+ float next_update;
+
};