aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/param.c24
-rw-r--r--src/param.h2
-rw-r--r--src/paramCustom.c33
-rw-r--r--src/paramFile.c2
4 files changed, 35 insertions, 26 deletions
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;
}