#N canvas 355 84 878 688 12;
#X floatatom 324 627 4 0 0 0 - - - 0;
#N canvas 685 165 422 119 sample-subpatch 0;
#X text 39 43 this is a subpatch of the main patch.;
#X restore 105 124 pd sample-subpatch;
#N canvas 566 198 644 307 eager-adder 0;
#X obj 67 46 inlet;
#X obj 123 46 inlet;
#X obj 123 161 outlet;
#X obj 123 74 t b f;
#X obj 123 129 +;
#X text 212 124 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., f 52;
#X text 212 28 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., f 52;
#X text 97 213 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., f 63;
#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 91 350 pd eager-adder;
#X floatatom 91 323 5 0 0 0 - - - 0;
#X floatatom 186 323 5 0 0 0 - - - 0;
#X floatatom 91 378 6 0 0 0 - - - 0;
#X obj 112 623 sendnumber 45 cookies;
#X obj 515 58 sendnumber 67 pretzels;
#X floatatom 717 82 4 0 0 0 - - - 0;
#X obj 324 599 r cookies;
#X obj 717 55 r pretzels;
#X text 33 123 click --> to open, f 9;
#X text 240 123 <-- you can give the window;
#X text 269 139 a name as an argument;
#X text 51 23 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 "pd" into an object box. If you click on the box (in run mode) the subwindow appears., f 56;
#X text 54 470 There is also a facility for making many copies of a patch which track any changes you make in the original. This subpatch type is called an abstraction. For example \, here's a simple abstraction that sends a number to a "receive" on command:, f 57;
#X obj 112 590 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 515 25 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X listbox 558 625 8 0 0 0 - - - 0;
#X floatatom 299 410 6 0 0 0 - - - 0;
#N canvas 566 198 632 327 eager-adder-2 0;
#X obj 225 212 outlet;
#X obj 225 125 t b f;
#X obj 225 180 +;
#X floatatom 110 130 5 0 0 0 - - - 0;
#X floatatom 163 130 5 0 0 0 - - - 0;
#X floatatom 137 173 5 0 0 0 - - - 0;
#X connect 1 0 2 0;
#X connect 1 1 2 1;
#X connect 2 0 0 0;
#X connect 2 0 5 0;
#X connect 3 0 2 0;
#X connect 4 0 1 0;
#X coords 0 -1 1 1 109 102 1 100 100;
#X restore 299 299 pd eager-adder-2;
#X text 666 552 <-- right click and choose "open", f 18;
#X text 51 192 Click on the one below to the see how you give a subpatch inlets and outlets. Subpatches can also displays graphs on the parent window. This way you can click and interact with GUI objects. Right click on the subpatch below to the right and choose "open" to check it out. You can turn a regular subpatch into a "Graph on Parent" one by accessing the properties on right click.;
#X text 495 388 Abstractions can also "Graph on Parent" \, as the one below. This example below also makes use of a feature in the [pdcontrol] object to load arguments. Open it to check it out., f 46;
#X msg 558 479 1 2 3 4;
#X obj 558 522 gop-abs 17 1 hi;
#X text 496 321 Note that "\$1" \, etc \, has a different meaning in object boxes than in message boxes. Open one of the "sendnumber" abstractions for details., f 46;
#X text 503 126 There is a separate file in this directory named "sendnumber.pd" which is loaded as an abstraction every time you type "sendnumber" in a box. Click on a "sendnumber" box above to open the abstraction and check how it works., f 45;
#X text 496 223 If you make changes in one the copies of the abstraction and save it \, the changes will be saved back to sendnumber.pd and not as part of this (containing) patch - and all copies of the abstraction are updated and reloaded in this patch., f 46;
#X connect 2 0 5 0;
#X connect 3 0 2 0;
#X connect 4 0 2 1;
#X connect 9 0 0 0;
#X connect 10 0 8 0;
#X connect 16 0 6 0;
#X connect 17 0 7 0;
#X connect 20 0 19 0;
#X connect 24 0 25 0;
#X connect 25 0 18 0;
