aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas O Fredericks <mrtof@users.sourceforge.net>2009-09-29 19:22:00 +0000
committerThomas O Fredericks <mrtof@users.sourceforge.net>2009-09-29 19:22:00 +0000
commitc6750d375d8fcf3705b8992c8c9f5006a2bb0716 (patch)
treea491bb2121ab76af7883ddc726f0893eb149c4e9
parent83227fad7fabe67f633bc254796d576baa8390d3 (diff)
Added a loadbang to param
svn path=/trunk/externals/tof/; revision=12492
-rw-r--r--src/Makefile1
-rw-r--r--src/param.c33
2 files changed, 28 insertions, 6 deletions
diff --git a/src/Makefile b/src/Makefile
index 8d83e14..b064d5d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -31,3 +31,4 @@ LINUXINCLUDE = -I$(PDPATH)/src
ld --export-dynamic -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
rm $*.o
+ mv $*.pd_linux ~/pd-externals/tof
diff --git a/src/param.c b/src/param.c
index 00b2fe8..ac061fa 100644
--- a/src/param.c
+++ b/src/param.c
@@ -25,8 +25,7 @@
#include "tof.h"
#include "param.h"
-
-
+extern int sys_noloadbang;
static t_class *param_class;
static t_class *param_inlet2_class;
@@ -42,6 +41,7 @@ typedef struct _param
//t_symbol *x_update_gui;
t_symbol *s_set;
struct param *x_param;
+ int noloadbang;
} t_param;
typedef struct _param_inlet2
@@ -51,6 +51,9 @@ typedef struct _param_inlet2
} t_param_inlet2;
+
+
+
static void param_bang(t_param *x)
{
if ( x->x_param) {
@@ -61,6 +64,12 @@ static void param_bang(t_param *x)
}
}
+static void param_loadbang(t_param *x)
+{
+ if (!sys_noloadbang && !x->noloadbang)
+ param_bang(x);
+}
+
static void param_anything(t_param *x, t_symbol *s, int ac, t_atom *av)
{
#ifdef PARAMDEBUG
@@ -152,14 +161,24 @@ static void *param_new(t_symbol *s, int ac, t_atom *av)
//}
}
+
+ // FIND THE NO LOADBANG TAG: /nlb
+ int i;
+ x->noloadbang = 0;
+
+ for ( i =0; i < ac; i++) {
+ if ( IS_A_SYMBOL(av,i) && (strcmp("/nlb",atom_getsymbol(av+i)->s_name) == 0)) {
+ x->noloadbang = 1;
+ break;
+ }
+ }
-
- //FIND THE GUI TAGS
+ //FIND THE GUI OPTIONS: /g
int ac_g = 0;
t_atom* av_g = NULL;
- // There could be a problem if the the name is also /gui
- tof_find_tagged_argument('/',gensym("/gui"), ac, av,&ac_g,&av_g);
+ // There could be a problem if the the name is also /g
+ tof_find_tagged_argument('/',gensym("/g"), ac, av,&ac_g,&av_g);
x->x_param = param_register(root,path,ac_p,av_p,ac_g,av_g);
@@ -198,6 +217,8 @@ void param_setup(void)
class_addanything(param_class, param_anything);
class_addbang(param_class, param_bang);
+ class_addmethod(param_class, (t_method)param_loadbang, gensym("loadbang"), 0);
+
param_inlet2_class = class_new(gensym("_param_inlet2"),
0, 0, sizeof(t_param_inlet2), CLASS_PD | CLASS_NOINLET, 0);