#N canvas 385 48 851 592 12;
#X text 617 558 updated for Pd version 0.49.;
#X text 26 469 The abstraction may itself be modified at will without disturbing the saved states of its copies in any calling patches \, as long as the usage of the saved and restored lists is kept compatible.;
#X obj 39 13 savestate;
#N canvas 689 98 622 256 reference 0;
#X obj 18 52 cnv 5 580 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 18 95 cnv 2 580 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 191 cnv 2 580 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 17 225 cnv 5 580 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 176 198 NONE, f 15;
#X obj 41 16 savestate;
#X text 123 66 list -;
#X obj 17 149 cnv 1 580 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 17 117 cnv 1 580 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 123 122 list -;
#X text 123 156 bang -;
#X text 173 156 when the parent patch is saved.;
#X text 173 122 one or more lists when the parent patch is opened.;
#X text 173 66 one or more lists when the parent patch gets saved.;
#X text 115 16 - mechanism for saving the state of an abstraction., f 61;
#X restore 630 13 pd reference;
#X text 728 14 <= click;
#X obj 7 45 cnv 1 835 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 7 545 cnv 1 835 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 112 12 - mechanism for saving the state of an abstraction;
#X obj 71 304 savestate-ex1;
#A saved 0 125;
#X obj 209 304 savestate-ex1;
#A saved 0 150;
#X text 22 58 The [savestate] object is used inside abstractions to save their state as they are used in a calling (parent) patch. When the parent patch (such as this one \, which calls the example abstractions) is saved \, the included [savestate] object inside the abstractions sends a 'bang' message out its right outlet \, with which the abstraction may respond by presenting one or more 'list' messages back to the [savestate] object. These lists are saved as part of the calling patch. If the calling patch is reopened later \, the lists are sent out the left outlet of the [savestate] object. The abstraction can then use them to restore its state., f 58;
#X text 233 385 Parameters for different copies of the abstraction are saved and restored independently., f 25;
#X obj 106 392 output~;
#X text 22 237 Open the abstractions below (right- or CTRL- click and select "open" in popup menu) to see how the [savestate] object is used from within., f 58;
#X text 460 58 Multiple [savestate] objects aren't differentiated \, so they all receive all lists sent to any one of them and output them. Hence \, it's probably best to just use a single [savestate] object per abstraction., f 51;
#X obj 463 269 savestate-ex2;
#A saved amp 1 0.5 0.333;
#A saved freq 200 400 600;
#X obj 650 269 savestate-ex2;
#A saved amp 0.5 1 0.5;
#A saved freq 300 600 900;
#X listbox 463 415 12 0 0 0 - - - 0;
#X listbox 552 377 12 0 0 0 - - - 0;
#X listbox 650 415 12 0 0 0 - - - 0;
#X listbox 717 377 12 0 0 0 - - - 0;
#X text 460 141 The saved messages are output when the object is recreated \, before any outside connections are made and possibly before other parts of a saved patch have been restored. You can use [loadbang] objects to send messages to objects elsewhere in the owning patch at load time once the entire patch is loaded. See example below for more details, f 51;
#X text 465 460 Note that abstractions within [clone] objects are not handled! Instead \, you can have a [clone] object inside your abstraction and use [savestate] to send data to the copies of the cloned abstraction., f 51;
#X text 685 376 amp;
#X text 741 414 freq;
#X text 520 376 amp;
#X text 554 414 freq;
#X connect 8 0 12 0;
#X connect 9 0 12 1;
#X connect 15 0 17 0;
#X connect 15 1 18 0;
#X connect 16 0 19 0;
#X connect 16 1 20 0;
