diff options
Diffstat (limited to 'lasertext/src')
| -rw-r--r-- | lasertext/src/ofApp.cpp | 32 | ||||
| -rw-r--r-- | lasertext/src/ofApp.h | 7 |
2 files changed, 36 insertions, 3 deletions
diff --git a/lasertext/src/ofApp.cpp b/lasertext/src/ofApp.cpp index 050b913..52f6d57 100644 --- a/lasertext/src/ofApp.cpp +++ b/lasertext/src/ofApp.cpp @@ -27,6 +27,8 @@ void ofApp::setup(){ banner.loadFont("fonts/EMSQwandry.svg"); //2023 //banner.init("Everything Is Going To Be Alright"); //banner.init("No Pleasure is Too Guilty"); + //banner.init("Éalú Le Grá"); + banner.init("Casaimid lenár gcroíthe anoi"); override_banner.loadFont("fonts/EMSQwandry.svg"); @@ -104,6 +106,10 @@ void ofApp::setup(){ //stars.init(ofVec2f(2000.0f,2000.0f),100.0f,1.0,5.0,4.0,1.0); + // listen on the given port + ofLog() << "listening for osc messages on port " << PORT; + receiver.setup(PORT); + } //====================== settings @@ -197,6 +203,25 @@ void ofApp::update(){ stars1.update(); stars2.update(); + + // check for waiting messages + while(receiver.hasWaitingMessages()){ + + // get the next message + ofxOscMessage m; + receiver.getNextMessage(m); + + // check for mouse moved message + if(m.getAddress() == "/message"){ + + if(m.getArgType(0) == OFXOSC_TYPE_STRING){ + string msgString = m.getArgAsString(0); + override_banner.init(msgString); + ofLog()<<"OSC received message "<<msgString; + + } + } + } } //-------------------------------------------------------------- @@ -324,18 +349,19 @@ void ofApp::keyReleased(int key){ case OF_KEY_UP:{ currentFont=(currentFont+1)%fonts.size(); banner.loadFont(fonts.getPath(currentFont)); + override_banner.loadFont(fonts.getPath(currentFont)); break; } case OF_KEY_DOWN:{ currentFont--; if (currentFont<0) currentFont=fonts.size()-1; - banner.loadFont(fonts.getPath(currentFont)); + override_banner.loadFont(fonts.getPath(currentFont)); break; } case '1':{ ofLog()<<"sending test phrase 1"; - override_banner.init("This is my new phrase"); - runUnixCommand("say 'This is my new phrase'"); + override_banner.init("The latin quarter"); + runUnixCommand("say 'The latin quarter'"); break; } case 's':{ diff --git a/lasertext/src/ofApp.h b/lasertext/src/ofApp.h index f347b8e..d1cb4cf 100644 --- a/lasertext/src/ofApp.h +++ b/lasertext/src/ofApp.h @@ -4,12 +4,16 @@ #include "ofxSvg.h" #include "ofxGui.h" #include "ofxXmlSettings.h" +#include "ofxOsc.h" #include "ofxHelios.h" #include "lineTransformer.h" #include "colourPolyline.h" #include "vectortext.h" +// OSC listening port +#define PORT 12345 + /* priorities 2023 @@ -234,4 +238,7 @@ class ofApp : public ofBaseApp{ ofPoint outputPosition; float outputScale; + + ofxOscReceiver receiver; + }; |
