diff options
| author | Tim Redfern <tim@getdrop.com> | 2017-08-31 23:16:52 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@getdrop.com> | 2017-08-31 23:16:52 +0100 |
| commit | 14da9cce8d665d2872b76909e8abc001a9921297 (patch) | |
| tree | 872a61f062f3353e664c080c9f63c7ead3f53899 /gui/src/ofApp.h | |
| parent | 4637492e2a31c78f9109941638171d05e4007c4c (diff) | |
additive no good
Diffstat (limited to 'gui/src/ofApp.h')
| -rw-r--r-- | gui/src/ofApp.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/gui/src/ofApp.h b/gui/src/ofApp.h index 6bb0c15..20116a1 100644 --- a/gui/src/ofApp.h +++ b/gui/src/ofApp.h @@ -2,37 +2,41 @@ #include "ofMain.h" #include "ofxDmx.h" +#include "ofxMidi.h" #include "chainImage.h" class dmxMap{ + //resolution independent DMX colour tracker public: dmxMap(){ } - dmxMap(ofxDmx *_dmx,int _chan_R,int _chan_G,int _chan_B,int _x,int _y){ + dmxMap(ofxDmx *_dmx,int _chan_R,int _chan_G,int _chan_B,int _chan_intensity,float _x,float _y){ dmx=_dmx; chan_R=_chan_R; chan_G=_chan_G; chan_B=_chan_B; + chan_intensity=_chan_intensity; x=_x; y=_y; } - void update(){ + void update(int intensity){ unsigned char color[3]; - glReadPixels(x , ofGetHeight() - y , 1 , 1 , GL_RGB , GL_UNSIGNED_BYTE , color); + 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, R); - //dmx->setLevel(chan_G, G); - //dmx->setLevel(chan_B, B); - //dmx->update(); + dmx->setLevel(chan_R, color[0]); + dmx->setLevel(chan_G, color[1]); + dmx->setLevel(chan_B, color[2]); + dmx->setLevel(chan_intensity, intensity); + dmx->update(); } - int chan_R, chan_G, chan_B; - int x,y; + int chan_R, chan_G, chan_B, chan_intensity; + float x,y; ofxDmx *dmx; }; -class ofApp : public ofBaseApp{ +class ofApp : public ofBaseApp, public ofxMidiListener{ public: void setup(); @@ -40,6 +44,7 @@ class ofApp : public ofBaseApp{ void updateOutput(ofEventArgs & args); void draw(); void drawOutput(ofEventArgs & args); + void exit(); void keyPressed(ofKeyEventArgs &keyargs); void keyReleased(int key); @@ -61,4 +66,10 @@ class ofApp : public ofBaseApp{ ofxDmx dmx; vector<dmxMap> map; + void newMidiMessage(ofxMidiMessage& eventArgs); + ofxMidiIn midiIn; + ofxMidiMessage midiMessage; + + int dmxIntensity; + }; |
