aboutsummaryrefslogtreecommitdiff
path: root/doc/pddp/help-pack.pd
blob: 44a88b7bb22430b4b64c715e49fd5918ef301e4d (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#N canvas 13 -7 937 656 10;
#X obj 25 11 pack;
#X text 60 11 - combine several atoms into one message;
#X msg 24 190 bang;
#X obj 24 210 pack 100 0 s 42;
#X text 24 249 In the same example \, this [pack] object will recognize
floats in the first \, second \, and fourth inlet \; it will recognize
symbols in the third inlet. If it receives anything else \, then you'll
see the "no method for ___" error message in the terminal window.;
#X obj 25 366 pack 100 0 s 42;
#X msg 25 328 400 1 cat 38;
#X text 110 328 This works.;
#X msg 37 347 cat dog 42 earth;
#X obj 30 534 pack cat;
#X text 24 419 So \, if [pack] understands that "100" is a float and
can therefore understand all incoming numbers to that inlet...then
you might assume that the word "cat" could be written as a creation
argument and [pack] should understand all incoming symbols. But that's
NOT the case. If you try to define a [pack] symbol with the word "cat"
in a creation argument \, you'll get a "bad type" error.;
#X text 38 516 WRONG;
#X obj 142 538 pack symbol;
#X text 222 528 CORRECT;
#X obj 142 559 print this_package;
#X msg 142 517 cat;
#X text 40 382 Note that the "s" above is an abbreviation for "symbol".
;
#X obj 30 611 pack bang;
#X text 29 578 Same problem with bangs! This [pack] object creates
an error.;
#X obj 416 14 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 416 604 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 448 106 [pack] can be created with any number of creation arguments.
There will be one inlet created for each argument and the values of
each [pack]ed element can be updated at any time using the separate
inlets \; or they can be updated simoultaneously with a LIST of messages
to its first inlet.;
#X text 609 75 is the same as;
#X obj 24 231 print package_1;
#X obj 25 399 print package_2;
#X obj 444 489 print my_package;
#X msg 467 271 1 2 dog;
#X text 518 266 This list doesn't contain enough elements \; so it
resets only the first three elements and then outputs the entire package
- the undefined elements will simply output their previous values.
;
#X obj 444 197 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X floatatom 476 376 5 0 0;
#X floatatom 474 329 5 0 0;
#X msg 537 423 100 earth me 42;
#X text 548 441 Lists can only be sent to the first inlet -- this list
will cause an error.;
#X text 520 326 A new value for the first element will reset the first
element and force [pack] to output the entire package of stored values.
;
#X text 451 16 Perhaps the best way to build creation arguments is
to define the data types that [pack] should expect at each inlet: (i.e.
floats \, symbols \, or pointers -- or their abbreviations f \, s \,
or p);
#X obj 450 75 pack float symbol pointer;
#X obj 704 76 pack f s p;
#X msg 457 247 42 24 dog cat 1 2;
#X obj 444 469 pack f f s s f f;
#X text 572 247 This list contains new values for each element.;
#X text 19 127 In the example below \, the creation arguments are "100
\, 0 \, a symbol \, 42". Hence \, when [pack] receives a bang \, it
will send that information to its outlet as a list - or 'package' -
which will be printed in your terminal window.;
#X text 144 348 This doesn't work - the data types;
#X text 143 362 don't correspond with the arguments.;
#X text 17 33 The pack object takes a series of inputs and then outputs
a concatenated list. The number of creation arguments determines the
number of inlets while the type of creation arguments determines the
types of messages that [pack] should expect to receive at each inlet
- although with some peculiarities described below.;
#X text 463 191 Any message to the first inlet will force [pack] to
output its package - its list of values. A bang to the first inlet
will force [pack] to output the current values without resetting any
of them.;
#X text 522 366 This number box will update each of the 'float' values
and will NOT output the package - because the first inlet is not receiving
a message - to change this behavior \, you should explore the [trigger]
object.;
#X text 443 523 RELATED OBJECTS;
#X obj 442 546 trigger;
#X obj 495 546 unpack;
#N canvas 0 0 452 302 related_objects_from_other_libraries 0;
#X obj 21 16 pack~;
#X obj 61 16 unpack~;
#X obj 113 16 tabdump;
#X obj 169 16 niagara;
#X obj 224 16 packel;
#X obj 21 42 repack;
#X obj 70 42 drip;
#X obj 107 42 sort;
#X text 18 86 These objects are offered in PD only if you have downloaded
and properly installed the appropriate library. These objects may or
may not exist in a single library.;
#X text 17 135 The best places to find information about PD's libraries
is:;
#X text 14 157 www.puredata.org and click on "Downloads" then "Software"
;
#X text 15 173 or;
#X text 16 187 iem.kug.ac.at/pdb/;
#X restore 440 571 pd related_objects_from_other_libraries;
#X text 443 601 This document was updated for PD version 0.35 test
26 by Dave Sabine as part of a project called pddp proposed by Krzysztof
Czaja to build comprehensive documentation for PD.;
#X connect 2 0 3 0;
#X connect 3 0 23 0;
#X connect 5 0 24 0;
#X connect 6 0 5 0;
#X connect 8 0 5 0;
#X connect 12 0 14 0;
#X connect 15 0 12 0;
#X connect 19 0 20 0;
#X connect 26 0 38 0;
#X connect 28 0 38 0;
#X connect 29 0 38 1;
#X connect 29 0 38 4;
#X connect 29 0 38 5;
#X connect 30 0 38 0;
#X connect 31 0 38 1;
#X connect 37 0 38 0;
#X connect 38 0 25 0;