aboutsummaryrefslogtreecommitdiff
path: root/examples/4.table_fifo.pd
blob: a615ef1eebf20d53f04aff4cabfdb720e2f1cee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#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;
#X restore 304 227 graph;
#X text 30 23 Basic sharing of memory data between two pd instances
;
#X msg 44 306 pd~ stop;
#X obj 512 20 loadbang;
#X msg 512 41 \; pd dsp 1;
#X text 29 260 launch subprocess;
#X obj 39 52 declare -path ..;
#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)
;
#X text 30 182 metro is set to 5ms \, so maximum jitter can be 72/5
= 25 bang;
#X text 28 208 So \, lets use a memory size of 2500;
#X obj 27 434 shmem 1004 2500;
#X obj 27 374 route syncro;
#X obj 27 394 * 100;
#X obj 27 353 pd~ -ninsig 0 -noutsig 0 -fifo 50;
#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 msg 27 279 pd~ start table_fifo-subprocess.pd;
#X connect 2 0 18 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 26 0;
#X connect 10 1 7 0;
#X connect 15 0 10 0;
#X connect 15 0 19 0;
#X connect 16 0 17 0;
#X connect 17 0 23 0;
#X connect 18 0 16 0;
#X connect 19 0 25 0;
#X connect 19 1 20 0;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 22 0 20 1;
#X connect 22 0 25 1;
#X connect 23 0 15 0;
#X connect 29 0 18 0;