i wanna send with send("/address", foo, bar, buzz)
this addon uses C++11, require of0.9.0~
if you use master branch and causes an error, please pull latest commit.
- ofxOsc
- void send(const std::string &address, const Args & ... args);
Args: arithmetic type,string,ofBuffer
default mode is use sendAsSimpleFormat.
you can change to use sendAsStrictFormat with setUsingStrictFormat(true);.
- void sendAsSimpleFormat(const std::string &address, const Args & ... args);
send arithmetic type as following mapping.
| arg type | osc type |
|---|---|
| integral | int32 |
| floating points | float |
- void sendAsStrictFormat(const std::string &address, const Args & ... args);
send arithmetic type as following mapping.
| arg type | osc type |
|---|---|
| bool | bool |
| char | char |
| unsigned char | int32 |
| short | int32 |
| unsigned short | int32 |
| int | int32 |
| unsigned int | int64 |
| long | int64 |
| unsigned long | int64 |
| long long | int64 |
| unsigned long long | int64 |
| float | float |
| double | double |
- ofxSimpleOscSender &operator<<(Type t)
add osc argument that allowed type.
argument follows rule as strict/simple mapping is gave by setUsingStrictFormat.
- ofxSimpleOscSender &operator<<(Terminator &t)
only allow bbb::send.
ofxOscSender sender;
...
sender("/address") << 1 << 2 << bbb::send;
sender << 1 << 2 << bbb::send("/address"); // same as above!
sender("/hogehoge") << 1 << 2 << bbb::send("/address"); // overwrite address with argument of send. so, same as above!- void setUsingStrictFormat(bool bStrict);
- bool getUsingStrictFormat() const;
default is false.
if you want to use OSC with Cycling'74 Max, you should be use setUsingStrictFormat(false) (so it is default!).
- void setSendingWithWrapInBundle(bool wrapInBundle);
- bool getSendingWithWrapInBundle() const;
default is true.
- and all
ofxOscSender's public method
-
void addTarget(const std::string &host, int port);
-
void removeTarget(const std::string &host, int port);
-
and all
ofxSmartOscSender's public method
you can extend with
using namespace bbb::ofxOscMessageStreamOperators;
using namespace bbb::ofxOscMessageStrictStreamOperators;
using namespace bbb::ofxOscMessageSimpleStreamOperators;ofxOscMessageStreamOperators is alias of ofxOscMessageSimpleStreamOperators.
if you want to use OSC with Cycling'74 Max, you should be use ofxOscMessageSimpleStreamOperators
ofxOscMessage m;
m.setAddress("/address");
m << 1 << "hoge" << 14.0f;
// means:
// m.addInt32Arg(1);
// m.addString("hoge");
// m.addFloatArg(14.0f);see: ofxOscMessageStreamOperator.h
you will get ofLogNotice() << m; with #include "ofxOscMessageOstreamExtention.h"
ofxOscMessageInputStream(m) >> x >> y >> str;
oscin(m) >> x >> y >> str; // same aboveor
oscin in(m);
in >> x;
in >> y;
in >> str;- fix problem: duprecated symbol
- fix simple mistake about README. omg...
- add
ofxOscMessageInputStream.h
- add
ofxOscMessageOstreamExtention.h
- fix wrong namespace alias
- add stream operator for ofxSimpleOscSender/ofxMultiOscSender
- tiny bugifxes
- renamed from
ofxSimpleOscSender(suggested from yusuketomoto) - add
set/getUsingStrictFormat,set/getSendingWithWrapInBundle - extend
operator<<forofxOscMessagein ofxOscMessageStreamOperator.h. (idea from satoruhiga) - add example
- initial
MIT License.
- 2bit [ISHII 2bit Program Office]
- github[at]2bit.jp
Please create a new issue if there is a problem. And please throw a pull request if you have a cool idea!!