summaryrefslogtreecommitdiff
path: root/lasertext
diff options
context:
space:
mode:
authorTim Redfern <redfernt@gmail.com>2023-09-14 21:11:07 +0100
committerTim Redfern <redfernt@gmail.com>2023-09-14 21:11:07 +0100
commit5a746fd8994e2601e14b8e186c25acd571685792 (patch)
treed9d6dd882a4fac4d7cd013a2cef1bcabe556e591 /lasertext
parent4d2fda8f0807957b9fbcf77656aa361c5954db9f (diff)
osc options
Diffstat (limited to 'lasertext')
-rw-r--r--lasertext/addons.make3
-rw-r--r--lasertext/src/ofApp.cpp31
-rw-r--r--lasertext/src/ofApp.h7
3 files changed, 37 insertions, 4 deletions
diff --git a/lasertext/addons.make b/lasertext/addons.make
index aa9be02..638686e 100644
--- a/lasertext/addons.make
+++ b/lasertext/addons.make
@@ -1,4 +1,5 @@
ofxSvg
ofxGui
ofxXmlSettings
-ofxHelios \ No newline at end of file
+ofxHelios
+ofxOsc
diff --git a/lasertext/src/ofApp.cpp b/lasertext/src/ofApp.cpp
index b0442bb..636aaa0 100644
--- a/lasertext/src/ofApp.cpp
+++ b/lasertext/src/ofApp.cpp
@@ -26,7 +26,8 @@ void ofApp::setup(){
//banner.loadFont("fonts/EMSDecorousScript.svg"); //2022
banner.loadFont("fonts/EMSQwandry.svg"); //2023
//banner.init("Everything Is Going To Be Alright");
- banner.init("No Pleasure is Too Guilty");
+ //banner.init("No Pleasure is Too Guilty");
+ banner.init("Éalú Le Grá");
override_banner.loadFont("fonts/EMSQwandry.svg");
@@ -103,6 +104,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
@@ -173,6 +178,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;
+
+ }
+ }
+ }
}
//--------------------------------------------------------------
@@ -300,17 +324,18 @@ 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");
+ override_banner.init("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;
+
};