All Projects → 2bbb → ofxPubSubOsc

2bbb / ofxPubSubOsc

Licence: MIT license
bind OSC messages and values with only writing tiny codes on setup once.

Programming Languages

C++
36643 projects - #6 most used programming language
Makefile
30231 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to ofxPubSubOsc

ofxDeferredShading
an openFrameworks addon for shading, lighting, lens simulation.
Stars: ✭ 78 (+8.33%)
Mutual labels:  openframeworks, openframeworks-addon
loaf
loaf: lua, osc, and openFrameworks
Stars: ✭ 37 (-48.61%)
Mutual labels:  osc, openframeworks
ofxOscMidi
Midi in, OSC out with Midi thru. Based on openFrameworks
Stars: ✭ 66 (-8.33%)
Mutual labels:  osc, openframeworks
Ofxremoteui
OpenFrameworks addon serves any number of variables (bool, float, int, enum, string, ofColor) on the network, so that you can modify from outside the OF app. Includes a native OSX Client. OSC based.
Stars: ✭ 132 (+83.33%)
Mutual labels:  osc, openframeworks
ofxCorkCsg
A constructive solid geometry (mesh boolean) addon for openFrameworks.
Stars: ✭ 43 (-40.28%)
Mutual labels:  openframeworks, openframeworks-addon
ofxCameraAnaglyph
Anaglyph Camera for Stereo 3D Rendering for OpenFrameworks
Stars: ✭ 25 (-65.28%)
Mutual labels:  openframeworks, openframeworks-addon
ofxOpenCvDnnObjectDetection
OpenCV based DNN Object Detection Library for Openframeworks
Stars: ✭ 34 (-52.78%)
Mutual labels:  openframeworks, openframeworks-addon
ofxOilPaint
An oil painting simulation addon for openFrameworks
Stars: ✭ 45 (-37.5%)
Mutual labels:  openframeworks, openframeworks-addon
SketchSynth
A drawable OSC control panel
Stars: ✭ 46 (-36.11%)
Mutual labels:  osc, openframeworks
ofxTouchPad
Multitouch support for touchpads.
Stars: ✭ 23 (-68.06%)
Mutual labels:  openframeworks, openframeworks-addon
VCVRack-Holon.ist
Holon.ist Receiver for VCV Rack
Stars: ✭ 13 (-81.94%)
Mutual labels:  osc
micropython-osc
A minimal OSC client and server library for MicroPython.
Stars: ✭ 37 (-48.61%)
Mutual labels:  osc
Pixel-Packing-Examples
Pixel Packing Data Transfer with TouchDesigner, openFrameworks, and Processing
Stars: ✭ 43 (-40.28%)
Mutual labels:  openframeworks
kivy service osc
simple UI/Service communication using osc on python-for-android
Stars: ✭ 53 (-26.39%)
Mutual labels:  osc
Hacktoberfest2021
Make your first Pull Request on Hacktoberfest 2022. Don't forget to spread love and if you like give us a ⭐️
Stars: ✭ 1,320 (+1733.33%)
Mutual labels:  osc
DailySketch
Daily coding sketch
Stars: ✭ 45 (-37.5%)
Mutual labels:  openframeworks
ofxVui
✨ Such Wow! View + GUI System for openFrameworks ✨
Stars: ✭ 48 (-33.33%)
Mutual labels:  openframeworks
ImGui Widgets
my imgui widgets/skin including custom UI on openFrameworks
Stars: ✭ 24 (-66.67%)
Mutual labels:  openframeworks
SwingOSC
An OpenSoundControl (OSC) server to dynamically instantiate and control Java objects. Its main application is a GUI library for SuperCollider.
Stars: ✭ 22 (-69.44%)
Mutual labels:  osc
Procedural-Terrain-Generation
3D computer graphics program in C++ OpenFrameworks of a procedural terrain generator based on simplex noise with camera movement and real-time adjustable parameters from the GUI
Stars: ✭ 18 (-75%)
Mutual labels:  openframeworks

ofxPubSubOsc

easy utility for publish/subscribe OSC message.

Dependencies

  • ofxOsc

Notice

  • this addon is tested with oF0.9.8~
  • if you use oF0.9.0~, then you can use std::function<void(ofxOscMessage &)>! detail: API Reference
  • if you use oF~0.8.4, then you can use branch:v0_1_x_oF084
  • if you have challange spirit, please use dev/vX.Y.Z branch.
  • if you want to join development ofxPubSubOsc, open the issue and post the PR for dev/vX.Y.Z.

TOC

How to use

class ofApp : public ofBaseApp {
	int foo;
	ofColor c;
	ofPoint p;
public:
	void setup() {
		ofxSubscribeOsc(9005, "/foo", foo);
		ofxSubscribeOsc(9005, "/color", c);
		ofxSubscribeOsc(9005, "/p", p);
		
		ofxPublishOsc("localhost", 9006, "/fps", &ofGetFrameRate);
		
		ofxSubscribeOsc(9005, "/lambda", [](const std::string &str){
			ofLogNotice() << "receive " << str;
		});
		ofxSubscribeOsc(9005, "/trigger_event", [](){
			ofLogNotice() << "receive trigger_event";
		});
	}
	
	void update() {
		// do NOTHING about OSC on update!!!
	}
	
	void draw() {
		ofSetColor(c);
		ofDrawCircle(p, 5);
	}
};

Simple API Reference

