Skip to content

Instantly share code, notes, and snippets.

@tobetchi
Created September 28, 2016 08:20
Show Gist options
  • Save tobetchi/c1fa5493521d97db919d0e84469f35bc to your computer and use it in GitHub Desktop.
Save tobetchi/c1fa5493521d97db919d0e84469f35bc to your computer and use it in GitHub Desktop.
openFrameworks OSC send sample
#include "ofMain.h"
#include "ofApp.h"
int main( ){
ofSetupOpenGL(1024, 768, OF_WINDOW);
ofRunApp(new ofApp());
}
#include "ofApp.h"
void ofApp::setup() {
// OSC Setup
sender.setup(HOST, SEND_PORT);
}
void ofApp::mouseMoved(int x, int y) {
int layer = 1;
float opacity = ofMap(y, 0, ofGetHeight(), 1.0, 0);
m.setAddress("/layer"+ofToString(layer)+"/video/opacity/values");
m.addFloatArg(opacity);
sender.sendMessage(m);
m.clear();
}
#pragma once
#include "ofMain.h"
#include "ofxOsc.h"
#define SEND_PORT 7000
#define HOST "localhost"
class ofApp : public ofBaseApp {
public:
void setup();
void mouseMoved(int x, int y);
private:
ofxOscSender sender;
ofxOscMessage m;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment