aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/param.c7
-rw-r--r--src/paramCustom.h55
-rw-r--r--src/paramFile.h54
-rw-r--r--src/paramRoute.h21
4 files changed, 80 insertions, 57 deletions
diff --git a/src/param.c b/src/param.c
index fc2daf0..9464a40 100644
--- a/src/param.c
+++ b/src/param.c
@@ -19,9 +19,16 @@
* MA 02110-1301, USA.
*/
+// Post a lot of debug messages
//#define PARAMDEBUG
+
+// Adds the root's $0 to the start of the paths
//#define LOCAL
+// Uses the symbol's s_thing to target the proper param
+// This is faster but can potentially target two params
+#define USEBINDINGS
+
#include "param.h"
#include "paramCustom.h"
#include "paramDump.h"
diff --git a/src/paramCustom.h b/src/paramCustom.h
index db1e66e..df3eba1 100644
--- a/src/paramCustom.h
+++ b/src/paramCustom.h
@@ -10,7 +10,9 @@ typedef struct _paramCustom {
t_outlet* outlet;
t_outlet* outlet2;
t_binbuf* bb;
- //t_symbol* receive;
+ #ifdef USEBINDINGS
+ t_symbol* receive;
+ #endif
struct _paramCustom_receive* r;
int nopresets;
} t_paramCustom;
@@ -23,22 +25,6 @@ typedef struct _paramCustom_receive
-static void paramCustom_bang(t_paramCustom *x)
-{
- /*
- outlet_anything(x->outlet, x->selector, x->ac, x->av);
-
- if(x->selector != &s_bang ) tof_send_anything_prepend(x->send,x->selector,x->ac,x->av,x->set_s );
- */
-}
-/*
-
-static void paramClass_loadbang(t_paramClass *x)
-{
- if (!sys_noloadbang && !x->noloadbang)
- paramClass_bang(x);
-}
-*/
static void paramCustom_anything(t_paramCustom *x, t_symbol *selector, int argc, t_atom *argv)
{
@@ -65,9 +51,10 @@ static void paramCustom_anything(t_paramCustom *x, t_symbol *selector, int argc,
static void paramCustom_free(t_paramCustom *x)
{
+ #ifdef USEBINDINGS
+ if (x->receive) pd_unbind(&x->r->x_obj.ob_pd, x->receive);
+ #endif
- //if (x->receive) pd_unbind(&x->r->x_obj.ob_pd, x->receive);
-
if (x->param) param_unregister(x->param);
@@ -140,23 +127,31 @@ static void* paramCustom_new(t_symbol *s, int ac, t_atom *av)
x->r = r;
r->owner = x;
- // BIND RECEIVER
- //pd_bind(&r->x_obj.ob_pd, x->receive );
x->param = param_register(r,root,path, NULL,\
(t_paramSaveMethod) paramCustom_save,NULL);
if (!x->param) return NULL;
-
- int l = strlen(path->s_name) + strlen(root->s_name) + 2;
- char* receiver = getbytes( l * sizeof(*receiver));
- strcat(receiver,root->s_name);
- strcat(receiver,path->s_name);
- //x->receive = gensym(receiver);
-
- freebytes(receiver, l * sizeof(*receiver));
+ #ifdef USEBINDINGS
+
+ #ifdef LOCAL
+ int l = strlen(path->s_name) + strlen(root->s_name) + 2;
+ char* receiver = getbytes( l * sizeof(*receiver));
+ receiver[0] = '\0';
+ strcat(receiver,root->s_name);
+ strcat(receiver,path->s_name);
+ x->receive = gensym(receiver);
+ freebytes(receiver, l * sizeof(*receiver));
+ #else
+ x->receive = path;
+ #endif
+
+ pd_bind(&r->x_obj.ob_pd, x->receive );
+ #endif
+
+
#ifdef PARAMDEBUG
post("receive:%s",x->receive->s_name);
@@ -188,7 +183,7 @@ void paramCustom_setup(void)
class_addanything(paramCustom_class, paramCustom_anything);
- class_addbang(paramCustom_class, paramCustom_bang);
+ //class_addbang(paramCustom_class, paramCustom_bang);
//class_addmethod(param_class, (t_method)paramClass_loadbang, gensym("loadbang"), 0);
diff --git a/src/paramFile.h b/src/paramFile.h
index 66d016c..fad3ea6 100644
--- a/src/paramFile.h
+++ b/src/paramFile.h
@@ -103,11 +103,12 @@ static void paramFile_do_load(t_paramFile* x, t_float f) {
t_symbol* root = x->root;
-
+ #ifndef USEBINDINGS
t_param* pp = get_param_list(root);
t_param* p;
if (pp) {
+ #endif
int r_error;
t_binbuf *bbuf = binbuf_new();
@@ -123,22 +124,28 @@ static void paramFile_do_load(t_paramFile* x, t_float f) {
while (bb_ac--) {
if (bb_av->a_type == A_SEMI) {
if ( IS_A_SYMBOL(av,0) && ac > 1) {
- /*
- #ifdef LOCAL
- t_symbol* path = atom_getsymbol(av);
- strcpy(param_buf_temp_a,root->s_name);
- strcat(param_buf_temp_a,path->s_name);
- t_symbol* s = gensym(param_buf_temp_a);
+ #ifdef USEBINDINGS
+ #ifdef LOCAL
+ t_symbol* path = atom_getsymbol(av);
+ strcpy(param_buf_temp_a,root->s_name);
+ strcat(param_buf_temp_a,path->s_name);
+ s = gensym(param_buf_temp_a);
+ #else
+ s = atom_getsymbol(av);
+ #endif
#else
- t_symbol* s = atom_getsymbol(av);
- #endif
- */
- s = atom_getsymbol(av);
- p = pp;
- while(p && p->path != s) p=p->next;
-
+ s = atom_getsymbol(av);
+ p = pp;
+ while(p && p->path != s) p=p->next;
+ #endif
- if (p) {
+
+ #ifdef USEBINDINGS
+ if (s->s_thing) {
+ #else
+ if (p) {
+ #endif
+
if ( ac > 3 && IS_A_SYMBOL(av,1) && atom_getsymbol(av+1) == &s_symbol) {
// STUPID MANAGEMENT OF SYMBOLS WITH SPACES
// This whole block is simply to convert symbols saved with spaces to complete symbols
@@ -157,11 +164,21 @@ static void paramFile_do_load(t_paramFile* x, t_float f) {
binbuf_free(bbuf_stupid);
t_atom* stupid_atom = getbytes(sizeof(*stupid_atom));
SETSYMBOL(stupid_atom, stupid_symbol);
- pd_typedmess(p->x, &s_symbol, 1, stupid_atom);
+
+ #ifdef USEBINDINGS
+ pd_typedmess(s->s_thing, &s_symbol, 1, stupid_atom);
+ #else
+ pd_typedmess(p->x, &s_symbol, 1, stupid_atom);
+ #endif
freebytes(stupid_atom, sizeof(*stupid_atom));
} else {
- pd_forwardmess(p->x, ac-1, av+1);
+ #ifdef USEBINDINGS
+ pd_forwardmess(s->s_thing, ac-1, av+1);
+ #else
+ pd_forwardmess(p->x, ac-1, av+1);
+ #endif
+
}
}
}
@@ -178,8 +195,9 @@ static void paramFile_do_load(t_paramFile* x, t_float f) {
binbuf_free(bbuf);
if ( r_error) pd_error(x, "%s: read failed", filename->s_name);
+ #ifndef USEBINDINGS
}
-
+ #endif
x->working = 0;
diff --git a/src/paramRoute.h b/src/paramRoute.h
index c336367..5d94e30 100644
--- a/src/paramRoute.h
+++ b/src/paramRoute.h
@@ -18,16 +18,15 @@ typedef struct _paramRoute
static void paramRoute_anything(t_paramRoute *x, t_symbol *s, int ac, t_atom *av) {
-
+
+ #ifndef USEBINDINGS
t_param* p = get_param_list(x->root);
-
+ #endif
if (ac) {
- if ( p != NULL && s->s_name[0] == '/' && strlen(s->s_name) > 1) {
-
-
-
-
+
+ if ( s->s_name[0] == '/' && strlen(s->s_name) > 1) {
+
if (x->previousSymbol != s) {
param_buf_temp_a[0] = '\0';
#ifdef LOCAL
@@ -43,15 +42,19 @@ static void paramRoute_anything(t_paramRoute *x, t_symbol *s, int ac, t_atom *av
#endif
x->previousSymbol = s;
}
-
+ #ifdef USEBINDINGS
+ if (x->target->s_thing) {
+ pd_forwardmess(x->target->s_thing, ac, av);
+ #else
while (p && p->path != x->target) p=p->next;
if (p) {
pd_forwardmess(p->x, ac, av);
+ #endif
} else {
outlet_anything(x->x_outlet,s,ac,av);
}
-
+
} else {
outlet_anything(x->x_outlet,s,ac,av);