Mercurial > hg > audiodb
changeset 575:7293a11b0fec
Marginally more idiomatic adbpd_setquerytype()
That whole bit of logic is going to go away soon, because those query
type names are a relic -- but it's good to getting it looking reasonable
first.
author | mas01cr |
---|---|
date | Mon, 06 Jul 2009 15:09:54 +0000 |
parents | a082d2babb3d |
children | ae2eeec4d41d |
files | bindings/pd/adbpd.c |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/bindings/pd/adbpd.c Mon Jul 06 15:09:53 2009 +0000 +++ b/bindings/pd/adbpd.c Mon Jul 06 15:09:54 2009 +0000 @@ -357,22 +357,22 @@ /* This sets the query type */ static void adbpd_setquerytype(t_adbpd *x,t_symbol *s,int argc, t_atom *argv){ if (argc == 1 && argv->a_type == A_SYMBOL) { - - // Determine which constant to use based on the string passed. - if(strncmp(argv->a_w.w_symbol->s_name, "track", MAXSTR)==0) + t_symbol *type = atom_getsymbol(argv); + if(type == gensym("track")) { x->x_dbquerytype=O2_TRACK_QUERY; - else if(strncmp(argv->a_w.w_symbol->s_name, "point", MAXSTR)==0) + } else if(type == gensym("point")) { x->x_dbquerytype=O2_POINT_QUERY; - else if(strncmp(argv->a_w.w_symbol->s_name, "sequence", MAXSTR)==0) + } else if(type == gensym("sequence")) { x->x_dbquerytype=O2_SEQUENCE_QUERY; - else if(strncmp(argv->a_w.w_symbol->s_name, "nsequence", MAXSTR)==0) + } else if(type == gensym("nsequence")) { x->x_dbquerytype=O2_N_SEQUENCE_QUERY; - else if(strncmp(argv->a_w.w_symbol->s_name, "onetoonensequence", MAXSTR)==0) + } else if(type == gensym("onetoonensequence")) { x->x_dbquerytype=O2_ONE_TO_ONE_N_SEQUENCE_QUERY; - else - error("unsupported query type"); - - post("Query type has been set to '%s'",argv->a_w.w_symbol->s_name); + } else { + error("unsupported query type: '%s'", type->s_name); + return; + } + post("Query type has been set to '%s'", type->s_name); } } @@ -396,7 +396,7 @@ /* the arguments in this line refer to INPUT ARGUMENTS and not OUTPUTS */ adbpd_class = class_new(gensym("adbpd"),(t_newmethod)adbpd_new,0,sizeof(t_adbpd),0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); - + /* all methods that respond to input must be defined here */ class_addbang(adbpd_class, adbpd_bang); class_addfloat(adbpd_class, adbpd_setqpoint);