aboutsummaryrefslogtreecommitdiff
path: root/doc/pddp/route-help.pd
blob: 627734dc10fbe4f101bc4783f78cd6de7181ed2a (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#N canvas 0 0 555 619 10;
#X obj 0 595 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0
14 -228856 -66577 0;
#X obj 0 0 cnv 15 552 40 empty \$0-pddp.cnv.header route 3 12 0 18
-204280 -1 0;
#X obj 0 240 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13
-228856 -1 0;
#N canvas 52 220 494 392 META 0;
#X text 12 115 PLATFORM windows macosx gnulinux;
#X text 12 195 LIBRARY internal;
#X text 12 235 WEBSITE http://crca.ucsd.edu/~msp/;
#X text 12 75 LICENSE SIBSD;
#X text 12 215 AUTHOR Miller Puckette;
#X text 12 295 HELP_PATCH_AUTHORS This help patch was updated for Pd
version 0.38.4 by Dave Sabine and Hans-Christoph Steiner as part of
a project called pddp proposed by Krzysztof Czaja to build comprehensive
documentation for Pd. Jonathan Wilkes revised the patch to conform
to the PDDP template for Pd version 0.42.;
#X text 12 5 GENRE help;
#X text 12 95 DESCRIPTION route message according to their first element
;
#X text 12 25 NAME route;
#X text 12 135 INLET_0 anything;
#X text 12 155 OUTLET_N anything;
#X text 12 175 OUTLET_R anything;
#X text 12 45 KEYWORDS control needs_work list_op symbol_op list_op
anything_op;
#X text 12 255 RELEASE_DATE 1997;
#X text 12 275 RELEASE_VERSION;
#X restore 500 597 pd META;
#X obj 0 362 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0
13 -228856 -1 0;
#X obj 0 471 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12
0 13 -228856 -1 0;
#X obj 0 567 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12
0 13 -228856 -1 0;
#N canvas 74 482 428 109 Related_objects 0;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -204280 -1 0;
#X text 8 2 [route] Related Objects;
#X obj 22 43 select;
#X obj 72 43 spigot;
#X obj 123 43 moses;
#X restore 102 597 pd Related_objects;
#X obj 78 249 cnv 17 3 105 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
#X obj 78 371 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856
-162280 0;
#X obj 482 3 route;
#X obj 455 20 pddp/pddplink http://wiki.puredata.info/en/route -text
pdpedia: route;
#X obj 187 113 route 0 1;
#X msg 187 61 0 12;
#X msg 225 61 1 13;
#X msg 263 61 2 14;
#X obj 238 156 print rejection_outlet;
#X obj 187 200 print left_outlet;
#X obj 238 136 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 212 178 print middle_outlet;
#X obj 212 136 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 187 136 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 300 61 7 17;
#X text 11 23 route messages according to their first element;
#N canvas 11 63 516 509 float_mode 0;
#X text 89 271 float;
#X text 89 365 list;
#X text 89 325 symbol;
#X text 89 455 pointer;
#X text 139 455 - a pointer is always sent to the rightmost outlet.
;
#X text 89 438 bang;
#X text 139 271 - the incoming value is compared to the creation argument(s).
If there is a match \, a bang is sent to the outlet corresponding to
the matching creation argument. If there is no match the input is sent
to the rightmost outlet.;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -204280 -1 0;
#X text 8 2 [route] Message Handling in "Float Mode";
#X obj 1 261 cnv 3 500 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13
-228856 -1 0;
#X obj 70 270 cnv 17 3 225 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
#X text 138 438 - a bang will be sent to the rightmost inlet.;
#X text 88 481 All other messages will be sent to the rightmost outlet.
;
#X msg 141 50 2;
#X msg 148 72 1 2 3;
#X obj 141 167 bng 12 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 162 167 bng 12 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 169 116 something else;
#X obj 204 167 print rejection_outlet;
#X obj 141 233 print out0;
#X obj 162 211 print out1;
#X text 50 26 For "float mode" \, the first argument must be a float.
;
#X obj 141 142 route 1 2 3;
#X obj 183 189 print out2;
#X obj 183 167 bng 12 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 158 94 3 dog night;
#X text 139 325 - the symbol is compared to the creation arguments
\, and a bang is sent to the corresponding outlet if there is a match.
;
#X text 139 365 - the first element of the list is compared to the
creation argument(s). If there is a match \, the first element is removed
from the list \, and the remaining list is sent to the outlet corresponding
to the matching creation argument. If there is no match the input is
sent to the rightmost outlet.;
#X connect 13 0 22 0;
#X connect 14 0 22 0;
#X connect 17 0 22 0;
#X connect 22 0 15 0;
#X connect 22 0 19 0;
#X connect 22 1 16 0;
#X connect 22 1 20 0;
#X connect 22 2 23 0;
#X connect 22 2 24 0;
#X connect 22 3 18 0;
#X connect 25 0 22 0;
#X restore 171 306 pd float_mode;
#X text 98 249 anything;
#X text 168 249 - [route] handles its input in 3 different "modes"
\, depending on what the creation arguments are. Click the subpatches
below to see how message types are handled under each mode.;
#X text 261 306 match float arguments;
#N canvas 15 11 516 599 selector_mode 0;
#X text 88 548 pointer;
#X text 138 548 - a pointer is always sent to the rightmost outlet.
;
#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -204280 -1 0;
#X obj 0 389 cnv 3 500 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13
-228856 -1 0;
#X obj 69 398 cnv 17 3 255 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
#X obj 68 244 bng 12 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 101 244 bng 12 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 203 262 print rejection_outlet;
#X msg 68 59 der;
#X obj 68 349 print out0;
#X obj 101 327 print out1;
#X text 7 1 [route] Message Handling in "Selector Mode";
#X msg 92 690 foo;
#X msg 101 718 symbol foo;
#X obj 169 283 print out3;
#X obj 92 840 print out0;
#X obj 133 818 print out1;
#X text 120 690 the selector "foo" matches the first argument;
#X text 171 718 the selector "symbol" matches the second argument;
#X text 88 398 bang;
#X text 138 398 - if one of the creation arguments is "bang" \, then
a bang will be sent out the corresponding outlet.;
#X text 138 428 - if one of the creation arguments is "float" \, then
an incoming float will be sent out the corresponding outlet.;
#X text 88 428 float;
#X text 88 458 list;
#X text 138 458 - if one of the creation arguments is "list" \, then
two behaviors are possible:;
#X text 138 484 a) if the first element is a float \, the list is sent
out the corresponding outlet.;
#X text 138 509 b) if the first element is a symbol \, the "list" selector
is removed \, and the remaining message is sent out the corresponding
outlet.;
#X text 88 568 symbol;
#X text 138 568 - if one of the creation arguments is "symbol" \, then
an incoming symbol will be sent out the corresponding outlet.;
#X text 87 596 All other messages - the selector of the incoming message
is compared to the creation argument(s). If there is a match \, the
selector is stripped and the remaining message is sent to the corresponding
outlet. If there is no match the input is sent to the rightmost outlet.
;
#X text 91 667 Beware! All this can be confusing at times...;
#X msg 84 103 das;
#X obj 135 305 print out2;
#X obj 135 244 bng 12 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 169 244 bng 12 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 108 182 doh;
#X obj 203 244 bng 12 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 74 81 die 41;
#X text 49 36 In selector mode \, all creation arguments should be
symbols.;
#X obj 68 221 route der die das float;
#X msg 93 125 float 41;
#X msg 103 153 41;
#X text 135 147 (Remember: a single float "n" in a message or object
box is shorthand for "float n");
#X text 134 181 sent to the rightmost outlet (the "rejection outlet")
;
#X obj 92 774 route foo symbol list;
#X obj 174 796 print out2;
#X msg 128 744 2 3 four;
#X text 189 744 an implicit list-- matches the third argument;
#X connect 8 0 39 0;
#X connect 12 0 44 0;
#X connect 13 0 44 0;
#X connect 31 0 39 0;
#X connect 35 0 39 0;
#X connect 37 0 39 0;
#X connect 39 0 5 0;
#X connect 39 0 9 0;
#X connect 39 1 6 0;
#X connect 39 1 10 0;
#X connect 39 2 32 0;
#X connect 39 2 33 0;
#X connect 39 3 14 0;
#X connect 39 3 34 0;
#X connect 39 4 7 0;
#X connect 39 4 36 0;
#X connect 40 0 39 0;
#X connect 41 0 39 0;
#X connect 44 0 15 0;
#X connect 44 1 16 0;
#X connect 44 2 45 0;
#X connect 46 0 44 0;
#X restore 171 334 pd selector_mode;
#X text 277 334 match the selector of the message;
#X obj 78 397 cnv 17 3 17 empty \$0-pddp.cnv.let.0 r 5 9 0 16 -228856
-162280 0;
#X text 98 398 anything;
#X text 168 398 - the rightmost outlet of [route] is always the "rejection
outlet." That is \, incoming messages which do not match any of the
creation arguments are sent to the rightmost outlet.;
#X text 168 372 - an outlet is added for each creation argument specified.
;
#X text 82 437 * An incoming pointer will never match and so will always
be sent to the rejection outlet.;
#X text 98 372 anything *;
#X text 80 489 1) float;
#X text 97 503 symbol atom;
#X text 168 489 - [route] can take symbols or floats as arguments.
(Note: the first argument determines which "mode" below.) If floats
are used \, [route] operates in "float mode"-- if symbols are used
\, float operates in "selector mode." See the subpatches above to see
how incoming data is handled in each mode.;
#X obj 4 597 pddp/pddplink pddp/help.pd -text help;
#X obj 100 572 pddp/pddplink ../2.control.examples/18.conditional.pd
-text doc/2.control.examples/18.conditional.pd;
#X msg 300 85 Grizabella;
#X connect 12 0 17 0;
#X connect 12 0 21 0;
#X connect 12 1 19 0;
#X connect 12 1 20 0;
#X connect 12 2 16 0;
#X connect 12 2 18 0;
#X connect 13 0 12 0;
#X connect 14 0 12 0;
#X connect 15 0 12 0;
#X connect 22 0 12 0;
#X connect 41 0 12 0;