API Reference is imperfect now.

If you want to use advanced features, see Advanced

ofxSubscribeOsc

  • void ofxSubscribeOsc(int port, const string &address, SupportedType &value);

bind a value to the argument(s) of OSC messages with an address pattern address incoming to port.

See more ofxSubscribeOsc

  • ofxUnsubscribeOsc(int port, const string &address);

unbind from OSC messages with an address pattern address incoming to port.

  • ofxUnsubscribeOsc(int port);

unbind from OSC messages with any address patterns incoming to port.

See class ofxOscSubscriberManager, class ofxOscSubscriber

ofxPublishOsc

  • void ofxPublishOsc(const string &ip, int port, const string &address, SupportedType &value, bool whenValueIsChanged = true);

publish value as an OSC message with an address pattern address to ip:port every time the value has changed. If whenValueIsChanged is set to false, then the binded value is sent every frame after App::update.

See more ofxPublishOsc, ofxPublishOscIf

  • void ofxUnpublishOsc(const string &ip, int port, const string &address);

unbind a publisher sending OSC message with an address pattern address to ip:port.

  • void ofxUnpublishOsc(const string &ip, int port);

unbind all the publishers sending to ip:port.

See class ofxOscPublisherManager, class ofxOscPublisher

ofxRegisterPublishingOsc

  • void ofxRegisterPublishingOsc(const string &ip, int port, const string &address, SupportedType &value)
  • void ofxPublishRegisteredOsc(const string &ip, int port, const string &address)

register value as an OSC message with an address pattern address to ip:port. and publish when call ofxPublishRegisteredOsc(ip, port, address).

  • void ofxUnregisterPublishingOsc(const string &ip, int port, const string &address)

unregister OSC message with an address pattern address to ip:port.

  • void ofxUnregisterPublishingOsc(const string &ip, int port)

unregister all the messages sending to ip:port.

NOTE: registable type is same to ofxPublishOsc. see more ofxPublishOsc.

ofxSendOsc

  • void ofxSendOsc(const string &ip, int port, const string &address, Arguments && ... arguments)

Supported types

  • Arithmetic is any type of Int32, Int64 or Float

Arithmetic (Int32, Int64, Float)

  • bool (published as Int32)
  • unsigned char, char (published as Int32)
  • unsigned short, short (published as Int32)
  • unsigned int, int (published as Int32 or Int64 (if sizeof(int) == 8 then Int64))
  • unsigned long, long (published as Int64 or Int64 (if sizeof(int) == 8 then Int64))
  • unsigned long long, long long (published as Int64)
  • float (published as Float)
  • double (published as Float)

NOTE: long double is not guaranteed

String (String)

  • string

openframeworks basic types

Arithmetic[2]

  • ofVec2f (published as Float * 2)

Arithmetic[3]

  • ofVec3f (= ofPoint) (published as Float * 3)

Arithmetic[4]

  • ofVec4f (published as Float * 4)
  • ofColor (published as Int32 * 4)
  • ofShortColor (published as Int32 * 4)
  • ofFloatColor (published as Float * 4)
  • ofQuaternion (published as Float * 4)
  • ofRectangle (published as Float * 4)

Arithmetic[9]

  • ofMatrix3x3 (published as Float * 9)

Arithmetic[16]

  • ofMatrix4x4 (publish as Float * 16)

Blob

  • ofBuffer

ofParameter with supported types

  • ofParameter<SupportedType>

NOTE: we only support subscribing ofParameterGroup. See How to subscribe ofParameterGroup

array/vector of supported types

  • SupportedType[size]
  • vector<SupportedType>

if you use vector<SomeType> vec;, when vec will be resized every receiving OSC messages.

NOTE: do NOT use vector<vector<SupportedType>>, vector<SupportedType>[size]

Callback

Subscribe

  • std::function<R(Arguments ...)>;
  • std::function<R(ofxOscMessage &)>
  • pair of U &that, T (U::\*callback)(Arguments ...);
  • pair of U \*that, T (U::\*callback)(Arguments ...);

Arguments ... are all of types we can use in

Publish

  • std::function<T()>;
  • pair of U &that, T (U::\*callback)();
  • pair of U \*that, T (U::\*callback)();

Update history

2021/09/30 ver 0.3.3

  • fixed bug on ver 0.3.2 (issued by hanasaan. thanks!!!)

2021/09/26 ver 0.3.2 [Deprecated!!]

  • fixed constructor of ofxOscMessageEx
  • fixed some constness about notify, read

2020/04/15 ver 0.3.1

  • added ofxSubscribeAllOsc, ofxSubscribeAllOscForPort

2018/05/08 ver 0.3.0

  • refactor all for C++11
  • add ofxSendOsc
  • ofxSubscribeOsc got more flexible.
    • multi arguments
    • multi arguments callback
  • add ofxOscMessageEx

Older update histories

about Versioning

ofxPubSubOsc uses Mood Versioning. maybe, 1.0.0. will not come.

License

MIT License.

Author

  • ISHII 2bit [ISHII Tsuubito Program Office]
  • i[at]2bit.jp

Supporting Contributor

Special Thanks

At the last

Please create a new issue if there is a problem.

And please throw a pull request if you have a cool idea!!

If you get happy with using this addon, and you're rich, please donation for support continuous development.

Bitcoin: 17AbtW73aydfYH3epP8T3UDmmDCcXSGcaf

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].