diff options
author | Roman Haefeli <rdz@users.sourceforge.net> | 2011-02-01 21:48:30 +0000 |
---|---|---|
committer | Roman Haefeli <rdz@users.sourceforge.net> | 2011-02-01 21:48:30 +0000 |
commit | 27cfb330ca39c29f88e536b2ab19242b4554eb3c (patch) | |
tree | 3e8dee6c95db0855d9135762ced6fc0125acec95 | |
parent | ddef561c60dac4e9f268e8c43336184fc91ecc27 (diff) |
use SLIP as a container for OSC messages when transporting them over a stream oriented protocol (according to the OSC 1.1 specification)
svn path=/trunk/externals/mrpeach/; revision=14848
-rw-r--r-- | osc/packOSCstream.pd | 60 | ||||
-rw-r--r-- | osc/tcpsocket.OSC.pd | 334 | ||||
-rw-r--r-- | osc/unpackOSCstream.pd | 170 |
3 files changed, 113 insertions, 451 deletions
diff --git a/osc/packOSCstream.pd b/osc/packOSCstream.pd index 643669a..66e4e5e 100644 --- a/osc/packOSCstream.pd +++ b/osc/packOSCstream.pd @@ -1,48 +1,12 @@ -#N canvas 642 387 204 215 10;
-#X obj 9 76 list length;
-#X obj 9 56 t a a;
-#X obj 9 35 packOSC;
-#X obj 9 14 inlet;
-#X obj 9 139 outlet;
-#N canvas 377 271 261 279 float->MSB_2SB_3SB_LSB 0;
-#X obj 16 6 t a a;
-#X obj 16 42 >> 8;
-#X obj 184 164 mod 256;
-#X obj 16 62 t a a;
-#X obj 16 98 >> 8;
-#X obj 128 164 mod 256;
-#X obj 16 118 t a a;
-#X obj 16 144 >> 8;
-#X obj 72 164 mod 256;
-#X obj 16 164 mod 256;
-#X obj 16 214 pack f f f f;
-#X obj 16 -14 inlet;
-#X obj 16 238 outlet;
-#X connect 0 0 1 0;
-#X connect 0 1 2 0;
-#X connect 1 0 3 0;
-#X connect 2 0 10 3;
-#X connect 3 0 4 0;
-#X connect 3 1 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 10 2;
-#X connect 6 0 7 0;
-#X connect 6 1 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 10 1;
-#X connect 9 0 10 0;
-#X connect 10 0 12 0;
-#X connect 11 0 0 0;
-#X restore 9 97 pd float->MSB_2SB_3SB_LSB;
-#X text 36 157 Author: Roman Haefeli;
-#X obj 135 139 outlet;
-#X obj 9 118 list append;
-#X text 36 173 version: 2008-09-09;
-#X connect 0 0 5 0;
-#X connect 1 0 0 0;
-#X connect 1 1 8 1;
-#X connect 2 0 1 0;
-#X connect 2 1 7 0;
-#X connect 3 0 2 0;
-#X connect 5 0 8 0;
-#X connect 8 0 4 0;
+#N canvas 642 471 204 215 10; +#X obj 9 35 packOSC; +#X obj 9 14 inlet; +#X obj 9 139 outlet; +#X text 36 157 Author: Roman Haefeli; +#X obj 135 139 outlet; +#X obj 9 80 mrpeach/slipenc 65536; +#X text 36 173 version: 2011-02-01; +#X connect 0 0 5 0; +#X connect 0 1 4 0; +#X connect 1 0 0 0; +#X connect 5 0 2 0; diff --git a/osc/tcpsocket.OSC.pd b/osc/tcpsocket.OSC.pd index 1b838e3..f3e47da 100644 --- a/osc/tcpsocket.OSC.pd +++ b/osc/tcpsocket.OSC.pd @@ -1,245 +1,89 @@ -#N canvas 585 75 446 533 10;
-#X obj 50 49 == \$2;
-#X obj 7 28 route in socket;
-#X obj 7 76 spigot;
-#N canvas 622 183 512 335 reset 0;
-#X obj 23 41 route \$2;
-#X obj 23 63 route reset;
-#X obj 23 83 t b b;
-#X msg 55 170 done;
-#X obj 23 113 outlet;
-#X text 161 33 this is used to:;
-#X text 87 114 a) reset the sockethandler on a new connection;
-#X text 88 129 (for instance \, if the previous connection was quitted
-in the middle of a packet).;
-#X text 55 213 b) check for the socketserver \, if a sockethandler
-on specified socket already exists.;
-#X obj 55 191 s \$1.TCPSOCKET;
-#X obj 23 19 r \$1.TCPSOCKET;
-#X connect 0 0 1 0;
-#X connect 1 0 2 0;
-#X connect 2 0 4 0;
-#X connect 2 1 3 0;
-#X connect 3 0 9 0;
-#X connect 10 0 0 0;
-#X restore 40 102 pd reset;
-#X obj 104 280 route socket ip;
-#X obj 41 367 list append;
-#X obj 58 323 list append;
-#X obj 7 299 t a b b b;
-#X obj 7 414 list prepend out;
-#X obj 41 391 list prepend socket.out;
-#X obj 58 345 list prepend ip.out;
-#X obj 7 442 list trim;
-#X text 16 220 the lower part makes [tcpsocketserver] behave like [tcpserver]
-;
-#X obj -2 136 cnv 15 450 70 empty empty empty 20 12 0 14 -204786 -66577
-0;
-#X text 70 162 <- PUT HERE THE PROTOCOL SPECIFIC DELIMITER CODE;
-#X text 15 197 --------------------------------------------------------
-;
-#X text 13 129 --------------------------------------------------------
-;
-#X obj 7 6 r \$1.TCPSOCKET;
-#X obj 7 465 s \$1.TCPSOCKET;
-#X obj 104 256 r \$1.TCPSOCKET;
-#X text 200 454 Author: Roman Haefeli;
-#X text 55 75 <- only pass stream of own socket;
-#N canvas 395 78 268 176 OSC 0;
-#X obj 27 18 inlet;
-#X obj 27 156 outlet;
-#X obj 144 23 inlet;
-#X text 194 23 reset;
-#N canvas 820 354 408 355 parse_frameheader 0;
-#X obj 14 10 inlet;
-#X obj 14 304 outlet;
-#X obj 322 178 outlet;
-#X obj 134 228 list prepend;
-#X obj 230 228 t a;
-#X obj 14 43 list prepend 0;
-#X obj 14 123 f;
-#X obj 14 144 + 1;
-#X obj 14 166 sel 4;
-#X obj 14 99 t b a;
-#X obj 14 69 route 0 1;
-#X text 97 64 0 = frame header;
-#X text 97 80 1 = frame content;
-#X obj 14 187 t b b;
-#X obj 109 22 r \$0.route;
-#X obj 46 230 s \$0.route;
-#X msg 46 208 1;
-#X obj 14 261 list append;
-#X obj 243 18 inlet;
-#X obj 243 44 b;
-#X msg 272 45 0;
-#X obj 272 65 s \$0.route;
-#N canvas 504 266 169 262 MSB_2SB_3SB_LSB->float 0;
-#X obj 7 10 inlet;
-#X obj 7 214 outlet;
-#X obj 7 33 unpack f f f f;
-#X obj 70 74 << 8;
-#X obj 38 118 << 16;
-#X obj 7 165 << 24;
-#X obj 70 98 +;
-#X obj 38 139 +;
-#X obj 7 190 +;
-#X connect 0 0 2 0;
-#X connect 2 0 5 0;
-#X connect 2 1 4 0;
-#X connect 2 2 3 0;
-#X connect 2 3 6 1;
-#X connect 3 0 6 0;
-#X connect 4 0 7 0;
-#X connect 5 0 8 0;
-#X connect 6 0 7 1;
-#X connect 7 0 8 1;
-#X connect 8 0 1 0;
-#X restore 14 282 pd MSB_2SB_3SB_LSB->float;
-#X text 288 19 new packet;
-#X text 23 327 frame length;
-#X text 322 201 data stream;
-#X connect 0 0 5 0;
-#X connect 3 0 4 0;
-#X connect 3 0 17 1;
-#X connect 4 0 3 1;
-#X connect 5 0 10 0;
-#X connect 6 0 7 0;
-#X connect 7 0 6 1;
-#X connect 7 0 8 0;
-#X connect 8 0 13 0;
-#X connect 9 0 6 0;
-#X connect 9 1 3 0;
-#X connect 10 0 9 0;
-#X connect 10 1 2 0;
-#X connect 13 0 17 0;
-#X connect 13 1 16 0;
-#X connect 14 0 5 1;
-#X connect 16 0 15 0;
-#X connect 17 0 22 0;
-#X connect 18 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 3 1;
-#X connect 20 0 21 0;
-#X connect 20 0 6 1;
-#X connect 22 0 1 0;
-#X restore 27 77 pd parse_frameheader;
-#N canvas 748 498 450 300 form_packet 0;
-#X obj 68 23 inlet;
-#X text 106 24 length;
-#X obj 194 22 inlet;
-#X text 244 23 stream;
-#X obj 120 190 list prepend;
-#X obj 216 190 t a;
-#X obj 14 123 f;
-#X obj 14 144 + 1;
-#X obj 14 99 t b a;
-#X obj 14 187 t b b;
-#X obj 46 213 list append;
-#X obj 14 166 sel 0;
-#X obj 46 253 outlet;
-#X text 100 254 OSC packet;
-#X text 261 262 EOP;
-#X obj 210 261 outlet;
-#X obj 68 88 t b a;
-#X msg 68 111 0;
-#X connect 0 0 16 0;
-#X connect 2 0 8 0;
-#X connect 4 0 5 0;
-#X connect 4 0 10 1;
-#X connect 5 0 4 1;
-#X connect 6 0 7 0;
-#X connect 7 0 6 1;
-#X connect 7 0 11 0;
-#X connect 8 0 6 0;
-#X connect 8 1 4 0;
-#X connect 9 0 15 0;
-#X connect 9 1 10 0;
-#X connect 10 0 12 0;
-#X connect 11 0 9 0;
-#X connect 16 0 17 0;
-#X connect 16 0 4 1;
-#X connect 16 1 11 1;
-#X connect 17 0 6 1;
-#X restore 27 129 pd form_packet;
-#X obj 169 85 b;
-#X obj 144 50 b;
-#N canvas 389 242 191 341 serialize 0;
-#X obj 5 100 t a a;
-#X obj 37 122 list prepend 0;
-#X obj 37 143 s \$0.inbuffer;
-#X obj 5 174 list length;
-#X obj 5 218 until;
-#X obj 5 195 t a b;
-#X obj 5 241 f;
-#X obj 50 244 + 1;
-#X msg 49 218 0;
-#X obj 5 267 tabread \$0.inbuffer;
-#X obj 5 50 inlet;
-#X obj 5 289 outlet;
-#N canvas 294 258 396 232 list_serialize_raw 0;
-#X obj 13 73 until;
-#X obj 13 97 list append;
-#X obj 13 47 t b a;
-#X obj 13 23 inlet;
-#X obj 13 169 outlet;
-#X obj 156 122 b;
-#X text 12 190 cut incoming list into pieces of a maximum of the buffersize.
-;
-#X obj 13 121 list split 65536;
-#X connect 0 0 1 0;
-#X connect 1 0 7 0;
-#X connect 2 0 0 0;
-#X connect 2 1 1 1;
-#X connect 3 0 2 0;
-#X connect 5 0 0 1;
-#X connect 7 0 4 0;
-#X connect 7 1 1 1;
-#X connect 7 2 5 0;
-#X connect 7 2 4 0;
-#X restore 5 74 pd list_serialize_raw;
-#X obj 5 12 table \$0.inbuffer 65536;
-#X connect 0 0 3 0;
-#X connect 0 1 1 0;
-#X connect 1 0 2 0;
-#X connect 3 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 4 0;
-#X connect 5 1 8 0;
-#X connect 6 0 7 0;
-#X connect 6 0 9 0;
-#X connect 7 0 6 1;
-#X connect 8 0 6 1;
-#X connect 9 0 11 0;
-#X connect 10 0 12 0;
-#X connect 12 0 0 0;
-#X restore 27 45 pd serialize;
-#X connect 0 0 8 0;
-#X connect 2 0 7 0;
-#X connect 4 0 5 0;
-#X connect 4 1 5 1;
-#X connect 5 0 1 0;
-#X connect 5 1 6 0;
-#X connect 6 0 4 1;
-#X connect 7 0 4 1;
-#X connect 8 0 4 0;
-#X restore 7 161 pd OSC;
-#X text 201 474 Version: 2009-02-02;
-#X connect 0 0 2 1;
-#X connect 1 0 2 0;
-#X connect 1 1 0 0;
-#X connect 2 0 22 0;
-#X connect 3 0 22 1;
-#X connect 4 0 5 1;
-#X connect 4 1 6 1;
-#X connect 5 0 9 0;
-#X connect 6 0 10 0;
-#X connect 7 0 8 0;
-#X connect 7 2 5 0;
-#X connect 7 3 6 0;
-#X connect 8 0 11 0;
-#X connect 9 0 11 0;
-#X connect 10 0 11 0;
-#X connect 11 0 18 0;
-#X connect 17 0 1 0;
-#X connect 19 0 4 0;
-#X connect 22 0 7 0;
+#N canvas 636 71 455 534 10; +#X obj 50 49 == \$2; +#X obj 7 28 route in socket; +#X obj 7 76 spigot; +#N canvas 622 183 512 335 reset 0; +#X obj 23 41 route \$2; +#X obj 23 63 route reset; +#X obj 23 83 t b b; +#X msg 55 170 done; +#X obj 23 113 outlet; +#X text 161 33 this is used to:; +#X text 87 114 a) reset the sockethandler on a new connection; +#X text 88 129 (for instance \, if the previous connection was quitted +in the middle of a packet).; +#X text 55 213 b) check for the socketserver \, if a sockethandler +on specified socket already exists.; +#X obj 55 191 s \$1.TCPSOCKET; +#X obj 23 19 r \$1.TCPSOCKET; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 2 0 4 0; +#X connect 2 1 3 0; +#X connect 3 0 9 0; +#X connect 10 0 0 0; +#X restore 40 102 pd reset; +#X obj 104 280 route socket ip; +#X obj 41 367 list append; +#X obj 58 323 list append; +#X obj 7 299 t a b b b; +#X obj 7 414 list prepend out; +#X obj 41 391 list prepend socket.out; +#X obj 58 345 list prepend ip.out; +#X obj 7 442 list trim; +#X text 16 220 the lower part makes [tcpsocketserver] behave like [tcpserver] +; +#X obj -2 136 cnv 15 450 70 empty empty empty 20 12 0 14 -204786 -66577 +0; +#X text 70 162 <- PUT HERE THE PROTOCOL SPECIFIC DELIMITER CODE; +#X text 15 197 -------------------------------------------------------- +; +#X text 13 129 -------------------------------------------------------- +; +#X obj 7 6 r \$1.TCPSOCKET; +#X obj 7 465 s \$1.TCPSOCKET; +#X obj 104 256 r \$1.TCPSOCKET; +#X text 200 454 Author: Roman Haefeli; +#X text 55 75 <- only pass stream of own socket; +#N canvas 389 116 266 236 OSC 0; +#X obj 27 18 inlet; +#X obj 27 186 outlet; +#X obj 144 23 inlet; +#X text 194 23 reset; +#X obj 27 123 mrpeach/slipdec 16384; +#X obj 27 151 spigot 1; +#X obj 144 45 t b b b; +#X msg 163 67 192 192; +#X msg 183 99 0; +#X msg 144 100 1; +#X connect 0 0 4 0; +#X connect 2 0 6 0; +#X connect 4 0 5 0; +#X connect 5 0 1 0; +#X connect 6 0 9 0; +#X connect 6 1 7 0; +#X connect 6 2 8 0; +#X connect 7 0 4 0; +#X connect 8 0 5 1; +#X connect 9 0 5 1; +#X restore 7 161 pd OSC; +#X text 201 474 Version: 2011-01-05; +#X connect 0 0 2 1; +#X connect 1 0 2 0; +#X connect 1 1 0 0; +#X connect 2 0 22 0; +#X connect 3 0 22 1; +#X connect 4 0 5 1; +#X connect 4 1 6 1; +#X connect 5 0 9 0; +#X connect 6 0 10 0; +#X connect 7 0 8 0; +#X connect 7 2 5 0; +#X connect 7 3 6 0; +#X connect 8 0 11 0; +#X connect 9 0 11 0; +#X connect 10 0 11 0; +#X connect 11 0 18 0; +#X connect 17 0 1 0; +#X connect 19 0 4 0; +#X connect 22 0 7 0; diff --git a/osc/unpackOSCstream.pd b/osc/unpackOSCstream.pd index 55fb2e1..8599920 100644 --- a/osc/unpackOSCstream.pd +++ b/osc/unpackOSCstream.pd @@ -1,158 +1,12 @@ -#N canvas 693 326 361 208 10;
-#X obj 9 7 inlet;
-#N canvas 258 171 365 268 drip 0;
-#X obj 12 15 inlet;
-#X obj 12 215 outlet;
-#X obj 59 15 table \$0.buffer 65536;
-#X obj 39 82 s \$0.buffer;
-#X obj 39 61 list prepend 0;
-#X obj 12 37 t a a;
-#X text 10 233 this 'drip' approach might use more memory \, but hopefully
-less cpu cycles.;
-#X obj 12 102 list length;
-#X obj 12 147 until;
-#X obj 12 123 t a b;
-#X obj 12 170 f;
-#X obj 44 170 + 1;
-#X msg 62 147 0;
-#X obj 12 192 tabread \$0.buffer;
-#X connect 0 0 5 0;
-#X connect 4 0 3 0;
-#X connect 5 0 7 0;
-#X connect 5 1 4 0;
-#X connect 7 0 9 0;
-#X connect 8 0 10 0;
-#X connect 9 0 8 0;
-#X connect 9 1 12 0;
-#X connect 10 0 11 0;
-#X connect 10 0 13 0;
-#X connect 11 0 10 1;
-#X connect 12 0 10 1;
-#X connect 13 0 1 0;
-#X restore 9 34 pd drip;
-#N canvas 161 546 414 355 parse_frameheader 0;
-#X obj 14 10 inlet;
-#X obj 14 304 outlet;
-#X obj 257 304 outlet;
-#X obj 77 152 list prepend;
-#X obj 146 100 t a;
-#X obj 14 43 list prepend 0;
-#X obj 14 123 f;
-#X obj 14 144 + 1;
-#X obj 14 166 sel 4;
-#X obj 14 99 t b a;
-#X obj 14 69 route 0 1;
-#X text 97 64 0 = frame header;
-#X text 97 80 1 = frame content;
-#X obj 14 187 t b b;
-#X obj 95 21 r \$0.route;
-#X obj 46 230 s \$0.route;
-#X msg 46 208 1;
-#X obj 14 261 list append;
-#X obj 237 10 inlet;
-#X obj 237 44 b;
-#X msg 316 106 0;
-#X obj 316 126 s \$0.route;
-#N canvas 504 266 169 262 MSB_2SB_3SB_LSB->float 0;
-#X obj 7 10 inlet;
-#X obj 7 214 outlet;
-#X obj 7 33 unpack f f f f;
-#X obj 70 74 << 8;
-#X obj 38 118 << 16;
-#X obj 7 165 << 24;
-#X obj 70 98 +;
-#X obj 38 139 +;
-#X obj 7 190 +;
-#X connect 0 0 2 0;
-#X connect 2 0 5 0;
-#X connect 2 1 4 0;
-#X connect 2 2 3 0;
-#X connect 2 3 6 1;
-#X connect 3 0 6 0;
-#X connect 4 0 7 0;
-#X connect 5 0 8 0;
-#X connect 6 0 7 1;
-#X connect 7 0 8 1;
-#X connect 8 0 1 0;
-#X restore 14 283 pd MSB_2SB_3SB_LSB->float;
-#X text 282 14 new packet;
-#X text 13 321 frame length;
-#X text 255 321 data stream;
-#X connect 0 0 5 0;
-#X connect 3 0 4 0;
-#X connect 3 0 17 1;
-#X connect 4 0 3 1;
-#X connect 5 0 10 0;
-#X connect 6 0 7 0;
-#X connect 7 0 6 1;
-#X connect 7 0 8 0;
-#X connect 8 0 13 0;
-#X connect 9 0 6 0;
-#X connect 9 1 3 0;
-#X connect 10 0 9 0;
-#X connect 10 1 2 0;
-#X connect 13 0 17 0;
-#X connect 13 1 16 0;
-#X connect 14 0 5 1;
-#X connect 16 0 15 0;
-#X connect 17 0 22 0;
-#X connect 18 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 3 1;
-#X connect 20 0 21 0;
-#X connect 20 0 6 1;
-#X connect 22 0 1 0;
-#X restore 9 58 pd parse_frameheader;
-#N canvas 618 581 423 324 form_packet 0;
-#X obj -256 -183 inlet;
-#X text -259 -166 length;
-#X obj -200 -183 inlet;
-#X text -203 -167 stream;
-#X obj -193 -17 list prepend;
-#X obj -124 -69 t a;
-#X obj -255 -63 f;
-#X obj -255 -42 + 1;
-#X obj -255 -111 t b a;
-#X obj -255 1 t b b;
-#X obj -256 46 list append;
-#X obj -255 -20 sel 0;
-#X obj -256 79 outlet;
-#X text -321 78 OSC packet;
-#X text -152 78 EOP;
-#X obj -194 79 outlet;
-#X obj -201 -111 t b a;
-#X msg -201 -80 0;
-#X connect 0 0 16 0;
-#X connect 2 0 8 0;
-#X connect 4 0 5 0;
-#X connect 4 0 10 1;
-#X connect 5 0 4 1;
-#X connect 6 0 7 0;
-#X connect 7 0 6 1;
-#X connect 7 0 11 0;
-#X connect 8 0 6 0;
-#X connect 8 1 4 0;
-#X connect 9 0 15 0;
-#X connect 9 1 10 0;
-#X connect 10 0 12 0;
-#X connect 11 0 9 0;
-#X connect 16 0 17 0;
-#X connect 16 0 4 1;
-#X connect 16 1 11 1;
-#X connect 17 0 6 1;
-#X restore 9 111 pd form_packet;
-#X obj 161 57 b;
-#X obj 9 135 unpackOSC;
-#X obj 9 158 outlet;
-#X obj 60 158 outlet;
-#X text 172 144 Author: Roman Haefeli;
-#X text 172 160 Version: 2008-09-09;
-#X connect 0 0 1 0;
-#X connect 1 0 2 0;
-#X connect 2 0 3 0;
-#X connect 2 1 3 1;
-#X connect 3 0 5 0;
-#X connect 3 1 4 0;
-#X connect 4 0 2 1;
-#X connect 5 0 6 0;
-#X connect 5 1 7 0;
+#N canvas 693 326 361 208 10; +#X obj 9 7 inlet; +#X obj 9 135 unpackOSC; +#X obj 9 158 outlet; +#X obj 60 158 outlet; +#X text 172 144 Author: Roman Haefeli; +#X text 172 160 Version: 2011-02-01; +#X obj 9 71 mrpeach/slipdec 65536; +#X connect 0 0 6 0; +#X connect 1 0 2 0; +#X connect 1 1 3 0; +#X connect 6 0 1 0; |