Book Image

OpenFrameworks Essentials

Book Image

OpenFrameworks Essentials

Overview of this book

Table of Contents (19 chapters)
openFrameworks Essentials
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing the OSC messages receiver


To implement the receiving of OSC messages in the VideoSynth project, perform the following steps:

  1. Include the ofxOsc addon's header to the ofApp.h file by inserting the following line after the #include "ofxGui.h" line:

    #include "ofxOsc.h"
  2. Add a declaration of the OSC receiver object to the ofApp class:

    ofxOscReceiver oscReceiver;
  3. Set up the OSC receiver in setup():

    oscReceiver.setup( 12345 );

    The argument of the setup() method is the networking port number. After executing this command, oscReceiver begins listening on this port for incoming OSC messages. Each received message is added to a special message queue for further processing.

    Note

    A networking port is a number from 0 to 65535. Ports from 10000 to 65535 normally are not used by existing operating systems, so you can use them as port numbers for OSC messages. Note that two programs receiving networking data and working on the same computer must have different port numbers.

  4. Add the processing of incoming...