aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--abs/paramGui.pd96
-rw-r--r--help/param-abs.pd5
-rw-r--r--help/paramDump-help.pd29
-rw-r--r--help/paramGui-help.pd62
-rw-r--r--src/Makefile2
-rw-r--r--src/param.c21
-rw-r--r--src/param.h22
-rw-r--r--src/paramCustom.c3
-rw-r--r--src/paramDump.c96
-rw-r--r--src/paramRoute.c2
-rw-r--r--src/tof.h9
-rw-r--r--test/test.c97
12 files changed, 276 insertions, 168 deletions
diff --git a/abs/paramGui.pd b/abs/paramGui.pd
deleted file mode 100644
index d3305ed..0000000
--- a/abs/paramGui.pd
+++ /dev/null
@@ -1,96 +0,0 @@
-#N canvas 1036 0 997 698 10;
-#N canvas 438 313 450 315 \$0target 0;
-#X restore 77 109 pd \$0target;
-#X obj 260 140 list split 1;
-#X obj 101 566 s pd-\$0target;
-#X obj 273 341 list prepend;
-#X obj 371 366 list trim;
-#X obj 423 199 value \$0y;
-#X obj -156 281 value \$0y;
-#X obj -112 311 t f f;
-#X obj 497 164 s pd-\$0target;
-#X obj 266 106 paramDump;
-#X obj 323 -167 inlet path;
-#X obj 316 -119 route bang;
-#X obj 375 -93 symbol;
-#X obj 299 -27 t b a b b;
-#X msg 110 182 vis 1;
-#X obj -62 285 + 20;
-#X obj 434 277 list split 1;
-#X obj 379 341 list;
-#X obj 294 -79 symbol *;
-#X msg 272 57 guis \$1;
-#X obj 0 302 zexy/makesymbol %s%s%s;
-#X msg 0 278 list $ 0 \$1;
-#X msg 89 279 list $ 0 \$1_;
-#X obj 54 344 zexy/makesymbol %s%s%s;
-#X obj -2 210 t b a a a;
-#X obj -5 386 pack f s s s;
-#X msg -37 460 obj 0 \$1 bng 15 250 50 0 \$2 \$3 \$4 17 7 0 8 -262144
--1 -1;
-#X msg 132 483 obj 0 \$1 nbx 5 14 -1e+37 1e+37 0 0 \$2 \$3 \$4 48 7
-0 8 -262144 -1 -1 0 256;
-#X msg 527 521 obj 0 \$1 hsl 100 15 \$5 \$6 0 0 \$2 \$3 \$4 105 7 0
-8 -262144 -1 -1 0 1;
-#X msg 528 476 obj 0 \$1 tgl 15 0 \$2 \$3 \$4 17 7 0 8 -262144 -1
--1 0 1;
-#X msg 490 451 symbolatom 0 \$1 17 0 0 1 \$4 \$3 \$2;
-#X msg 496 89 clear \, text 0 0 YOU MUST COPY AND PASTE THE FOLLOWING
-INTERFACES INSIDE THE ROOT PATCH OR INSIDE A SUBPATCH OF THE ROOT PATCH
-OR THEY WILL NOT WORK!;
-#X msg 419 159 50;
-#X msg 612 151 vis 0 \, clear;
-#X msg 904 468 text 0 \$1 OUPS! Unknown gui type for param \$4;
-#X obj 369 390 route bng nbx slider symbolatom tgl radio knob;
-#X msg 581 327 obj 0 \$1 hradio 15 1 0 \$5 \$2 \$3 \$4 107 7 0 10 -262144
--1 -1 0;
-#X connect 1 0 24 0;
-#X connect 1 1 16 0;
-#X connect 3 0 17 0;
-#X connect 4 0 35 0;
-#X connect 6 0 7 0;
-#X connect 7 0 25 0;
-#X connect 7 1 15 0;
-#X connect 9 0 1 0;
-#X connect 10 0 11 0;
-#X connect 11 0 18 0;
-#X connect 11 1 12 0;
-#X connect 12 0 13 0;
-#X connect 13 0 14 0;
-#X connect 13 1 19 0;
-#X connect 13 2 32 0;
-#X connect 13 3 31 0;
-#X connect 14 0 2 0;
-#X connect 15 0 6 0;
-#X connect 16 0 3 1;
-#X connect 16 1 17 1;
-#X connect 17 0 4 0;
-#X connect 18 0 13 0;
-#X connect 19 0 9 0;
-#X connect 20 0 25 1;
-#X connect 21 0 20 0;
-#X connect 22 0 23 0;
-#X connect 23 0 25 2;
-#X connect 24 0 6 0;
-#X connect 24 1 21 0;
-#X connect 24 2 22 0;
-#X connect 24 3 25 3;
-#X connect 25 0 3 0;
-#X connect 26 0 2 0;
-#X connect 27 0 2 0;
-#X connect 28 0 2 0;
-#X connect 29 0 2 0;
-#X connect 30 0 2 0;
-#X connect 31 0 8 0;
-#X connect 32 0 5 0;
-#X connect 33 0 8 0;
-#X connect 34 0 2 0;
-#X connect 35 0 26 0;
-#X connect 35 1 27 0;
-#X connect 35 2 28 0;
-#X connect 35 3 30 0;
-#X connect 35 4 29 0;
-#X connect 35 5 36 0;
-#X connect 35 6 28 0;
-#X connect 35 7 34 0;
-#X connect 36 0 2 0;
diff --git a/help/param-abs.pd b/help/param-abs.pd
index 65d28c9..90223e2 100644
--- a/help/param-abs.pd
+++ b/help/param-abs.pd
@@ -1,4 +1,4 @@
-#N canvas 6 0 1018 692 10;
+#N canvas 6 0 1018 686 10;
#X obj 225 477 outlet~;
#X obj 55 21 inlet;
#X text 179 26 This abstraction is an example for the param external.
@@ -18,6 +18,8 @@
#X obj 317 349 tof/param /volume 0 /g slider 0 1;
#X obj 223 202 tof/param /carrier 800 /g slider 200 2000;
#X obj 55 66 tof/paramRoute;
+#X obj 660 195 iemguts/propertybang;
+#X obj 660 223 tof/paramGui;
#X connect 1 0 17 0;
#X connect 3 0 4 0;
#X connect 4 0 7 0;
@@ -31,3 +33,4 @@
#X connect 15 0 12 0;
#X connect 16 0 3 0;
#X connect 17 0 8 0;
+#X connect 18 0 19 0;
diff --git a/help/paramDump-help.pd b/help/paramDump-help.pd
index 1606ddd..82902fd 100644
--- a/help/paramDump-help.pd
+++ b/help/paramDump-help.pd
@@ -1,6 +1,5 @@
-#N canvas 238 80 610 462 10;
-#X obj 38 195 paramDump;
-#X obj 38 228 print;
+#N canvas 1257 140 623 501 10;
+#X obj 38 259 print;
#X obj 38 129 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 21 12 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577
@@ -9,17 +8,25 @@
#X text 26 89 version: 2009-09-19 (localized version);
#X text 26 13 description: outputs all the children params of the root
patch.;
-#X obj 205 227 param-abs /id FM_MOD;
-#X text 69 273 --------------------- SEE ALSO -----------------------
+#X obj 149 266 param-abs /id FM_MOD;
+#X text 69 304 --------------------- SEE ALSO -----------------------
;
-#X text 43 294 See the help for the param external to expand your mind:
+#X text 43 325 See the help for the param external to expand your mind:
;
-#X obj 148 320 param /another a_value;
+#X obj 148 351 param /another a_value;
#X msg 82 161 guis;
#X text 61 130 A bang will output all the params and their values.
;
-#X text 119 158 Guis will output all the optional /gui values.;
#X text 26 47 tags: state param;
-#X connect 0 0 1 0;
-#X connect 2 0 0 0;
-#X connect 11 0 0 0;
+#X msg 117 204 symbol /FM_MOD;
+#X text 213 202 A symbol will dump only the params that start with
+that path.;
+#X obj 38 226 tof/paramDump;
+#X obj 303 265 param-abs /id SECOND;
+#X msg 124 179 guis /SECOND;
+#X text 119 158 Guis will output all the optional /g values.;
+#X connect 1 0 15 0;
+#X connect 10 0 15 0;
+#X connect 13 0 15 0;
+#X connect 15 0 0 0;
+#X connect 17 0 15 0;
diff --git a/help/paramGui-help.pd b/help/paramGui-help.pd
index 353d4cc..d4b9b2b 100644
--- a/help/paramGui-help.pd
+++ b/help/paramGui-help.pd
@@ -1,30 +1,42 @@
-#N canvas 198 148 663 465 10;
-#X obj 10 241 paramGui;
-#X obj -13 32 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577
+#N canvas 1067 99 864 482 10;
+#X obj 4 19 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577
0;
-#X text -8 84 author: mrtoftrash@gmail.com;
-#X text -8 31 description: builds interfaces out of pd guis for params.
+#X text 9 71 author: mrtoftrash@gmail.com;
+#X text 8 50 tags: param gui;
+#X text 114 356 --------------------- SEE ALSO -----------------------
;
-#X text -9 63 tags: param gui;
-#X obj 10 206 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
--1;
-#X text 406 216 /gui options:;
-#X text 31 205 Bang: build guis for all params that have /gui options.
+#X text 88 377 See the help for the param external to expand your mind:
;
-#X text 97 369 --------------------- SEE ALSO -----------------------
-;
-#X text 71 390 See the help for the param external to expand your mind:
-;
-#X obj 69 412 param /numerical 100 /gui nbx;
-#X text 108 277 -- SUPER IMPORTANT --;
-#X text 415 238 nbx: creates a numberbox;
-#X text 414 257 slider min max: creates a slider with the indicated
+#X text 125 264 -- SUPER IMPORTANT --;
+#X text 432 225 nbx: creates a numberbox;
+#X text 431 244 slider min max: creates a slider with the indicated
minimum and maximum;
-#X text 414 286 bng: creates a bang;
-#X text 414 304 tgl: creates a toggle;
-#X text 416 322 symbolatom: creates a symbol box;
-#X obj 278 411 param /slip 100 /gui slider 0 127;
-#X text 14 293 You have to copy the created guis into your root patch
+#X text 431 273 bng: creates a bang;
+#X text 431 291 tgl: creates a toggle;
+#X text 433 309 symbolatom: creates a symbol box;
+#X text 31 280 You have to copy the created guis into your root patch
(or a subpatch of it) for them to work with their target params!;
-#X text -9 105 version: 2009-09-19 (localized version);
-#X connect 5 0 0 0;
+#X text 8 92 version: 2009-09-19 (localized version);
+#X obj 86 399 tof/param /numerical 100 /gui nbx;
+#X obj 315 398 tof/param /slip 100 /gui slider 0 127;
+#X text 423 203 /g options:;
+#X obj 555 127 tof/paramId;
+#X obj 555 157 print;
+#X obj 555 100 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+-1 -1;
+#X obj 647 48 ./param-abs /id bob;
+#X text 9 18 description: builds pd guis for params.;
+#X obj 682 139 tof/paramDump;
+#X obj 687 105 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+-1 -1;
+#X obj 687 171 print;
+#X msg 729 106 guis;
+#X msg 748 171 ----;
+#X obj 610 370 tof/param /maude 3 /g bob;
+#X obj 608 409 tof/param /tom yo /g sym;
+#X connect 16 0 17 0;
+#X connect 18 0 16 0;
+#X connect 21 0 23 0;
+#X connect 22 0 21 0;
+#X connect 24 0 21 0;
+#X connect 25 0 23 0;
diff --git a/src/Makefile b/src/Makefile
index 31b2c9f..62e263d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,6 +1,6 @@
default:
-PARAM: param paramDump paramRoute paramFile paramCustom paramId
+PARAM: param paramDump paramRoute paramFile paramCustom paramId paramGui
current:
echo make class
diff --git a/src/param.c b/src/param.c
index 473f172..5326913 100644
--- a/src/param.c
+++ b/src/param.c
@@ -20,7 +20,6 @@
*/
-#include "tof.h"
#include "param.h"
extern int sys_noloadbang;
@@ -151,12 +150,19 @@ static void paramClass_save(t_paramClass *x, t_binbuf* bb,int f) {
}
// SPECIAL PARAM GUI FUNCTION
-static void paramClass_GUI(t_paramClass *x, int* ac, t_atom** av) {
+static void paramClass_GUI(t_paramClass *x, int* ac, t_atom** av, t_symbol** send,t_symbol** receive) {
*ac = x->gac;
*av = x->gav;
+ *send = x->receive;
+ *receive = x->send;
}
+// SPECIAL PARAM GUI FUNCTION
+static void paramClass_GUIUpdate(t_paramClass *x) {
+ if(x->selector != &s_bang ) tof_send_anything_prepend(x->send,x->selector,x->ac,x->av,x->set_s );
+}
+
// CONSTRUCTOR
static void* paramClass_new(t_symbol *s, int ac, t_atom *av)
@@ -214,7 +220,8 @@ static void* paramClass_new(t_symbol *s, int ac, t_atom *av)
x->param = param_register(x,root,path, \
(t_paramGetMethod) paramClass_get, \
paramSaveMethod, \
- paramGUIMethod);
+ paramGUIMethod,\
+ (t_paramGUIUpdateMethod)paramClass_GUIUpdate);
if (!x->param) return NULL;
@@ -247,15 +254,7 @@ static void* paramClass_new(t_symbol *s, int ac, t_atom *av)
//}
}
-
-
-
-
-
-
-
-
int l = strlen(path->s_name) + strlen(root->s_name) + 2;
char* receiver = getbytes( l * sizeof(*receiver));
diff --git a/src/param.h b/src/param.h
index 9782ee1..c4e0ead 100644
--- a/src/param.h
+++ b/src/param.h
@@ -1,8 +1,11 @@
+#include "tof.h"
+
//#define PARAMDEBUG
typedef void (*t_paramGetMethod)(void*,t_symbol**,int*,t_atom**);
typedef void (*t_paramSaveMethod)(void*,t_binbuf*,int);
-typedef void (*t_paramGUIMethod)(void*,int*,t_atom**);
+typedef void (*t_paramGUIMethod)(void*,int*,t_atom**,t_symbol**,t_symbol**);
+typedef void (*t_paramGUIUpdateMethod)(void*);
char param_buf_temp_a[MAXPDSTRING];
char param_buf_temp_b[MAXPDSTRING];
@@ -21,6 +24,7 @@ typedef struct _param {
t_paramGetMethod get; //Function to get current value
t_paramSaveMethod save; //Function to save
t_paramGUIMethod GUI;
+ t_paramGUIUpdateMethod GUIUpdate;
//t_symbol* send;
//t_symbol* receive;
} t_param;
@@ -140,10 +144,11 @@ static t_symbol* param_get_name ( int ac, t_atom* av ) {
char* name = atom_getsymbol(av)->s_name;
if (*name == *param_separator ) {
int length = strlen(name);
- if (name[length-1] != '_') return atom_getsymbol(av);
+ if (name[length-1] != '_' || name[length-1] != '/') return atom_getsymbol(av);
}
}
- post("param names must start with a \"/\" and can not end with a \"_\"!");
+ post("param names must start with a \"/\" and can not end with \
+ either a \"_\" or a \"/\"!");
return NULL;
}
@@ -205,9 +210,14 @@ static t_symbol* param_get_path( t_canvas* i_canvas, t_symbol* name) {
}
i_canvas = i_canvas->gl_owner;
}
- //strcat(sbuf_name,separator);
+
+ // If no name, the path will always end with a /
+
if ( name != NULL) {
strcat(sbuf_name,name->s_name);
+ } else {
+ //if (strlen(sbuf_name)==0)
+ strcat(sbuf_name,param_separator);
}
return gensym(sbuf_name);
@@ -222,7 +232,8 @@ static t_symbol* param_get_path( t_canvas* i_canvas, t_symbol* name) {
//static struct param* register_param( t_canvas* canvas, int o_ac, t_atom* o_av) {
static t_param* param_register(void* x,t_symbol* root, t_symbol* path,\
- t_paramGetMethod get, t_paramSaveMethod save, t_paramGUIMethod GUI) {
+ t_paramGetMethod get, t_paramSaveMethod save, t_paramGUIMethod GUI, \
+ t_paramGUIUpdateMethod GUIUpdate) {
//char *separator = "/";
@@ -263,6 +274,7 @@ static t_param* param_register(void* x,t_symbol* root, t_symbol* path,\
p->get = get;
p->save = save;
p->GUI = GUI;
+ p->GUIUpdate = GUIUpdate;
//p->id = id;
//set_param( p, ac, av);
//p->ac_g = ac_g;
diff --git a/src/paramCustom.c b/src/paramCustom.c
index 9b23461..8be3360 100644
--- a/src/paramCustom.c
+++ b/src/paramCustom.c
@@ -138,10 +138,11 @@ static void* paramCustom_new(t_symbol *s, int ac, t_atom *av)
x->nopresets = tof_find_tag('/',gensym("/nps"), ac-1, av+1);
-
+
x->param = param_register(x,root,path,\
NULL,\
(t_paramSaveMethod) paramCustom_save,\
+ NULL,\
NULL);
if (!x->param) return NULL;
diff --git a/src/paramDump.c b/src/paramDump.c
index b9f73b9..91b321e 100644
--- a/src/paramDump.c
+++ b/src/paramDump.c
@@ -29,35 +29,102 @@ static t_class *paramDump_class;
typedef struct _paramDump
{
- t_object x_obj;
- t_outlet* outlet;
- //t_symbol* s_set;
+ t_object x_obj;
+ t_outlet* outlet;
+ t_symbol* empty_s;
t_symbol* root;
+
} t_paramDump;
+static void paramDump_updateguis(t_paramDump *x, t_symbol* s) {
+
+ t_param* p = get_param_list(x->root);
+ int ac;
+ t_atom* av;
+
+ if ( s == x->empty_s ) {
+ while (p) {
+ if (p->GUIUpdate) {
+ p->GUIUpdate(p->x);
+ }
+ p = p->next;
+ }
+ } else {
+ int length = strlen(s->s_name);
+ while (p) {
+ if (p->GUIUpdate && (strncmp(p->path->s_name,s->s_name,length)==0) ) {
+ p->GUIUpdate(p->x);
+
+ }
+ p = p->next;
+ }
+ }
+
+}
static void paramDump_guis(t_paramDump *x, t_symbol* s) {
+ t_param* p = get_param_list(x->root);
+ int ac;
+ t_atom* av;
+ t_symbol* send;
+ t_symbol* receive;
-
- t_param* p = get_param_list(x->root);
- int ac;
- t_atom* av;
-
+ if ( s == x->empty_s ) {
while (p) {
if (p->GUI ) {
- p->GUI(p->x,&ac,&av);
+ p->GUI(p->x,&ac,&av,&send,&receive);
outlet_anything(x->outlet,p->path,ac,av);
}
p = p->next;
}
+ } else {
+ int length = strlen(s->s_name);
+ while (p) {
+ if (p->GUI && (strncmp(p->path->s_name,s->s_name,length)==0) ) {
+ p->GUI(p->x,&ac,&av,&send,&receive);
+ outlet_anything(x->outlet,p->path,ac,av);
+
+ }
+ p = p->next;
+ }
+ }
}
-// Dump out everything (OR THE ID'S OR JUST THE NAMES?)
+static void paramDump_symbol(t_paramDump *x, t_symbol* s) {
+
+ t_param* p = get_param_list(x->root);
+ #ifdef PARAMDEBUG
+ if (p == NULL) {
+ post("No params found");
+ } else {
+ post("Found params");
+ }
+ #endif
+
+ t_symbol* selector;
+ int ac;
+ t_atom* av;
+
+
+
+ int length = strlen(s->s_name);
+
+ while (p) {
+ if ( p->get && (strncmp(p->path->s_name,s->s_name,length)==0) ) {
+ p->get(p->x, &selector, &ac, &av);
+ tof_outlet_anything_prepend(x->outlet,selector,ac,av,p->path);
+ }
+ p = p->next;
+ }
+
+}
+
+// Dump out
static void paramDump_bang(t_paramDump *x) {
t_param* p = get_param_list(x->root);
@@ -73,6 +140,7 @@ static void paramDump_bang(t_paramDump *x) {
int ac;
t_atom* av;
+
while (p) {
if ( p->get ) {
p->get(p->x, &selector, &ac, &av);
@@ -97,7 +165,7 @@ static void *paramDump_new(t_symbol *s, int ac, t_atom *av) {
t_paramDump *x = (t_paramDump *)pd_new(paramDump_class);
x->root = tof_get_dollarzero(tof_get_root_canvas(tof_get_canvas()));
-
+ x->empty_s = gensym("");
//x->s_set = gensym("set");
@@ -112,10 +180,14 @@ void paramDump_setup(void) {
sizeof(t_paramDump), 0, A_GIMME, 0);
class_addbang(paramDump_class, paramDump_bang);
-
+ class_addsymbol(paramDump_class, paramDump_symbol);
+
//class_addmethod(paramDump_class, (t_method) paramDump_values, gensym("values"), A_DEFSYMBOL,0);
class_addmethod(paramDump_class, (t_method) paramDump_guis, gensym("guis"), A_DEFSYMBOL,0);
+ class_addmethod(paramDump_class, (t_method) paramDump_updateguis, gensym("updateguis"), A_DEFSYMBOL,0);
+
+
//class_addmethod(paramDump_class, (t_method) paramDump_update_guis, gensym("update"), A_DEFSYMBOL,0);
}
diff --git a/src/paramRoute.c b/src/paramRoute.c
index cc02cfe..92628b1 100644
--- a/src/paramRoute.c
+++ b/src/paramRoute.c
@@ -76,7 +76,7 @@ static void paramRoute_anything(t_paramRoute *x, t_symbol *s, int ac, t_atom *av
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);
diff --git a/src/tof.h b/src/tof.h
index ae4e1ac..3c3b1f9 100644
--- a/src/tof.h
+++ b/src/tof.h
@@ -8,7 +8,7 @@
#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL)
#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT)
-#endif
+
char tof_buf_temp_a[MAXPDSTRING];
@@ -270,16 +270,16 @@ static void tof_outlet_anything_prepend(t_outlet* outlet, t_symbol* s, int argc,
}
-static void tof_send_anything_prepend(t_symbol* target,t_symbol* s, int ac, t_atom* av,t_symbol* prepend) {
+static void tof_send_anything_prepend(t_symbol* target,t_symbol* selector, int ac, t_atom* av,t_symbol* prepend) {
if (target->s_thing) {
- if ( s == &s_list || s == &s_float || s == &s_symbol ) {
+ if ( selector == &s_list || selector == &s_float || selector == &s_symbol ) {
typedmess(target->s_thing, prepend, ac, av);
} else {
int new_ac = ac + 1;
t_atom *new_av = getbytes(new_ac*sizeof(*new_av));
tof_copy_atoms(av,new_av+1,ac);
- SETSYMBOL(new_av, s);
+ SETSYMBOL(new_av, selector);
typedmess(target->s_thing, prepend, new_ac, new_av);
freebytes(new_av, new_ac*sizeof(*new_av));
}
@@ -301,3 +301,4 @@ static t_symbol* tof_remove_extension(t_symbol* s) {
freebytes(newstring,length * sizeof(*newstring));
return newsymbol;
}
+#endif
diff --git a/test/test.c b/test/test.c
new file mode 100644
index 0000000..9c31307
--- /dev/null
+++ b/test/test.c
@@ -0,0 +1,97 @@
+
+
+//#include "tof.h"
+//#include "param.h"
+#include "m_pd.h"
+#include "g_canvas.h"
+
+static t_class *test_class;
+
+
+typedef struct _test
+{
+ t_object x_obj;
+ t_outlet* outlet;
+ t_symbol* name;
+ t_canvas* canvas;
+ //t_symbol* target;
+ //t_class* empty_s;
+ //t_symbol* root;
+
+} t_test;
+
+
+
+// Dump out
+static void test_bang(t_test *x) {
+ t_atom a;
+ if (x->canvas) {
+
+ SETFLOAT(&a,1);
+ pd_typedmess((t_pd*)x->canvas,gensym("vis"),1,&a);
+ }
+
+}
+
+
+
+static void test_free(t_test *x)
+{
+ if (x->canvas) {
+ //post("Deleting it");
+ pd_free((t_pd *)x->canvas);
+ }
+ x->canvas = NULL;
+}
+
+
+static void *test_new(t_symbol *s, int ac, t_atom *av) {
+ t_test *x = (t_test *)pd_new(test_class);
+
+ // create a new canvas
+ x->name = gensym("xiu");
+
+ t_atom a;
+ SETSYMBOL(&a, x->name);
+ pd_typedmess(&pd_objectmaker,gensym("pd"),1,&a);
+
+ x->canvas = (t_canvas*) pd_newest();
+
+ // From this point on, we are hoping the "pd" object has been created
+
+ // Change name to match pd's canvas naming scheme
+ x->name = gensym("pd-xiu");
+
+
+
+ // Hide the window (stupid way of doing this)
+ if (x->canvas) {
+ SETFLOAT(&a,0);
+ pd_typedmess((t_pd*)x->canvas,gensym("vis"),1,&a);
+ }
+
+ // Try to change its name
+ //canvas_setargs(int argc, t_atom *argv);
+
+ x->outlet = outlet_new(&x->x_obj, &s_list);
+
+ return (x);
+}
+
+void test_setup(void) {
+ test_class = class_new(gensym("test"),
+ (t_newmethod)test_new, (t_method)test_free,
+ sizeof(t_test), 0, A_GIMME, 0);
+
+ class_addbang(test_class, test_bang);
+ //class_addsymbol(test_class, test_symbol);
+
+ //class_addmethod(test_class, (t_method) test_values, gensym("values"), A_DEFSYMBOL,0);
+
+ //class_addmethod(test_class, (t_method) test_guis, gensym("guis"), A_DEFSYMBOL,0);
+ //class_addmethod(test_class, (t_method) test_updateguis, gensym("updateguis"), A_DEFSYMBOL,0);
+
+
+ //class_addmethod(test_class, (t_method) test_update_guis, gensym("update"), A_DEFSYMBOL,0);
+
+}