From e2377f078623cb33813ba4f5acb56adeb9d119aa Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Sat, 24 Oct 2009 23:51:37 +0000 Subject: Fixed a little bug in param route svn path=/trunk/externals/tof/; revision=12666 --- src/Makefile | 3 +- src/paramRoute.h | 84 +++++++++++++++++++------------------------------------- 2 files changed, 30 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 62e263d..e6c1ea4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,5 @@ -default: +default: argument crossfade~ iterate param breakpoints~ folderpanel listUnfold path breakpoints getdollarzero onlyone phasorshot~ common~ increment openHelp streamMinMax -PARAM: param paramDump paramRoute paramFile paramCustom paramId paramGui current: echo make class diff --git a/src/paramRoute.h b/src/paramRoute.h index a17d1a9..b5d862f 100644 --- a/src/paramRoute.h +++ b/src/paramRoute.h @@ -4,69 +4,43 @@ static t_class *paramRoute_class; typedef struct _paramRoute { - t_object x_obj; - t_symbol *path; - t_outlet *x_outlet; - t_symbol *s_save; - t_symbol *s_load; - t_symbol* s_empty; - t_canvas* canvas; - t_symbol* root; + t_object x_obj; + t_symbol* path; + t_outlet* x_outlet; + t_symbol* s_save; + t_symbol* s_load; + t_symbol* s_empty; + t_canvas* canvas; + t_symbol* root; } t_paramRoute; static void paramRoute_anything(t_paramRoute *x, t_symbol *s, int ac, t_atom *av) { - //I DEACTIVATED THE SAVE & LOAD FEATURES UNTIL I BETTER DEFINE PARAMROUTE'S STATE SAVING + + // t_symbol* path; + t_symbol* target; - if (s == x->s_save) { // Save - - //~ if (x->id) { - //~ int n = 0; - //~ if ( ac ) n = atom_getfloat(av); - //~ t_symbol* filename = paramRoute_makefilename(x->id,n); - //~ if ( param_write(x->canvas,filename, x->id) ) - //~ pd_error("[paramRoute] could not write %s",filename->s_name); - //~ } else { - //~ pd_error(x,"[paramRoute] requires an /id"); - //~ } - } else if ( s == x->s_load) { // Load - //~ if (x->id) { - //~ int n = 0; - //~ if ( ac ) n = atom_getfloat(av); - //~ t_symbol* filename = paramRoute_makefilename(x->id,n); - //~ if ( param_read(x->canvas, paramRoute_makefilename(x->id,n)) ) - //~ pd_error("[paramRoute] could not read %s",filename->s_name);; - //~ } else { - //~ pd_error(x,"[paramRoute] requires an /id"); - //~ } - } else { // Try to send - + if (ac) { - //int sendBufLength = strlen(x->path->s_name) + strlen(s->s_name) + 1; - //char *sendBuf = (char*)getbytes((sendBufLength)*sizeof(char)); - if ( s->s_name[0] == '/' && strlen(s->s_name) > 1) { - strcpy(param_buf_temp_a, x->root->s_name); - strcpy(param_buf_temp_b, x->path->s_name); - - strcat(param_buf_temp_b, s->s_name+1); - t_symbol* path = gensym(param_buf_temp_b); - strcat(param_buf_temp_a, param_buf_temp_b); - t_symbol* target = gensym(param_buf_temp_a); - //freebytes(sendBuf, (sendBufLength)*sizeof(char)); - //post("target:%s",target->s_name); - if (target->s_thing) { - pd_forwardmess(target->s_thing, ac, av); - } else { - outlet_anything(x->x_outlet,path,ac,av); - } - } else { - outlet_anything(x->x_outlet,path,ac,av); - //pd_error(x,"Target name must start with a \"/\""); - } - } - + if ( s->s_name[0] == '/' && strlen(s->s_name) > 1) { + strcpy(param_buf_temp_a, x->root->s_name); + strcpy(param_buf_temp_b, x->path->s_name); + + strcat(param_buf_temp_b, s->s_name+1); + //path = gensym(param_buf_temp_b); + strcat(param_buf_temp_a, param_buf_temp_b); + target = gensym(param_buf_temp_a); + + if (target->s_thing) { + pd_forwardmess(target->s_thing, ac, av); + } else { + outlet_anything(x->x_outlet,s,ac,av); + } + } else { + outlet_anything(x->x_outlet,s,ac,av); + } } } -- cgit v1.2.1