Mercurial > hg > aimc
comparison external/oscpack/examples/SimpleSend.cpp @ 509:0284d2152e17
Add support for outputting featutes using OSC (for use with the Wekinator, etc).
author | tomwalters@google.com |
---|---|
date | Fri, 22 Jun 2012 12:22:08 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
508:d609725e568a | 509:0284d2152e17 |
---|---|
1 /* | |
2 Simple example of sending an OSC message using oscpack. | |
3 */ | |
4 | |
5 #include "osc/OscOutboundPacketStream.h" | |
6 #include "ip/UdpSocket.h" | |
7 | |
8 | |
9 #define ADDRESS "127.0.0.1" | |
10 #define PORT 7000 | |
11 | |
12 #define OUTPUT_BUFFER_SIZE 1024 | |
13 | |
14 int main(int argc, char* argv[]) | |
15 { | |
16 UdpTransmitSocket transmitSocket( IpEndpointName( ADDRESS, PORT ) ); | |
17 | |
18 char buffer[OUTPUT_BUFFER_SIZE]; | |
19 osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE ); | |
20 | |
21 p << osc::BeginBundleImmediate | |
22 << osc::BeginMessage( "/test1" ) | |
23 << true << 23 << (float)3.1415 << "hello" << osc::EndMessage | |
24 << osc::BeginMessage( "/test2" ) | |
25 << true << 24 << (float)10.8 << "world" << osc::EndMessage | |
26 << osc::EndBundle; | |
27 | |
28 transmitSocket.Send( p.Data(), p.Size() ); | |
29 } | |
30 |