From a86d36109abcdf80b6cb69d81ec07b14fecc5e1e Mon Sep 17 00:00:00 2001 From: "N.N." Date: Thu, 8 Nov 2012 09:39:23 +0000 Subject: share_mem : updating examples svn path=/trunk/externals/share_mem/; revision=16529 --- examples/1.basic_example.pd | 7 ++-- examples/3.syncro_jitter-subprocess.pd | 45 +++++++-------------- examples/3.syncro_jitter.pd | 56 ++++++++++++++------------ examples/4.table_fifo-subprocess.pd | 72 +++++++++++++--------------------- examples/4.table_fifo.pd | 60 +++++++++++++++++----------- 5 files changed, 115 insertions(+), 125 deletions(-) diff --git a/examples/1.basic_example.pd b/examples/1.basic_example.pd index dbb00dc..d33e60e 100644 --- a/examples/1.basic_example.pd +++ b/examples/1.basic_example.pd @@ -1,8 +1,8 @@ -#N canvas 557 101 630 649 10; +#N canvas 210 97 630 649 10; #X declare -path ..; #N canvas 0 22 450 300 (subpatch) 0; #X array data 100 float 2; -#X coords 0 1 99 -1 200 140 1 0 0; +#X coords 0 1 99 -1 200 140 1; #X restore 28 269 graph; #X text 30 23 Basic sharing of memory data between two pd instances ; @@ -18,7 +18,7 @@ #X obj 373 134 loadbang; #N canvas 0 22 450 300 (subpatch) 0; #X array data2 100 float 2; -#X coords 0 1 99 -1 200 140 1 0 0; +#X coords 0 1 99 -1 200 140 1; #X restore 29 479 graph; #X text 26 236 change this table \, see it moving in the subprocess ; @@ -27,6 +27,7 @@ #X msg 373 194 memset 0 data \, memdump 100 data2; #X obj 373 218 shmem 1001 200; #X obj 29 202 pd~ -ninsig 0 -noutsig 0 -fifo 20; +#X text 432 177 refresh rate; #X connect 2 0 16 0; #X connect 3 0 4 0; #X connect 7 0 16 0; diff --git a/examples/3.syncro_jitter-subprocess.pd b/examples/3.syncro_jitter-subprocess.pd index 4790a52..cc87632 100644 --- a/examples/3.syncro_jitter-subprocess.pd +++ b/examples/3.syncro_jitter-subprocess.pd @@ -1,47 +1,32 @@ -#N canvas 1151 120 649 457 10; +#N canvas 631 120 649 457 10; #X declare -path ..; #N canvas 0 22 450 300 (subpatch) 0; #X array data2 100 float 2; -#X coords 0 1 99 -1 200 140 1 0 0; -#X restore 307 39 graph; +#X coords 0 1 99 -1 200 140 1; +#X restore 359 33 graph; #X obj 313 223 loadbang; #X msg 313 244 \; pd dsp 1; #X text 170 335 writing to the shared memory; #X obj 67 356 shmem 1003 100; #X msg 67 336 memset 0 data2; #X obj 66 16 declare -path ..; -#X obj 118 90 f; -#X obj 118 111 + 1; -#X obj 118 129 % 100; -#X obj 118 151 / 100; -#X msg 84 183 100; -#X obj 84 203 until; -#X obj 84 225 f; -#X obj 113 226 + 1; -#X msg 169 163 0; -#X obj 67 70 t b b b b; -#X obj 103 276 f; -#X obj 84 246 t b f; -#X obj 103 297 tabwrite data2; +#X obj 94 92 f; +#X obj 94 113 + 1; +#X obj 94 131 % 100; +#X obj 94 153 / 100; #X obj 67 50 r metro; +#X msg 94 178 const \$1; +#X obj 94 199 s data2; +#X obj 67 70 t b b; +#X text 158 180 evolving content of data2; #X connect 1 0 2 0; #X connect 5 0 4 0; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 9 0 7 1; -#X connect 10 0 17 1; -#X connect 11 0 12 0; +#X connect 10 0 12 0; +#X connect 11 0 14 0; #X connect 12 0 13 0; -#X connect 13 0 14 0; -#X connect 13 0 18 0; -#X connect 14 0 13 1; -#X connect 15 0 13 1; -#X connect 16 0 5 0; -#X connect 16 1 11 0; -#X connect 16 2 15 0; -#X connect 16 3 7 0; -#X connect 17 0 19 0; -#X connect 18 0 17 0; -#X connect 18 1 19 1; -#X connect 20 0 16 0; +#X connect 14 0 5 0; +#X connect 14 1 7 0; diff --git a/examples/3.syncro_jitter.pd b/examples/3.syncro_jitter.pd index b6cf277..88b325b 100644 --- a/examples/3.syncro_jitter.pd +++ b/examples/3.syncro_jitter.pd @@ -3,7 +3,7 @@ #N canvas 0 22 450 300 (subpatch) 0; #X array data 100 float 2; #X coords 0 1 99 -1 200 140 1; -#X restore 488 162 graph; +#X restore 374 160 graph; #X text 30 23 Basic sharing of memory data between two pd instances ; #X msg 48 160 pd~ stop; @@ -14,57 +14,61 @@ #X obj 39 52 declare -path ..; #X obj 104 215 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; -#X obj 232 351 t f f; -#X obj 259 376 ==; -#X obj 259 396 sel 1; +#X obj 275 355 t f f; +#X obj 302 380 ==; +#X obj 302 400 sel 1; #X obj 104 194 loadbang; -#X obj 205 331 sel 0; +#X obj 248 335 sel 0; #X msg 29 138 pd~ start 3.syncro_jitter-subprocess.pd; #X obj 513 79 loadbang; #X msg 513 98 memclear; #X obj 513 117 shmem 1003 100; -#X msg 43 483 metro bang; +#X msg 131 483 metro bang; #X obj 29 510 pd~ -ninsig 0 -noutsig 0 -fifo 50; #X obj 104 257 t b b; -#X msg 104 280 memread 0; #X obj 104 327 t f b; -#X obj 104 445 tabwrite data; -#X obj 179 375 f; -#X obj 179 396 + 1; -#X obj 179 418 % 100; +#X obj 227 375 f; +#X obj 227 396 + 1; +#X obj 227 418 % 100; #X floatatom 167 210 5 0 100 0 - - -; #X text 426 359 It is not due to syncronisation jitter between pd and pd~ \, (specially since metro is fast and round trip buffer is high). ; #X text 208 210 change this value; #X obj 104 234 metro 3; +#X obj 302 422 print synchro_error; +#N canvas 0 22 450 300 (subpatch) 0; +#X array data_history 100 float 2; +#X coords 0 1 99 -1 200 140 1; +#X restore 580 160 graph; +#X obj 104 445 tabwrite data_history; #X text 426 315 At metro rate \, the first value of the shared memory -is read and written in the table. After 100 values \, the displayed -table should be constant; -#X obj 259 418 print synchro_error; +is read and written in the table. After 100 values \, "data_history" +should be constant.; +#X msg 104 280 memdump 0 data \, memread 0; #X connect 2 0 19 0; -#X connect 3 0 22 0; +#X connect 3 0 21 0; #X connect 3 0 13 0; #X connect 4 0 5 0; -#X connect 8 0 30 0; +#X connect 8 0 28 0; #X connect 9 0 10 1; #X connect 9 1 10 0; #X connect 10 0 11 0; -#X connect 11 0 32 0; +#X connect 11 0 29 0; #X connect 12 0 8 0; #X connect 13 1 9 0; #X connect 14 0 19 0; #X connect 15 0 16 0; #X connect 16 0 17 0; #X connect 18 0 19 0; -#X connect 20 0 21 0; +#X connect 20 0 33 0; #X connect 20 1 18 0; -#X connect 21 0 3 0; +#X connect 21 0 31 0; +#X connect 21 1 22 0; #X connect 22 0 23 0; -#X connect 22 1 24 0; -#X connect 24 0 25 0; -#X connect 25 0 26 0; -#X connect 26 0 24 1; -#X connect 26 0 23 1; -#X connect 27 0 30 1; -#X connect 30 0 20 0; +#X connect 23 0 24 0; +#X connect 24 0 22 1; +#X connect 24 0 31 1; +#X connect 25 0 28 1; +#X connect 28 0 20 0; +#X connect 33 0 3 0; diff --git a/examples/4.table_fifo-subprocess.pd b/examples/4.table_fifo-subprocess.pd index 7fd31f8..91c020b 100644 --- a/examples/4.table_fifo-subprocess.pd +++ b/examples/4.table_fifo-subprocess.pd @@ -1,64 +1,48 @@ -#N canvas 854 303 573 611 10; +#N canvas 610 111 536 478 10; #X declare -path ..; #N canvas 0 22 450 300 (subpatch) 0; #X array data2 100 float 2; -#X coords 0 1 99 -1 200 140 1 0 0; +#X coords 0 1 99 -1 200 140 1; #X restore 307 39 graph; #X obj 313 223 loadbang; #X msg 313 244 \; pd dsp 1; -#X text 212 458 writing to the shared memory; +#X text 197 328 writing to the shared memory; #X obj 66 16 declare -path ..; #X obj 118 130 f; #X obj 118 151 + 1; #X obj 118 169 % 100; #X obj 118 191 / 100; -#X msg 84 223 100; -#X obj 84 243 until; -#X obj 84 265 f; -#X obj 113 266 + 1; -#X msg 169 203 0; -#X obj 67 110 t b b b b; -#X obj 103 316 f; -#X obj 84 286 t b f; -#X obj 103 337 tabwrite data2; -#X obj 67 352 f; -#X obj 67 372 + 1; -#X obj 82 393 % 25; -#X msg 109 459 memset \$1 data2; -#X obj 109 435 * 100; -#X obj 109 479 shmem 1004 2500; -#X obj 82 414 t f f; -#X msg 82 510 syncro \$1; +#X obj 67 222 f; +#X obj 67 242 + 1; +#X obj 67 263 % 25; +#X msg 94 329 memset \$1 data2; +#X obj 94 305 * 100; +#X obj 94 349 shmem 1004 2500; +#X obj 67 284 t f f; +#X msg 67 380 syncro \$1; #X obj 67 72 loadbang; -#X obj 82 530 stdout; +#X obj 67 400 stdout; #X obj 67 91 metro 5; +#X msg 118 220 const \$1; +#X obj 118 244 s data2; +#X obj 67 110 t b b; #X connect 1 0 2 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 7 0 5 1; -#X connect 8 0 15 1; +#X connect 8 0 20 0; #X connect 9 0 10 0; #X connect 10 0 11 0; -#X connect 11 0 12 0; -#X connect 11 0 16 0; -#X connect 12 0 11 1; -#X connect 13 0 11 1; -#X connect 14 0 18 0; -#X connect 14 1 9 0; -#X connect 14 2 13 0; -#X connect 14 3 5 0; -#X connect 15 0 17 0; -#X connect 16 0 15 0; -#X connect 16 1 17 1; -#X connect 18 0 19 0; -#X connect 19 0 20 0; -#X connect 20 0 18 1; -#X connect 20 0 24 0; -#X connect 21 0 23 0; -#X connect 22 0 21 0; -#X connect 24 0 25 0; -#X connect 24 1 22 0; -#X connect 25 0 27 0; -#X connect 26 0 28 0; -#X connect 28 0 14 0; +#X connect 11 0 9 1; +#X connect 11 0 15 0; +#X connect 12 0 14 0; +#X connect 13 0 12 0; +#X connect 15 0 16 0; +#X connect 15 1 13 0; +#X connect 16 0 18 0; +#X connect 17 0 19 0; +#X connect 19 0 22 0; +#X connect 20 0 21 0; +#X connect 22 0 9 0; +#X connect 22 1 5 0; diff --git a/examples/4.table_fifo.pd b/examples/4.table_fifo.pd index 5298a14..edf331b 100644 --- a/examples/4.table_fifo.pd +++ b/examples/4.table_fifo.pd @@ -1,9 +1,9 @@ -#N canvas 229 287 614 675 10; +#N canvas 105 79 843 675 10; #X declare -path ..; #N canvas 0 22 450 300 (subpatch) 0; #X array data 100 float 2; -#X coords 0 1 99 -1 200 140 1 0 0; -#X restore 372 333 graph; +#X coords 0 1 99 -1 200 140 1; +#X restore 304 227 graph; #X text 30 23 Basic sharing of memory data between two pd instances ; #X msg 44 306 pd~ stop; @@ -11,16 +11,11 @@ #X msg 512 41 \; pd dsp 1; #X text 29 260 launch subprocess; #X obj 39 52 declare -path ..; -#X obj 54 473 t f f; -#X obj 81 498 ==; -#X obj 81 518 sel 1; -#X obj 81 540 print erreur de syncro; -#X obj 27 453 sel 0; -#X text 30 81 in order to share quicklly updated table \, in a syncronised -way \, we need a data fifo; -#X text 30 113 only the index of the wrinting position is passed throw -stdout of the pd~ \, in order to keep data syncronisation; -#X text 134 509 thanks to the fifo \, there are no more syncronisation +#X obj 212 499 t f f; +#X obj 239 524 ==; +#X obj 239 544 sel 1; +#X obj 185 479 sel 0; +#X text 315 383 thanks to the fifo \, there are no more syncronisation problem; #X text 30 165 Round trip fifo is set to 50 blocs (72ms at 44.1KHz) ; @@ -28,21 +23,42 @@ problem; = 25 bang; #X text 28 208 So \, lets use a memory size of 2500; #X obj 27 434 shmem 1004 2500; -#X msg 27 413 memdump \$1 data; #X msg 27 279 pd~ start 4.table_fifo-subprocess.pd; #X obj 27 374 route syncro; #X obj 27 394 * 100; #X obj 27 353 pd~ -ninsig 0 -noutsig 0 -fifo 50; -#X connect 2 0 23 0; +#X obj 27 468 t f b; +#X obj 102 517 f; +#X obj 102 540 + 1; +#X obj 102 561 % 100; +#X msg 27 414 memdump \$1 data \, memread \$1; +#N canvas 0 22 450 300 (subpatch) 0; +#X array data_history 100 float 2; +#X coords 0 1 99 -1 200 140 1; +#X restore 514 226 graph; +#X obj 27 582 tabwrite data_history; +#X obj 239 566 print synchro_error; +#X text 29 70 In order to quickly share an updated table in a synchronised +way \, we need a data fifo.; +#X text 29 103 Only the index of the written position is passed through +stdout of the pd~ \, in order to keep data syncronisation; +#X connect 2 0 19 0; #X connect 3 0 4 0; #X connect 7 0 8 1; #X connect 7 1 8 0; #X connect 8 0 9 0; -#X connect 9 0 10 0; -#X connect 11 1 7 0; -#X connect 18 0 11 0; -#X connect 19 0 18 0; -#X connect 20 0 23 0; +#X connect 9 0 27 0; +#X connect 10 1 7 0; +#X connect 15 0 10 0; +#X connect 15 0 20 0; +#X connect 16 0 19 0; +#X connect 17 0 18 0; +#X connect 18 0 24 0; +#X connect 19 0 17 0; +#X connect 20 0 26 0; +#X connect 20 1 21 0; #X connect 21 0 22 0; -#X connect 22 0 19 0; -#X connect 23 0 21 0; +#X connect 22 0 23 0; +#X connect 23 0 21 1; +#X connect 23 0 26 1; +#X connect 24 0 15 0; -- cgit v1.2.1