diff options
-rw-r--r-- | help/param-help.pd | 50 | ||||
-rw-r--r-- | src/param.c | 24 | ||||
-rw-r--r-- | src/param.h | 2 | ||||
-rw-r--r-- | src/paramCustom.c | 33 | ||||
-rw-r--r-- | src/paramFile.c | 2 |
5 files changed, 62 insertions, 49 deletions
diff --git a/help/param-help.pd b/help/param-help.pd index 7337060..85aae8e 100644 --- a/help/param-help.pd +++ b/help/param-help.pd @@ -29,7 +29,7 @@ the param object \, at which point the param's name is appended:; name \, will be used to build the path. See an example to the right. ; #X floatatom 556 110 5 0 0 0 - - -; -#X text 53 585 --------------------- SEE ALSO ----------------------- +#X text 53 475 --------------------- SEE ALSO ----------------------- ; #X obj 496 359 dac~; #X obj 717 280 hsl 100 15 0 1 0 0 \$0/FM_MOD/volume \$0/FM_MOD/volume_ @@ -45,20 +45,20 @@ name \, will be used to build the path. See an example to the right. #X obj 544 283 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X obj 556 84 tof/param /number 30 /g nbx; -#X obj 22 613 tof/paramFile; -#X obj 118 613 tof/paramRoute; -#X obj 217 613 tof/OSCToParam; -#X obj 322 613 tof/paramDump; -#X obj 25 637 tof/paramGui; +#X obj 22 503 tof/paramFile; +#X obj 118 503 tof/paramRoute; +#X obj 217 503 tof/OSCToParam; +#X obj 322 503 tof/paramDump; +#X obj 25 527 tof/paramGui; #X obj -10 149 print loadbang; #X obj -10 125 tof/param /my_name my_value; #X text 553 126 /g options:; #X text 556 44 When you create a param \, you can optinally use the "/g" keyword to flag the param with gui options.; #X obj 504 330 param-abs /id FM_MOD /carrier 600; -#X floatatom 613 531 5 0 0 0 - - -; -#X obj 613 508 tof/param /test 50 /nlb; -#X text 500 465 A param automatically ouputs its value when it is created. +#X floatatom 613 481 5 0 0 0 - - -; +#X obj 613 458 tof/param /test 50 /nlb; +#X text 500 415 A param automatically ouputs its value when it is created. You can disable this behavior with the "/nlb" (no loadbang) keyword. ; #X msg 504 259 /modulation/index \$1; @@ -66,21 +66,25 @@ You can disable this behavior with the "/nlb" (no loadbang) keyword. #X text 179 139 argument 2...: param value (can be anything; #X text 3 389 Abstraction /id:; #X text 498 27 /g keyword: GUI options; -#X text 466 393 /ns keyword: No save; -#X text 469 443 /nlb keyword: No loadbang; -#X text 497 415 This param will never be saved.; +#X text 4 577 /ns keyword: No save; +#X text 469 393 /nlb keyword: No loadbang; +#X text 35 598 This param will never be saved.; #X text 179 155 argument ...: special keywords; -#X text 544 8 ----------------- SPECIAL KEYWORDS ------------------- +#X text 475 507 /wfb keyword: Wait for bang; +#X text 507 529 This param will only output its contents on a bang. ; -#X text 475 557 /wfb keyword: Wait for bang; -#X text 507 579 This param will only output its contents on a bang. -; -#X obj 614 393 tof/param /nope 50 /ns; -#X obj 500 629 tof/param /waiting 50 /wfb; +#X obj 152 576 tof/param /nope 50 /ns; +#X obj 500 579 tof/param /waiting 50 /wfb; +#X floatatom 500 552 5 0 0 0 - - -; #X floatatom 500 602 5 0 0 0 - - -; -#X floatatom 500 652 5 0 0 0 - - -; -#X obj 544 605 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +#X obj 544 555 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; +#X text 544 8 -------------- SPECIAL KEYWORDS (continued) -------------- +; +#X text 71 553 -------------- SPECIAL KEYWORDS --------------; +#X text 4 630 /nps keyword: No preset save; +#X text 35 652 This param will never be saved in a preset file.; +#X obj 203 630 tof/param /noPresets 67 /nps; #X connect 0 0 40 0; #X connect 25 0 41 0; #X connect 26 0 18 0; @@ -90,6 +94,6 @@ You can disable this behavior with the "/nlb" (no loadbang) keyword. #X connect 38 0 37 0; #X connect 40 0 36 0; #X connect 41 0 36 0; -#X connect 53 0 55 0; -#X connect 54 0 53 0; -#X connect 56 0 53 0; +#X connect 52 0 54 0; +#X connect 53 0 52 0; +#X connect 55 0 52 0; diff --git a/src/param.c b/src/param.c index 0d29ac3..473f172 100644 --- a/src/param.c +++ b/src/param.c @@ -45,6 +45,7 @@ typedef struct _paramClass { t_symbol* send; t_symbol* set_s; int nowaitforbang; + int nopresets; } t_paramClass; typedef struct _paramClass_inlet2 @@ -127,7 +128,15 @@ static void paramClass_get(t_paramClass *x, t_symbol** s, int* ac, t_atom** av) } // SPECIAL PARAM SAVE FUNCTION -static void paramClass_save(t_paramClass *x, t_binbuf* bb) { +static void paramClass_save(t_paramClass *x, t_binbuf* bb,int f) { + + //post("save:%i",f); + + + // f = -1 for the main save file + // f => 0 if it is a preset + if ( f >= 0 && x->nopresets) return; + //Put my data in binbuf if ((x->selector != &s_bang)) { int ac = x->ac + 2; @@ -180,20 +189,27 @@ static void* paramClass_new(t_symbol *s, int ac, t_atom *av) x->noloadbang = tof_find_tag('/',gensym("/nlb"), ac-1, av+1); //post("nlb: %i",x->noloadbang); + + + // FIND THE WAIT FOR BANG TAG: /wfb + x->nowaitforbang = !(tof_find_tag('/',gensym("/wfb"), ac-1, av+1)); // FIND THE NO SAVE TAG: /ns int nosave = tof_find_tag('/',gensym("/ns"), ac-1, av+1); //post("ns: %i",nosave); - // FIND THE WAIT FOR BANG TAG: /wfb - x->nowaitforbang = !(tof_find_tag('/',gensym("/wfb"), ac-1, av+1)); + // FIND THE NO PRESET TAG: /nps + x->nopresets = tof_find_tag('/',gensym("/nps"), ac-1, av+1); // REGISTER PARAM t_paramSaveMethod paramSaveMethod = NULL; t_paramGUIMethod paramGUIMethod = NULL; + + //post("no save:%i",nosave); + if ( x->gac > 0 ) paramGUIMethod = (t_paramGUIMethod) paramClass_GUI; - if ( nosave = 0 ) paramSaveMethod = (t_paramSaveMethod) paramClass_save; + if ( nosave == 0 ) paramSaveMethod = (t_paramSaveMethod) paramClass_save; x->param = param_register(x,root,path, \ (t_paramGetMethod) paramClass_get, \ diff --git a/src/param.h b/src/param.h index a6f9686..9782ee1 100644 --- a/src/param.h +++ b/src/param.h @@ -1,7 +1,7 @@ //#define PARAMDEBUG typedef void (*t_paramGetMethod)(void*,t_symbol**,int*,t_atom**); -typedef void (*t_paramSaveMethod)(void*,t_binbuf*); +typedef void (*t_paramSaveMethod)(void*,t_binbuf*,int); typedef void (*t_paramGUIMethod)(void*,int*,t_atom**); char param_buf_temp_a[MAXPDSTRING]; diff --git a/src/paramCustom.c b/src/paramCustom.c index 20144ba..9b23461 100644 --- a/src/paramCustom.c +++ b/src/paramCustom.c @@ -15,6 +15,7 @@ typedef struct _paramCustom { t_binbuf* bb; t_symbol* receive; struct _paramCustom_receive* r; + int nopresets; } t_paramCustom; typedef struct _paramCustom_receive @@ -85,7 +86,11 @@ static void paramClass_get(t_paramClass *x, t_symbol** s, int* ac, t_atom** av) */ // SPECIAL PARAM SAVE FUNCTION -static void paramCustom_save(t_paramCustom *x, t_binbuf* bb) { +static void paramCustom_save(t_paramCustom *x, t_binbuf* bb, int f) { + + // f = -1 for the main save file + // f => 0 if it is a preset + if ( f >= 0 && x->nopresets) return; if ( !x->bb ) { @@ -98,27 +103,10 @@ static void paramCustom_save(t_paramCustom *x, t_binbuf* bb) { } else { pd_error(x,"paramCustom is already saving"); } - /* - if ((x->selector != &s_bang)) { - int ac = x->ac + 2; - t_atom *av = getbytes(ac*sizeof(*av)); - tof_copy_atoms(x->av,av+2,x->ac); - SETSYMBOL(av, x->param->path); - SETSYMBOL(av+1, x->selector); - binbuf_add(bb, ac, av); - binbuf_addsemi(bb); - freebytes(av, ac*sizeof(*av)); - } - */ + } -// SPECIAL PARAM GUI FUNCTION -/* -static void paramClass_GUI(t_paramClass *x, int* ac, t_atom** av) { - *ac = x->gac; - *av = x->gav; -} -*/ + static void paramCustom_receive_anything(t_paramCustom_receive *r, t_symbol *s, int ac, t_atom *av){ @@ -146,6 +134,11 @@ static void* paramCustom_new(t_symbol *s, int ac, t_atom *av) t_symbol* path = param_get_path(canvas,name); t_symbol* root = tof_get_dollarzero(tof_get_root_canvas(canvas)); + // FIND THE NO PRESET TAG: /nps + x->nopresets = tof_find_tag('/',gensym("/nps"), ac-1, av+1); + + + x->param = param_register(x,root,path,\ NULL,\ (t_paramSaveMethod) paramCustom_save,\ diff --git a/src/paramFile.c b/src/paramFile.c index bff64b0..ed7eaeb 100644 --- a/src/paramFile.c +++ b/src/paramFile.c @@ -70,7 +70,7 @@ static void paramFile_do_save(t_paramFile* x, t_float f) { while(p) { - if ( p->save ) p->save(p->x,bbuf); + if ( p->save ) p->save(p->x,bbuf,f); p = p->next; } |