/usr/share/puredata/doc/2.control.examples/12.PART2.subpatch.pd is in puredata-doc 0.46.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #N canvas 84 47 648 623 12;
#X msg 29 318 bang;
#X floatatom 432 341 0 0 0;
#X text 32 14 You can nest entire windows inside Pd boxes (and so on
\, as deep as you wish.) There are two different ways to do it. First
\, if you just want to add a room to the house \, so to speak \, type
;
#N canvas 344 151 422 119 sample-subpatch 1;
#X text 39 43 this is a subpatch of the main patch.;
#X restore 29 85 pd sample-subpatch;
#X text 201 85 <-- you can give the window a name as an argument;
#N canvas 0 0 654 340 eager-adder 0;
#X obj 62 73 inlet;
#X obj 118 73 inlet;
#X obj 62 188 outlet;
#X obj 118 101 t b f;
#X obj 62 156 +;
#X text 197 23 this is a sample subpatch which maintains the sum of
two inputs \, doing the computation when either input changes. IF it's
the left input \, the "+" object takes care if it \; if the right \,
the "trigger" object first gives the "+" the new value \, then "bangs"
the right inlet to make "+" do the computation.;
#X text 55 232 Aside: this shows why \, in Pd and Max \, objects such
as "+" only trigger on their left inlets: it's easy to build up from
there \, but if more than one inlet were "hot" \, you wouldn't be able
to change both of them without firing the calculation twice.;
#X text 197 112 Because of the two inlets and the one outlet \, the
containing box (in the parent patch) has two inlets and one outlet.
They respect the left-to-right order of the inlet and outlet objects
in the subpatch.;
#X connect 0 0 4 0;
#X connect 1 0 3 0;
#X connect 3 0 4 0;
#X connect 3 1 4 1;
#X connect 4 0 2 0;
#X restore 135 185 pd eager-adder;
#X floatatom 135 158 0 0 0;
#X floatatom 256 158 0 0 0;
#X floatatom 135 213 0 0 0;
#X text 26 235 There is also a facility for making many copies of a
patch which track any changes you make in the original. The subpatches
are called abstractions. For example \, here's a simple abstraction
that sends a number to a "receive" on command:;
#X obj 29 342 sendnumber 45 cookies;
#X msg 226 314 bang;
#X obj 226 341 sendnumber 67 pretzels;
#X floatatom 519 341 0 0 0;
#X text 27 553 note that "$1" \, etc \, has a different meaning in
object boxes (open one of the "sendnumber" abstractions for comments.)
;
#X text 26 470 If you change one copy of an abstraction the change
isn't automatically made on any other copies. You must keep track \,
save the changes \, and cause Pd to reload the other copies (for example
\, by closing and reopening the containing patch.);
#X obj 432 314 r cookies;
#X obj 519 314 r pretzels;
#X text 31 107 If you click on the box (in run mode) the subwindow
appears. Click on the one below to see how you give a subpatch inlets
and outlets.;
#X text 332 594 updated for Pd version 0.34;
#X text 27 372 There is a separate file in this directory named "sendnumber.pd"
which is loaded every time you type "sendnumber" in a box. Click on
a "sendnumber" box above to see it. You can make changes in the subpatch
and save them. The changes will be saved back to sendnumber.pd and
not as part of this (containing) patch.;
#X connect 0 0 10 0;
#X connect 5 0 8 0;
#X connect 6 0 5 0;
#X connect 7 0 5 1;
#X connect 11 0 12 0;
#X connect 16 0 1 0;
#X connect 17 0 13 0;
|