Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 1.42 KB

README.md

File metadata and controls

36 lines (30 loc) · 1.42 KB

ofxOscBidirectional

ofxOsc fork to get replies to your OSC messages. Integrates work from different sources:

  • ofxOsc from openFrameworks 0.10.1: very minimal changes, only in access level of class members (see ofxOsc.diff if curious)
  • work from ERASE, who created a ofxOsc fork to permit communication to SuperCollider's server, based on an older version of ofxOsc.
  • ofxOscEvent, which is included to provide the capability of registering event listeners for OSC replies.

The project is motivated from the need to communicate to SuperCollider server, which needs to happen on the same UPD socket both ways. Thus, we are using an UdpListeningSocket to send OSC messages too. ERASE's work was a big inspiration here

Here's an example to setup OSC communication with SuperCollider:

testApp.h:

#include "ofxOscBidirectional.h"
private:
ofxOscSenderReceiver osc;

testApp.cpp:

void testApp::setup(){
  // set up read and write at once
  osc.setup(CLIENT_PORT,HOST,SERVER_PORT);
  // you can now register listeners
  ofAddListener(ofxOscEvent::packetIn, this, &OSCMessenger::onMessageReceived);
  // and send messages too
  ofxOscMessage m;
  m.setAddress("/notify"); m.addIntArg(1);
  osc.sendMessage(m);
}

void testApp::onMessageReceived(ofxOscMessage &m){
  std::string address = m.getAddress();
  std::cout << "RECVd " <<  address << std::endl;
}