aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas O Fredericks <mrtof@users.sourceforge.net>2009-09-29 21:38:55 +0000
committerThomas O Fredericks <mrtof@users.sourceforge.net>2009-09-29 21:38:55 +0000
commitb95a41d4163666368971d39c2a8d9af64501d36c (patch)
treecc2b949c5ad8db8e6ffdd960d50b2b66ce86a9e9
parentc6750d375d8fcf3705b8992c8c9f5006a2bb0716 (diff)
Make paramRoute require a /
svn path=/trunk/externals/tof/; revision=12493
-rw-r--r--src/param.c3
-rw-r--r--src/paramRoute.c45
-rw-r--r--src/wrapper.c81
3 files changed, 7 insertions, 122 deletions
diff --git a/src/param.c b/src/param.c
index ac061fa..6551748 100644
--- a/src/param.c
+++ b/src/param.c
@@ -199,11 +199,8 @@ static void *param_new(t_symbol *s, int ac, t_atom *av)
pd_error(x,"Could not create param. See possible errors above.");
}
-
-
-
return (x);
}
diff --git a/src/paramRoute.c b/src/paramRoute.c
index 4e4f756..44db9e7 100644
--- a/src/paramRoute.c
+++ b/src/paramRoute.c
@@ -41,41 +41,7 @@ typedef struct _paramRoute
} t_paramRoute;
-/*
-static t_symbol* paramRoute_makefilename( t_symbol *basename, t_float n) {
-
-
-
- int d = (int) n;
- int length = strlen(basename->s_name);
- char* buf = getbytes( (length + 6) * sizeof (*buf));
- char* number = getbytes( 6 * sizeof (*number));
-
- int i;
- int j = 0;
- for ( i=0; i< length; i++ ) {
- if ( (basename->s_name)[i] != '/' ) {
- buf[j] = (basename->s_name)[i];
- j++;
- }
- }
- buf[j] = '\0';
-
- if ( strlen(buf) == 0 ) {
- sprintf(number,"p%03d",d);
- } else {
- sprintf(number,".p%03d",d);
- }
-
- strcat(buf,number);
- t_symbol* filename = gensym(buf);
- freebytes(number, 6 * sizeof (*number));
- freebytes(buf, (length + 6) * sizeof (*buf));
-
- post("File name:%s",filename->s_name);
- return filename;
-}
-*/
+
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
@@ -106,10 +72,11 @@ static void paramRoute_anything(t_paramRoute *x, t_symbol *s, int ac, t_atom *av
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);
+
+ 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);
@@ -120,7 +87,9 @@ static void paramRoute_anything(t_paramRoute *x, t_symbol *s, int ac, t_atom *av
} else {
outlet_anything(x->x_outlet,path,ac,av);
}
-
+ } else {
+ pd_error(x,"Target name must start with a \"/\"");
+ }
}
}
diff --git a/src/wrapper.c b/src/wrapper.c
deleted file mode 100644
index 8d0ec5e..0000000
--- a/src/wrapper.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include "m_pd.h"
-#include <math.h>
-
-static t_class *wrapper_class;
-
-typedef struct _wrapper {
- t_object x_obj;
-
- t_float min;
- t_float max;
- //t_int iterating;
- t_outlet* outlet1;
- //t_outlet* outlet2;
-} t_wrapper;
-
-/*
-void wrapper_bang(t_wrapper *x)
-{
- //x->i_count = x->i_down;
- x->iterating = 0;
-
-}
-*/
-
-void wrapper_float(t_wrapper *x, t_float f)
-{
-
- t_float value = fmod(f - x->min ,x->max - x->min);
- if ( value < 0 ) value = value + x->max;
- else value = value + x->min;
-
- outlet_float(x->outlet1, value);
-
-
-}
-
-
-
-static void wrapper_free(t_wrapper *x)
-{
-
-
-}
-
-void *wrapper_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_wrapper *x = (t_wrapper *)pd_new(wrapper_class);
-
-
- if ( argc >= 2) {
- x->min = atom_getfloat(argv);
- x->max = atom_getfloat(argv+1);
- } else if ( argc == 1) {
- x->min = 0;
- x->max = atom_getfloat(argv);
- } else {
- x->min = 0;
- x->max = 1;
- }
-
- floatinlet_new(&x->x_obj, &x->min);
- floatinlet_new(&x->x_obj, &x->max);
- x->outlet1 = outlet_new(&x->x_obj, &s_float);
-
-
-
- return (void *)x;
-}
-
-void wrapper_setup(void) {
- wrapper_class = class_new(gensym("wrapper"),
- (t_newmethod)wrapper_new,
- (t_method)wrapper_free, sizeof(t_wrapper),
- CLASS_DEFAULT,
- A_GIMME, 0);
-
- //class_addbang (wrapper_class, wrapper_bang);
- class_addfloat (wrapper_class, wrapper_float);
- //class_addlist (wrapper_class, wrapper_list);
-
-}