diff options
Diffstat (limited to 'sssad')
-rw-r--r-- | sssad/README.txt | 55 | ||||
-rw-r--r-- | sssad/_sssad/list_argument.pd | 20 | ||||
-rw-r--r-- | sssad/_sssad/singleton-help.pd | 42 | ||||
-rw-r--r-- | sssad/_sssad/singleton.pd | 121 | ||||
-rw-r--r-- | sssad/_sssad/sssad-persistence.pd | 17 | ||||
-rw-r--r-- | sssad/auto.pd | 6 | ||||
-rw-r--r-- | sssad/datastore-help.pd | 30 | ||||
-rw-r--r-- | sssad/datastore.pd | 64 | ||||
-rw-r--r-- | sssad/load.pd | 23 | ||||
-rw-r--r-- | sssad/panel.pd | 92 | ||||
-rw-r--r-- | sssad/sssad-help.pd | 99 | ||||
-rw-r--r-- | sssad/sssad.pd | 31 | ||||
-rw-r--r-- | sssad/value.pd | 11 |
13 files changed, 611 insertions, 0 deletions
diff --git a/sssad/README.txt b/sssad/README.txt new file mode 100644 index 0000000..afe749f --- /dev/null +++ b/sssad/README.txt @@ -0,0 +1,55 @@ +sssad is Stupidsupersimplistic State Saving ADVANCED +==================================================== + +[sssad] is an abstraction to simplify saving of data inside a Pd patch to a +file. See [sssad-help] for a reference, and [sssad-example] for how to use it. + +Author(s) +======== + +[sssad] was written by Frank Barknecht <fbar@footils.org> and was inspired from +a discussion about Max's [pv] and [pvar] objects on pd-list brought up by "Item +State" + +Internally it uses [singleton] which goes back to an idea by Enrique Erne and +IOhannes m zmoelnig plus [list_argument] which was ripped of from +Hans-Christoph Steiner's [float_argument] + +License +======= + +The same as Pd's license, with me as author: + +Copyright: + +This software is copyrighted by Frank Barknecht and others. The following +terms apply to all files associated with the software unless explicitly +disclaimed in individual files. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. + +RESTRICTED RIGHTS: Use, duplication or disclosure by the government +is subject to the restrictions as set forth in subparagraph (c) (1) (ii) +of the Rights in Technical Data and Computer Software Clause as DFARS +252.227-7013 and FAR 52.227-19. diff --git a/sssad/_sssad/list_argument.pd b/sssad/_sssad/list_argument.pd new file mode 100644 index 0000000..d532a27 --- /dev/null +++ b/sssad/_sssad/list_argument.pd @@ -0,0 +1,20 @@ +#N canvas 160 304 587 350 10; +#X obj 259 234 outlet; +#X text 83 259 If the argument is not equal to 0 \, use it. Pd init +arguments to 0 so unused arguments will be 0; +#X obj 143 116 select 0; +#X text 82 296 This is useful to have internals inited \, but not reset +if there is no argument specified.; +#X obj 143 190 select 0; +#X text 275 172 if 2nd arg \, then use as default value; +#X obj 143 20 inlet; +#X obj 143 96 list append \$1; +#X obj 143 169 list append \$2; +#X obj 143 55 bang; +#X connect 2 0 8 0; +#X connect 2 1 0 0; +#X connect 4 1 0 0; +#X connect 6 0 9 0; +#X connect 7 0 2 0; +#X connect 8 0 4 0; +#X connect 9 0 7 0; diff --git a/sssad/_sssad/singleton-help.pd b/sssad/_sssad/singleton-help.pd new file mode 100644 index 0000000..ab5a392 --- /dev/null +++ b/sssad/_sssad/singleton-help.pd @@ -0,0 +1,42 @@ +#N canvas 415 240 552 487 10; +#X obj 79 44 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 80 137 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 80 230 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 245 43 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 269 139 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 295 230 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 75 339 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 75 385 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 80 117 singleton TABLE_X table x; +#X obj 80 211 singleton TABLE_Y table y 100; +#X obj 269 119 singleton TABLE_X table x; +#X obj 295 211 singleton TABLE_Y table y 100; +#X obj 75 320 singleton LIST list prepend 1 2 3 4 5 6 7 8; +#X obj 75 365 singleton LIST list prepend 1 2 3 4 5 6 7 8; +#X text 85 292 Up to 10 arguments supported; +#X obj 81 85 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 247 84 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 79 24 singleton MUL_A *; +#X obj 245 23 singleton MUL_A *; +#X obj 248 65 singleton MUL_B *; +#X obj 81 65 singleton MUL_B *; +#X connect 8 0 1 0; +#X connect 9 0 2 0; +#X connect 10 0 4 0; +#X connect 11 0 5 0; +#X connect 12 0 6 0; +#X connect 13 0 7 0; +#X connect 17 0 0 0; +#X connect 18 0 3 0; +#X connect 19 0 16 0; +#X connect 20 0 15 0; diff --git a/sssad/_sssad/singleton.pd b/sssad/_sssad/singleton.pd new file mode 100644 index 0000000..6a78865 --- /dev/null +++ b/sssad/_sssad/singleton.pd @@ -0,0 +1,121 @@ +#N canvas 184 74 837 725 10; +#N canvas 0 22 236 173 1047-container 0; +#X restore 227 18 pd \$0-container; +#X obj 156 360 f \$0; +#X obj 156 380 makefilename pd-%d-container; +#X obj 47 18 loadbang; +#X obj 47 611 outlet; +#X obj 47 132 value \$1.SSSAD.req; +#X obj 47 311 select 0; +#X obj 47 157 t f f; +#X obj 77 177 + 1; +#X obj 77 197 value \$1.SSSAD.req; +#X obj 47 335 t b b; +#X msg 47 589 1; +#X obj 156 401 t s s; +#X msg 186 423 \; \$1 clear; +#X text 378 43 more simple-minded \, we would just set \$1.SSSAD.req to +"1" instead of incrementing it each time. (however \, this way we also +now how many instances of the class we have). and of course we could +use just one [value] - i use 2 for better readability.; +#X obj 324 107 del 0; +#X obj 324 126 value \$1.SSSAD.req; +#X floatatom 324 149 5 0 0 0 - - -; +#X text 322 168 wow! the number of instances; +#N canvas 0 0 570 825 1047-arguments 0; +#X obj 36 485 outlet; +#X obj 36 461 r \$0-tolist; +#X obj 171 87 t b a; +#X obj 201 109 s \$0-tolist; +#X obj 171 156 t b a; +#X obj 201 178 s \$0-tolist; +#X obj 171 225 t b a; +#X obj 201 247 s \$0-tolist; +#X obj 171 299 t b a; +#X obj 201 321 s \$0-tolist; +#X obj 171 64 list_argument \$2; +#X obj 171 134 list_argument \$3; +#X obj 171 202 list_argument \$4; +#X obj 171 276 list_argument \$5; +#X obj 171 357 list_argument \$6; +#X obj 171 35 inlet; +#X obj 171 381 t b a; +#X obj 201 403 s \$0-tolist; +#X obj 171 461 t b a; +#X obj 201 483 s \$0-tolist; +#X obj 171 437 list_argument \$7; +#X obj 170 537 t b a; +#X obj 200 559 s \$0-tolist; +#X obj 169 607 t b a; +#X obj 199 629 s \$0-tolist; +#X obj 169 682 t b a; +#X obj 199 704 s \$0-tolist; +#X obj 170 513 list_argument \$8; +#X obj 169 583 list_argument \$9; +#X obj 169 658 list_argument \$10; +#X obj 169 757 t b a; +#X obj 199 779 s \$0-tolist; +#X obj 169 733 list_argument \$11; +#X connect 1 0 0 0; +#X connect 2 0 11 0; +#X connect 2 1 3 0; +#X connect 4 0 12 0; +#X connect 4 1 5 0; +#X connect 6 0 13 0; +#X connect 6 1 7 0; +#X connect 8 0 14 0; +#X connect 8 1 9 0; +#X connect 10 0 2 0; +#X connect 11 0 4 0; +#X connect 12 0 6 0; +#X connect 13 0 8 0; +#X connect 14 0 16 0; +#X connect 15 0 10 0; +#X connect 16 0 20 0; +#X connect 16 1 17 0; +#X connect 18 0 27 0; +#X connect 18 1 19 0; +#X connect 20 0 18 0; +#X connect 21 0 28 0; +#X connect 21 1 22 0; +#X connect 23 0 29 0; +#X connect 23 1 24 0; +#X connect 25 0 32 0; +#X connect 25 1 26 0; +#X connect 27 0 21 0; +#X connect 28 0 23 0; +#X connect 29 0 25 0; +#X connect 30 1 31 0; +#X connect 32 0 30 0; +#X restore 365 379 pd \$0-arguments; +#X msg 365 556; +#X msg 509 377 set \, addsemi \, adddollar 1 \, add2 obj 10 10; +#X obj 47 48 t b b b b b; +#X msg 487 530 set; +#X obj 77 483 symbol; +#X msg 365 404 add2 \$1; +#X connect 1 0 2 0; +#X connect 2 0 12 0; +#X connect 3 0 22 0; +#X connect 5 0 7 0; +#X connect 6 0 10 0; +#X connect 7 0 6 0; +#X connect 7 1 8 0; +#X connect 8 0 9 0; +#X connect 10 0 11 0; +#X connect 10 1 24 0; +#X connect 11 0 4 0; +#X connect 12 0 24 1; +#X connect 12 1 13 0; +#X connect 15 0 16 0; +#X connect 16 0 17 0; +#X connect 19 0 25 0; +#X connect 21 0 20 0; +#X connect 22 0 5 0; +#X connect 22 1 1 0; +#X connect 22 2 15 0; +#X connect 22 3 19 0; +#X connect 22 4 21 0; +#X connect 23 0 20 0; +#X connect 24 0 20 0; +#X connect 25 0 20 0; diff --git a/sssad/_sssad/sssad-persistence.pd b/sssad/_sssad/sssad-persistence.pd new file mode 100644 index 0000000..4071e1e --- /dev/null +++ b/sssad/_sssad/sssad-persistence.pd @@ -0,0 +1,17 @@ +#N canvas 411 241 354 407 10; +#X obj 73 159 list; +#X obj 73 219 list prepend \$1; +#X obj 73 246 list prepend persist; +#X obj 73 269 s SSSAD_ADMIN; +#X obj 73 67 r SSSAD_ADMIN; +#X obj 73 93 route save; +#X obj 73 115 b; +#X text 51 28 args: SSAD-name \$0; +#X obj 96 136 r \$2-sssad-data; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 6 0 0 0; +#X connect 8 0 0 1; diff --git a/sssad/auto.pd b/sssad/auto.pd new file mode 100644 index 0000000..3e1ab52 --- /dev/null +++ b/sssad/auto.pd @@ -0,0 +1,6 @@ +#N canvas 209 159 450 300 10; +#X obj 5 47 s \$2; +#X obj 98 3 r \$1; +#X obj 5 24 sssad/sssad \$2; +#X connect 1 0 2 1; +#X connect 2 0 0 0; diff --git a/sssad/datastore-help.pd b/sssad/datastore-help.pd new file mode 100644 index 0000000..984986b --- /dev/null +++ b/sssad/datastore-help.pd @@ -0,0 +1,30 @@ +#N canvas 210 191 682 468 10; +#N canvas 0 0 450 300 datastore 1; +#X obj 10 10 r SSSADDATA; +#X msg 10 30 \; SSSAD z 1 \; SSSAD y 2 \; SSSAD x 104 \; SSSAD_ADMIN +set \;; +#X connect 0 0 1 0; +#X restore 11 86 pd datastore; +#X obj 11 113 sssad/datastore; +#X floatatom 57 279 5 0 0 0 - - -; +#X obj 57 331 hradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 +-1 1; +#X obj 60 212 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 10400 1; +#X obj 13 305 sssad/sssad y; +#X obj 13 355 sssad/sssad z; +#X text 10 9 The datastore abstraction allows you to save sssad data +into a message box that gets saved with the patch \, instead of writing +it into a text file.; +#X text 9 53 It requires that you first create an empty sub patch called +"datastore" as below:; +#X obj 13 236 sssad/sssad x; +#X text 163 147 Use these GUIs to test it out \, and check the contents +of the 'datastore' subpatch to see the data being written as you change +it.; +#X connect 2 0 5 1; +#X connect 3 0 6 1; +#X connect 4 0 9 1; +#X connect 5 0 2 0; +#X connect 6 0 3 0; +#X connect 9 0 4 0; diff --git a/sssad/datastore.pd b/sssad/datastore.pd new file mode 100644 index 0000000..4f6666d --- /dev/null +++ b/sssad/datastore.pd @@ -0,0 +1,64 @@ +#N canvas 0 0 733 629 10; +#X text 40 597 Hint: get creative with the [OSCroute] external!; +#X obj 6 22 bng 14 250 50 0 \$0-save empty save 17 7 0 8 -128992 -66577 +-1; +#X obj 6 40 bng 14 250 50 0 \$0-load empty load 17 7 0 8 -128992 -1 +-1; +#X obj 16 103 r \$0-load; +#X text 103 27 This abstraction and all the other sssad state saving +stuff is due to the genius of Frank Barknecht. Any mistakes are purely +my own.; +#X text 84 104 if the load button is pressed; +#X obj 442 350 r SSSAD_ADMIN; +#X obj 442 405 route persist; +#X obj 442 375 list trim; +#X obj 442 461 list trim; +#X msg 96 239 save; +#X obj 118 473 s SSSAD_ADMIN; +#X obj 442 437 list prepend add SSSAD; +#X msg 140 433 set \, addsemi; +#X msg 96 501 add SSSAD_ADMIN set; +#X obj 16 126 s SSSADDATA; +#X obj 233 540 s SSSADDATA; +#X obj 96 215 r \$0-save; +#X obj 96 262 t b a b b b; +#X obj 168 287 s SSSAD_SAVE; +#X msg 327 143 bang; +#X obj 327 186 list trim; +#X obj 327 165 list append \$1; +#X obj 327 207 route 0; +#X obj 327 123 loadbang; +#X obj 478 253 makefilename pd-%s; +#X msg 154 356 \; \$1 clear \; \$1 obj 10 10 r SSSADDATA \; \$1 msg +10 30 \; \$1 connect 0 0 1 0 \;; +#X obj 154 335 symbol; +#X msg 191 316 symbol \$1; +#X msg 328 253 symbol pd-datastore; +#X obj 478 232 list; +#X connect 3 0 15 0; +#X connect 6 0 8 0; +#X connect 7 0 12 0; +#X connect 8 0 7 0; +#X connect 9 0 16 0; +#X connect 10 0 18 0; +#X connect 12 0 9 0; +#X connect 13 0 16 0; +#X connect 14 0 16 0; +#X connect 17 0 10 0; +#X connect 18 0 14 0; +#X connect 18 1 11 0; +#X connect 18 2 13 0; +#X connect 18 3 27 0; +#X connect 18 4 19 0; +#X connect 20 0 22 0; +#X connect 21 0 23 0; +#X connect 22 0 21 0; +#X connect 23 0 29 0; +#X connect 23 1 30 0; +#X connect 24 0 20 0; +#X connect 25 0 28 0; +#X connect 27 0 26 0; +#X connect 28 0 27 1; +#X connect 29 0 28 0; +#X connect 30 0 25 0; +#X coords 0 -1 1 1 85 60 1 0 0; diff --git a/sssad/load.pd b/sssad/load.pd new file mode 100644 index 0000000..9abc9fc --- /dev/null +++ b/sssad/load.pd @@ -0,0 +1,23 @@ +#N canvas 0 0 450 300 10; +#X obj 11 191 textfile; +#X obj 11 221 s SSSAD; +#X obj 11 133 until; +#X msg 11 112 100; +#X obj 79 218 s SSSAD_ADMIN; +#X msg 79 193 set; +#X obj 11 89 t b a; +#X msg 58 134 read \$1 \, rewind; +#X text 62 111 Avoid loops. A bang normally also works.; +#X obj 11 42 loadbang; +#X obj 11 65 symbol \$1; +#X connect 0 0 1 0; +#X connect 0 1 2 1; +#X connect 0 1 5 0; +#X connect 2 0 0 0; +#X connect 3 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 3 0; +#X connect 6 1 7 0; +#X connect 7 0 0 0; +#X connect 9 0 10 0; +#X connect 10 0 6 0; diff --git a/sssad/panel.pd b/sssad/panel.pd new file mode 100644 index 0000000..088af6d --- /dev/null +++ b/sssad/panel.pd @@ -0,0 +1,92 @@ +#N canvas 0 0 733 629 10; +#X obj 601 349 textfile; +#X msg 484 256 clear; +#X obj 601 273 list prepend add; +#X obj 601 299 list trim; +#X obj 86 520 textfile; +#X obj 86 550 s SSSAD; +#X obj 86 462 until; +#X msg 86 441 100; +#X text 81 572 also received inside sssad; +#X obj 465 350 s SSSAD_ADMIN; +#X obj 601 205 r SSSAD_ADMIN; +#X obj 601 249 route persist; +#X obj 601 227 list trim; +#X msg 465 284 save; +#X msg 479 323 set; +#X obj 154 547 s SSSAD_ADMIN; +#X msg 154 522 set; +#X obj 446 133 savepanel; +#X msg 446 397 write \$1; +#X obj 6 24 bng 14 250 50 0 \$0-save_as empty save_as 17 7 0 8 -128992 +-1 -1; +#X obj 86 418 t b a; +#X msg 133 463 read \$1 \, rewind; +#X obj 86 346 openpanel; +#X text 118 441 Avoid loops. A bang normally also works.; +#X obj 86 395 symbol; +#X text 40 597 Hint: get creative with the [OSCroute] external!; +#X obj 446 110 r \$0-save_as; +#X obj 374 110 r \$0-save; +#X obj 6 42 bng 14 250 50 0 \$0-save empty save 17 7 0 8 -128992 -66577 +-1; +#X obj 6 60 bng 14 250 50 0 \$0-load empty load 17 7 0 8 -128992 -66577 +-66577; +#X obj 86 323 r \$0-load; +#X obj 446 214 t a b b b; +#X text 103 27 This abstraction and all the other sssad state saving +stuff is due to the genius of Frank Barknecht. Any mistakes are purely +my own.; +#X obj 504 235 s SSSAD_SAVE; +#X obj 446 193 symbol; +#X obj 14 248 sel 0; +#X obj 14 202 loadbang; +#X obj 14 223 list append \$1; +#X obj 74 292 s \$0/filename; +#X text 11 175 only set the filename if one is supplied; +#X obj 123 372 r \$0/filename; +#X obj 520 132 r \$0/filename; +#X obj 344 214 s \$0/filename; +#X obj 446 155 t s s; +#X text 154 324 if the load button is pressed; +#X text 372 93 if save or save as are clicked; +#X obj 44 270 t b s; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X connect 3 0 0 0; +#X connect 4 0 5 0; +#X connect 4 1 6 1; +#X connect 4 1 16 0; +#X connect 6 0 4 0; +#X connect 7 0 6 0; +#X connect 10 0 12 0; +#X connect 11 0 2 0; +#X connect 12 0 11 0; +#X connect 13 0 9 0; +#X connect 14 0 9 0; +#X connect 16 0 15 0; +#X connect 17 0 43 0; +#X connect 18 0 0 0; +#X connect 20 0 7 0; +#X connect 20 1 21 0; +#X connect 21 0 4 0; +#X connect 22 0 24 0; +#X connect 24 0 20 0; +#X connect 26 0 17 0; +#X connect 27 0 34 0; +#X connect 30 0 22 0; +#X connect 31 0 18 0; +#X connect 31 1 13 0; +#X connect 31 2 1 0; +#X connect 31 3 33 0; +#X connect 34 0 31 0; +#X connect 35 1 46 0; +#X connect 36 0 37 0; +#X connect 37 0 35 0; +#X connect 40 0 24 1; +#X connect 41 0 34 1; +#X connect 43 0 42 0; +#X connect 43 1 34 0; +#X connect 46 0 24 0; +#X connect 46 1 38 0; +#X coords 0 -1 1 1 85 80 1 0 0; diff --git a/sssad/sssad-help.pd b/sssad/sssad-help.pd new file mode 100644 index 0000000..af05e78 --- /dev/null +++ b/sssad/sssad-help.pd @@ -0,0 +1,99 @@ +#N canvas 205 58 722 694 10; +#X obj 177 20 cnv 15 450 25 empty empty empty 10 12 1 12 -1 -262144 +0; +#X obj 174 17 cnv 15 450 25 empty empty empty 10 12 1 12 -176779 -262144 +0; +#X obj 171 14 cnv 15 450 25 empty empty sssad_-_Stupidsupersimplistic-State-Saving_ADVANCED +10 12 1 12 -258699 -262144 0; +#X text 170 73 [sssad] is used for saving and restoring state data +spread around in a patch to a textfile composed of "tagged" messages. +; +#X obj 32 77 sssad key; +#N canvas 489 130 587 611 SSAD-globals 0; +#X obj 24 25 r SSSAD; +#X obj 24 49 spigot; +#X obj 72 47 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 24 71 print SSSAD; +#X obj 22 316 spigot; +#X obj 70 314 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 22 292 r SSSAD_ADMIN; +#X obj 22 338 print SSSAD_ADMIN; +#X text 137 289 SSSAD_ADMIN is used to send administrative messages +to all [sssad] objects.; +#X obj 23 554 s SSSAD_ADMIN; +#X msg 23 464 save; +#X msg 23 415 set; +#X text 21 375 SSSAD_ADMIN accepts the following meta-messages:; +#X text 134 414 set: make all [sssad] objects output their current +values to their outlets.; +#X text 134 464 save: let exactly one [ssssad] object per tag-key send +a message composed of the word "persist" \, the current tag-key and +the values to the receiver called SSSAD_ADMIN.; +#X text 135 514 You may use this to save key/value-data to a [textfile]. +; +#X obj 23 145 s SSSAD; +#X msg 23 120 key 5 6 7 8; +#X obj 24 198 s SSSAD; +#X msg 24 173 list key a b c; +#X text 137 118 It is possible to remotely set a sssad-value through +the SSSAD-receiver; +#X text 135 40 SSSAD is a bus where the current sssad-data is communicated +between [sssad] instances:; +#X connect 0 0 1 0; +#X connect 1 0 3 0; +#X connect 2 0 1 1; +#X connect 4 0 7 0; +#X connect 5 0 4 1; +#X connect 6 0 4 0; +#X connect 10 0 9 0; +#X connect 11 0 9 0; +#X connect 17 0 16 0; +#X connect 19 0 18 0; +#X restore 28 562 pd SSAD-globals; +#X text 172 233 Using [ssssad]; +#X text 171 247 ==============; +#X text 173 274 Using [ssssad] is very simple: [sssad] requires an +obligatory argument to name the key to store data at.; +#X text 169 321 The left inlet will accept a bang and make [sssad] +output the value currently stored at the key used in this [sssad]. +; +#X obj 29 238 sssad key; +#X floatatom 87 211 5 0 0 0 - - -; +#X msg 29 212 bang; +#X obj 29 322 sssad key; +#X msg 29 296 bang; +#X symbolatom 87 297 10 0 0 0 - - -; +#X obj 29 423 sssad key; +#X obj 29 400 t b a; +#X msg 29 375 1 2 3 4; +#X obj 29 264 print @key_1; +#X obj 29 349 print @key_2; +#X obj 29 450 print @key_3; +#X text 171 358 The right inlet will accept anything and will store +that anything in all [sssad] objects of the same key. The right inlet +is *cold* and will not generate any output. Use a [trigger bang anything] +if you want direct output.; +#X obj 29 524 r SSSAD_ADMIN; +#X obj 30 500 r SSSAD; +#X text 173 498 [sssad] uses two global senders and receivers \, which +you can intercept to use for saving data to a file: SSSAD and SSSAD_ADMIN. +; +#X text 173 563 Detailed explanation inside.; +#X obj 29 634 sssad-example; +#X text 170 130 A tagged message in this context is a list-message +of elements whose first element denotes the key of the data \, while +the rest of the message are the values stored under that key.; +#X text 174 632 See [sssad-example] to get inspired for how to use +[sssad] in real life.; +#X connect 10 0 19 0; +#X connect 11 0 10 1; +#X connect 12 0 10 0; +#X connect 13 0 20 0; +#X connect 14 0 13 0; +#X connect 15 0 13 1; +#X connect 16 0 21 0; +#X connect 17 0 16 0; +#X connect 17 1 16 1; +#X connect 18 0 17 0; diff --git a/sssad/sssad.pd b/sssad/sssad.pd new file mode 100644 index 0000000..bb103bd --- /dev/null +++ b/sssad/sssad.pd @@ -0,0 +1,31 @@ +#N canvas 584 398 564 509 10; +#X obj 153 54 inlet; +#X obj 153 417 outlet; +#X obj 153 395 list; +#X obj 176 161 r SSSAD; +#X obj 218 134 s SSSAD; +#X obj 218 112 list prepend \$1; +#X obj 176 189 list trim; +#X obj 218 54 inlet; +#X obj 56 308 r SSSAD_ADMIN; +#X obj 56 356 b; +#X obj 56 334 route set; +#X obj 153 81 b; +#X obj 176 252 route \$1; +#X obj 191 282 s \$0-sssad-data; +#X obj 241 335 _sssad/singleton \$1.SSAD sssad-persistence \$1 \$0; +#X obj 241 362 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X connect 0 0 11 0; +#X connect 2 0 1 0; +#X connect 3 0 6 0; +#X connect 5 0 4 0; +#X connect 6 0 12 0; +#X connect 7 0 5 0; +#X connect 8 0 10 0; +#X connect 9 0 2 0; +#X connect 10 0 9 0; +#X connect 11 0 2 0; +#X connect 12 0 2 1; +#X connect 12 0 13 0; +#X connect 14 0 15 0; diff --git a/sssad/value.pd b/sssad/value.pd new file mode 100644 index 0000000..5b56be6 --- /dev/null +++ b/sssad/value.pd @@ -0,0 +1,11 @@ +#N canvas 363 355 450 300 10; +#X obj 211 36 sssad/auto \$0/value \$1/value; +#X obj 104 116 nbx 5 14 -1e+37 1e+37 0 0 \$0/value \$1/value empty +0 -6 0 8 -260818 -1 -1 0 256; +#X obj 103 157 r \$0/value; +#X obj 103 179 outlet; +#X obj 101 18 inlet; +#X obj 101 39 s \$1/value; +#X connect 2 0 3 0; +#X connect 4 0 5 0; +#X coords 0 -1 1 1 54 34 1 100 100; |