bind OSC messages and values with only writing tiny codes on setup once.
easy utility for publish/subscribe OSC message.
std::function<void(ofxOscMessage &)>
! detail: API Reference
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);
}
};
API Reference is imperfect now.
bind a value to the argument(s) of OSC messages with an address pattern address incoming to port.
unbind from OSC messages with an address pattern address incoming to port.
unbind from OSC messages with any address patterns incoming to port.
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
.
unbind a publisher sending OSC message with an address pattern address to ip:port.
unbind all the publishers sending to ip:port.
register value as an OSC message with an address pattern address to ip:port. and publish when call ofxPublishRegisteredOsc(ip, port, address)
.
unregister OSC message with an address pattern address to ip:port.
unregister all the messages sending to ip:port.
NOTE: registable type is same to ofxPublishOsc
. see more ofxPublishOsc.
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
ofVec2f
(published as Float * 2)ofVec3f
(= ofPoint
) (published as Float * 3)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)ofMatrix3x3
(published as Float * 9)ofMatrix4x4
(publish as Float * 16)ofBuffer
ofParameter<SupportedType>
NOTE: we only support subscribing ofParameterGroup. See How to subscribe ofParameterGroup
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]
std::function<R(Arguments ...)>
;std::function<R(ofxOscMessage &)>
U &that
, T (U::\*callback)(Arguments ...)
;U \*that
, T (U::\*callback)(Arguments ...)
;Arguments ...
are all of types we can use in
std::function<T()>
;U &that
, T (U::\*callback)()
;U \*that
, T (U::\*callback)()
;ofxSendOsc
ofxOscMessageEx
ofxPubSubOsc uses Mood Versioning. maybe, 1.0.0. will not come.
MIT License.
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