From 082c5105433d0ee677f3484e02cdf4280da1fa14 Mon Sep 17 00:00:00 2001 From: Martin Peach Date: Tue, 16 Sep 2008 21:05:52 +0000 Subject: Adding Roman Haefili's abstractions to enable OSC over streaming connections like TCP and serial. svn path=/trunk/externals/mrpeach/; revision=10291 --- osc/packOSCstream-help.pd | 44 ++++++++++++ osc/packOSCstream.pd | 48 ++++++++++++++ osc/unpackOSCstream-help.pd | 26 ++++++++ osc/unpackOSCstream.pd | 158 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 276 insertions(+) create mode 100644 osc/packOSCstream-help.pd create mode 100644 osc/packOSCstream.pd create mode 100644 osc/unpackOSCstream-help.pd create mode 100644 osc/unpackOSCstream.pd (limited to 'osc') diff --git a/osc/packOSCstream-help.pd b/osc/packOSCstream-help.pd new file mode 100644 index 0000000..5eb35a3 --- /dev/null +++ b/osc/packOSCstream-help.pd @@ -0,0 +1,44 @@ +#N canvas 387 330 609 543 10; +#X obj 69 119 packOSCstream; +#X obj 69 451 tcpsend; +#X text -24 496 check also:; +#X obj -22 513 unpackOSCstream; +#X obj 93 513 packOSC; +#X msg 38 403 connect localhost 9995; +#X obj 208 513 tcpreceive; +#X obj 151 513 tcpsend; +#X obj 286 513 tcpserver; +#X obj 357 513 tcpclient; +#X msg 58 423 disconnect; +#X obj 69 473 tgl 15 0 empty empty empty 17 7 0 10 -4034 -257985 -1 +0 1; +#X obj 181 403 cnv 15 380 30 empty empty empty 20 12 0 14 -24198 -66577 +0; +#X text 196 408 <- First open unpackOSCstream-help \, then connect +; +#X text 440 501 Author: Roman Haefeli; +#X text 440 517 Version: 2008-09-09; +#X text 74 254 [packOSCstream] uses the same methods as [packOSC]. +Please consult packOSC-help.pd for the complete documentation.; +#X text 75 189 [packOSstream] puts a frame length header (int32) in +front of every OSC packet or bundle \, so that the receiving side knows +\, how to split the incoming stream into OSC packets again.; +#X msg -24 9 /first/message 1 \, /second/message 2; +#X text 79 330 reference:; +#X text 80 347 http://archive.cnmat.berkeley.edu/OpenSoundControl/OSC-spec.html +: Section "OSC Packets"; +#X msg -4 29 send /test/one/two/three zz 88 T; +#X msg 16 49 sendtyped /test/one/two/three sis zz 88 T; +#X msg 36 69 prefix /test; +#X msg 56 89 [ \, /previous/page 666 \, /next/page 999 \, ]; +#X text 72 142 [packOSCstream] is meant to be a replacement for [packOSC] +\, when sending over a stream based protocol \, such as TCP.; +#X connect 0 0 1 0; +#X connect 1 0 11 0; +#X connect 5 0 1 0; +#X connect 10 0 1 0; +#X connect 18 0 0 0; +#X connect 21 0 0 0; +#X connect 22 0 0 0; +#X connect 23 0 0 0; +#X connect 24 0 0 0; diff --git a/osc/packOSCstream.pd b/osc/packOSCstream.pd new file mode 100644 index 0000000..643669a --- /dev/null +++ b/osc/packOSCstream.pd @@ -0,0 +1,48 @@ +#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; diff --git a/osc/unpackOSCstream-help.pd b/osc/unpackOSCstream-help.pd new file mode 100644 index 0000000..54956fc --- /dev/null +++ b/osc/unpackOSCstream-help.pd @@ -0,0 +1,26 @@ +#N canvas 475 374 638 435 10; +#X text 8 369 check also:; +#X obj 240 386 tcpreceive; +#X obj 183 386 tcpsend; +#X obj 318 386 tcpserver; +#X obj 389 386 tcpclient; +#X text 472 374 Author: Roman Haefeli; +#X text 472 390 Version: 2008-09-09; +#X text 158 65 [unpackOSCstream] is meant to be a replacement for [unpackOSC] +\, when receiving from a stream based protocol \, such as TCP.; +#X obj 18 197 unpackOSCstream; +#X obj 18 17 tcpreceive 9995; +#X obj 18 222 print; +#X floatatom 105 221 5 0 0 0 - - -; +#X text 159 283 reference:; +#X obj 10 386 packOSCstream; +#X obj 110 386 unpackOSC; +#X text 160 300 http://archive.cnmat.berkeley.edu/OpenSoundControl/OSC-spec.html +: Section "OSC Packets"; +#X text 141 221 milliseconds delay; +#X text 158 119 [unpackOSCstream] will only be able to decode OSC packets +or bundles created by [packOSCstream]. OSC packets that were generated +by [packOSC] will cause errors or wrong output.; +#X connect 8 0 10 0; +#X connect 8 1 11 0; +#X connect 9 0 8 0; diff --git a/osc/unpackOSCstream.pd b/osc/unpackOSCstream.pd new file mode 100644 index 0000000..55fb2e1 --- /dev/null +++ b/osc/unpackOSCstream.pd @@ -0,0 +1,158 @@ +#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; -- cgit v1.2.1