aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas O Fredericks <mrtof@users.sourceforge.net>2009-09-23 00:59:44 +0000
committerThomas O Fredericks <mrtof@users.sourceforge.net>2009-09-23 00:59:44 +0000
commit2ff72e22aed0bc587f6ad82e882d10dfc7e74fa8 (patch)
treedbd0dd83d961dc504ee5aade72b8f0c4acb21c8e /test
parent302470a21bec647482333dd75dbdf0a36208241f (diff)
Adding param to my official externals
svn path=/trunk/externals/tof/; revision=12435
Diffstat (limited to 'test')
-rw-r--r--test/param-abs.pd33
-rw-r--r--test/param-help.pd89
-rw-r--r--test/param.c206
-rw-r--r--test/param.h735
-rw-r--r--test/param2-abs.pd24
-rw-r--r--test/paramDump-help.pd25
-rw-r--r--test/paramDump.c161
-rw-r--r--test/paramFile-help.pd52
-rw-r--r--test/paramFile.c154
-rw-r--r--test/paramRoute-help.pd39
-rw-r--r--test/paramRoute.c167
11 files changed, 0 insertions, 1685 deletions
diff --git a/test/param-abs.pd b/test/param-abs.pd
deleted file mode 100644
index b0b38a9..0000000
--- a/test/param-abs.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 1024 0 1018 716 10;
-#X obj 225 477 outlet~;
-#X obj 55 21 inlet;
-#X obj 55 66 paramRoute;
-#X text 179 26 This abstraction is an example for the param external.
-;
-#X floatatom 223 247 0 0 0 0 - - -;
-#X obj 223 317 +~;
-#X text 153 168 carrier;
-#X text 152 186 frequency;
-#X obj 224 359 osc~;
-#X obj 56 97 print PARAM_NOTFOUND;
-#X obj 223 171 loadbang;
-#X obj 225 428 *~;
-#X obj 315 400 line~;
-#X msg 316 376 \$1 100;
-#X obj 317 325 loadbang;
-#X obj 317 349 param /volume 0 /gui slider 0 1;
-#X obj 223 202 param /carrier 800 /gui slider 200 2000;
-#X obj 321 300 param2-abs /id modulation;
-#X connect 1 0 2 0;
-#X connect 2 0 9 0;
-#X connect 4 0 5 0;
-#X connect 5 0 8 0;
-#X connect 8 0 11 0;
-#X connect 10 0 16 0;
-#X connect 11 0 0 0;
-#X connect 12 0 11 1;
-#X connect 13 0 12 0;
-#X connect 14 0 15 0;
-#X connect 15 0 13 0;
-#X connect 16 0 4 0;
-#X connect 17 0 5 1;
diff --git a/test/param-help.pd b/test/param-help.pd
deleted file mode 100644
index b1938a7..0000000
--- a/test/param-help.pd
+++ /dev/null
@@ -1,89 +0,0 @@
-#N canvas 1024 0 1018 688 10;
-#X floatatom 477 321 5 0 0 0 - - -;
-#X obj -23 2 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577
-0;
-#X text -18 54 author: mrtoftrash@gmail.com;
-#X text -18 1 description: param is a state saving and message routing
-system.;
-#X text -19 75 version: 2009-09-19 (localized release);
-#X text -19 33 tags: state routing param;
-#X obj 33 546 paramFile;
-#X obj 555 541 paramDump;
-#X obj 557 620 paramGui;
-#X obj 32 592 paramRoute;
-#X text 3 389 /id keyword:;
-#X obj 14 127 param /my_name my_value;
-#X text 169 122 argument 1: param name (must start with a slash);
-#X text 169 139 argument 2...: param value (can be a list);
-#X obj 525 126 param /number 30 /gui nbx;
-#X text 578 181 nbx: creates a numberbox;
-#X text 577 200 slider min max: creates a slider with the indicated
-minimum and maximum;
-#X text 577 229 bng: creates a bang;
-#X text 577 247 tgl: creates a toggle;
-#X text 579 265 symbolatom: creates a symbol box;
-#X text 68 355 (\$0)/abstraction's name/.../param's name;
-#X text 5 210 If the param object is created directly in the root patch
-(as the my_name example above) \, its path is as follows:;
-#X text 7 172 A param object creates a storage area for anything. This
-data can be accessed through a unique symbolic path.;
-#X text 60 245 (\$0)/param's name;
-#X text 7 279 If the param is inside an abstraction (or inside an abstraction
-contained inside another abstraction an so forth) \, the path starts
-at the root and follows every child patch (abstraction) until it reaches
-the param object \, at which point the param's name is appended:;
-#X text 100 590 Sends values to params using a relative path.;
-#X obj 34 620 OSCToParam;
-#X text 515 166 /gui options:;
-#X text 526 81 When you create a param \, you can optinally use the
-"/gui" keyword to flag the param with gui options.;
-#X text 40 414 If an abstraction's arguments contains the "/id" keyword
-\, the symbol following the "/id" keyword \, instead of the abstraction's
-name \, will be used to build the path. See an example to the right.
-;
-#X obj 557 599 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X obj 33 519 bng 15 250 50 0 empty empty save 17 7 0 10 -262144 -1
--1;
-#X obj 99 518 bng 15 250 50 0 empty empty load 17 7 0 10 -262144 -1
--1;
-#X floatatom 525 146 5 0 0 0 - - -;
-#X obj 555 519 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X obj 555 569 print DUMP;
-#X text 268 490 --------------------- SEE ALSO -----------------------
-;
-#X obj 472 448 dac~;
-#X obj 690 364 hsl 100 15 0 1 0 0 \$0/FM_MOD/volume \$0/FM_MOD/volume_
-/FM_MOD/volume 105 7 0 10 -262144 -1 -1 0 1;
-#X obj 690 384 hsl 100 15 200 2000 0 0 \$0/FM_MOD/carrier \$0/FM_MOD/carrier_
-/FM_MOD/carrier 105 7 0 10 -262144 -1 -1 3300 1;
-#X obj 688 423 nbx 5 14 -1e+37 1e+37 0 0 \$0/FM_MOD/modulation/index
-\$0/FM_MOD/modulation/index_ /FM_MOD/modulation/index 57 7 0 10 -262144
--1 -1 20 256;
-#X obj 688 404 nbx 5 14 -1e+37 1e+37 0 0 \$0/FM_MOD/modulation/freq
-\$0/FM_MOD/modulation/freq_ /FM_MOD/modulation/freq 57 7 0 10 -262144
--1 -1 3 256;
-#X msg 477 343 modulation/index \$1;
-#X obj 517 367 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
--1 -1 0 1;
-#X msg 514 389 volume \$1;
-#X obj 477 414 param-abs /id FM_MOD;
-#X text 624 538 Outputs all children params of the root patch.;
-#X text 99 541 Saves and restores all chilren params of the root patch
-to/from a file with optionnal presets.;
-#X text 623 617 Build a PD gui for all children params that have values
-for the "/gui" keyword.;
-#X text 107 620 Routes OSC messages to matching children params;
-#X connect 0 0 42 0;
-#X connect 7 0 35 0;
-#X connect 14 0 33 0;
-#X connect 30 0 8 0;
-#X connect 31 0 6 0;
-#X connect 32 0 6 1;
-#X connect 34 0 7 0;
-#X connect 42 0 45 0;
-#X connect 43 0 44 0;
-#X connect 44 0 45 0;
-#X connect 45 0 37 0;
-#X connect 45 0 37 1;
diff --git a/test/param.c b/test/param.c
deleted file mode 100644
index 00b2fe8..0000000
--- a/test/param.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * param.c
- *
- * Copyright 2009 Thomas O Fredericks <tom@hp>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-
-
-
-#include "tof.h"
-#include "param.h"
-
-
-
-
-static t_class *param_class;
-static t_class *param_inlet2_class;
-struct _param_inlet2;
-
-typedef struct _param
-{
- t_object x_obj;
- struct _param_inlet2 *x_param_inlet2;
-
- //t_symbol *x_path;
- t_symbol *s_PARAM;
- //t_symbol *x_update_gui;
- t_symbol *s_set;
- struct param *x_param;
-} t_param;
-
-typedef struct _param_inlet2
-{
- t_object x_obj;
- t_param *p_owner;
-} t_param_inlet2;
-
-
-static void param_bang(t_param *x)
-{
- if ( x->x_param) {
- param_output(x->x_param,x->x_obj.ob_outlet);
-
- //if (PARAMECHO) param_send_prepend(x->x_param, x->s_PARAM ,x->x_param->path );
- if(x->x_param->selector != &s_bang ) param_send_prepend(x->x_param, x->x_param->send ,x->s_set );
- }
-}
-
-static void param_anything(t_param *x, t_symbol *s, int ac, t_atom *av)
-{
- #ifdef PARAMDEBUG
- post("RECEIVING SOMETHING");
- #endif
- if ( x->x_param) set_param_anything(x->x_param,s,ac,av);
-
- param_bang(x);
-
-}
-
-
-
-
-// SECOND INLET METHOD
-
-static void param_inlet2_anything(t_param_inlet2 *p, t_symbol *s, int ac, t_atom *av)
-{
-
- if ( p->p_owner->x_param ) set_param_anything(p->p_owner->x_param, s,ac,av);
-}
-
-// DECONSTRUCTOR
-
-static void param_free(t_param *x)
-{
-
- if(x->x_param_inlet2) pd_free((t_pd *)x->x_param_inlet2);
-
- if (x->x_param) {
- pd_unbind(&x->x_obj.ob_pd, x->x_param->receive);
- param_unregister(x->x_param);
- }
-
-}
-
-// CONSTRUCTOR
-static void *param_new(t_symbol *s, int ac, t_atom *av)
-{
- t_param *x = (t_param *)pd_new(param_class);
- t_param_inlet2 *p = (t_param_inlet2 *)pd_new(param_inlet2_class);
-
- // Stuff
- x->s_set = gensym("set");
- x->s_PARAM = gensym("PARAM");
-
- // Set up second inlet proxy
- x->x_param_inlet2 = p;
- p->p_owner = x;
-
- // GET THE CURRENT CANVAS
- t_canvas* canvas=tof_get_canvas();
-
- // GET THE NAME
- t_symbol* name = param_get_name(ac,av);
-
- if (name) {
-
- t_symbol* path = param_get_path(canvas,name);
- t_symbol* root = tof_get_dollarzero(tof_get_root_canvas(canvas));
-
-
- // FIND PARAM VALUE
- // A. In canvas' arguments
- // B. In object's arguments
- // C. Defaults to a bang
-
- int ac_p = 0;
- t_atom* av_p = NULL;
-
-
- // A. In canvas' arguments
- int ac_c = 0;
- t_atom* av_c = NULL;
-
- t_canvas * before = tof_get_canvas_before_root(canvas);
- tof_get_canvas_arguments(before,&ac_c , &av_c);
- tof_find_tagged_argument('/',name, ac_c, av_c,&ac_p,&av_p);
-
- // B. I object's arguments
- if ( ac_p == 0 && ac > 1) {
- int ac_a = 0;
- t_atom* av_a = NULL;
- tof_find_tagged_argument('/',name, ac, av,&ac_p,&av_p);
- //tof_get_tagged_argument('/',ac,av,&start,&count);
- //if (count > 1) {
- // ac_p = ac_a;
- // av_p = av_a + 1;
- //}
- }
-
-
-
-
- //FIND THE GUI TAGS
- 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);
-
- x->x_param = param_register(root,path,ac_p,av_p,ac_g,av_g);
-
- #ifdef PARAMDEBUG
- post("receive:%s",x->x_param->receive->s_name);
- post("send:%s",x->x_param->send->s_name);
- #endif
-
- // BIND RECEIVER
- pd_bind(&x->x_obj.ob_pd, x->x_param->receive );
- // CREATE INLETS AND OUTLETS
- inlet_new((t_object *)x, (t_pd *)p, 0, 0);
- outlet_new(&x->x_obj, &s_list);
-
-
- } else {
-
- pd_error(x,"Could not create param. See possible errors above.");
- }
-
-
-
-
-
-
- return (x);
-}
-
-void param_setup(void)
-{
- param_class = class_new(gensym("param"),
- (t_newmethod)param_new, (t_method)param_free,
- sizeof(t_param), 0, A_GIMME, 0);
-
-
- class_addanything(param_class, param_anything);
- class_addbang(param_class, param_bang);
-
- param_inlet2_class = class_new(gensym("_param_inlet2"),
- 0, 0, sizeof(t_param_inlet2), CLASS_PD | CLASS_NOINLET, 0);
-
- class_addanything(param_inlet2_class, param_inlet2_anything);
-
-}
diff --git a/test/param.h b/test/param.h
deleted file mode 100644
index 9113840..0000000
--- a/test/param.h
+++ /dev/null
@@ -1,735 +0,0 @@
-//#define PARAMDEBUG
-#include <stdio.h>
-
-char param_buf_temp_a[MAXPDSTRING];
-char param_buf_temp_b[MAXPDSTRING];
-char* separator = "/";
-
-//char PARAMECHO = 0;
-
-
-struct param {
-
- t_symbol* root;
- t_symbol* path; //Path(name) of the param
- t_symbol* send;
- t_symbol* receive;
- t_symbol* selector; //Type of data stored
- int alloc; //Memory allocated
- int ac; //Number of values stored
- t_atom* av; //Values stored
- struct param* next; //Next param
- struct param* previous; //Previous param
- int users; //Number of param objects using this param
- t_symbol* id; //The base id
- int ac_g; //Gui argument count
- t_atom* av_g; //Gui argument values
-};
-
-struct paramroot {
- t_symbol* root;
- struct param* params; //param list
- struct paramroot* next; //Next paramroot
- struct paramroot* previous; //Previous paramroot
-};
-
-struct paramroot* paramroots;
-
-//struct param* paramlist;
-
-
-static void set_param_anything( struct param* p, t_symbol* s, int ac, t_atom *av) {
-
- if ( s == &s_bang || ac == 0 ) {
- p->ac = 0;
- p->selector = s;
- } else {
- if(ac > p->alloc) {
- p->av = resizebytes(p->av, p->alloc*sizeof(*(p->av)),
- (10 + ac)*sizeof(*(p->av)));
- p->alloc = 10 + ac;
- }
- p->ac = ac;
- p->selector = s;
- tof_copy_atoms(av, p->av, ac);
- }
-}
-
-
-static void set_param( struct param* p, int ac, t_atom *av) {
- t_symbol* s;
- tof_set_selector(&s,&ac, &av );
- set_param_anything(p,s,ac,av);
-}
-
-
-
-
-
-/*
-static void print_all_params(void) {
-
- struct param* p = paramlist;
- post("--paramlist--");
- while(p) {
- if ( p->path) post("Path: %s",p->path->s_name);
- if (p->id) post("Id: %s",p->id->s_name);
- p = p->next;
- }
-
-}
-*/
-
-
-static struct paramroot* param_get_root(t_symbol* root) {
-
- if (paramroots == NULL) {
- #ifdef PARAMDEBUG
- post("Could not get...not even one root created");
- #endif
- return NULL;
- }
-
-
- // Pointer to the start of paramroots
- struct paramroot* branch = paramroots;
-
- while( branch ) {
- if ( branch->root == root) {
- #ifdef PARAMDEBUG
- post("Found root:%s",root->s_name);
- #endif
-
- return branch;
- }
- branch = branch->next;
- }
- #ifdef PARAMDEBUG
- post("Could not find root");
- #endif
- return branch;
-
-}
-
-
-static struct paramroot* param_root_attach(t_symbol* root){
-
- // Pointer to the start of paramroots
- struct paramroot* branch = paramroots;
-
- while( branch ) {
- if ( branch->root == root) {
- #ifdef PARAMDEBUG
- post("Found root:%s",root->s_name);
- #endif
-
- return branch;
- }
- if ( branch->next == NULL ) break;
- branch = branch->next;
- }
-
- // we did not find a paramroot linked to this root canvas
- // so we create it
- #ifdef PARAMDEBUG
- post("Creating root:%s",root->s_name);
- #endif
-
- // Create and add paramroot to the end
- struct paramroot* newbranch = getbytes(sizeof(*newbranch));
- newbranch->root = root;
- newbranch->next = NULL;
- newbranch->params = NULL;
-
- if (branch) {
- #ifdef PARAMDEBUG
- post("Appending it to previous roots");
- #endif
- newbranch->previous = branch;
- branch->next = newbranch;
- } else {
- #ifdef PARAMDEBUG
- post("Creating first root");
- #endif
- newbranch->previous = NULL;
- paramroots = newbranch;
- }
-
-
- return newbranch;
-
-}
-
-
-
-static struct param* get_param_list(t_symbol* root) {
-
-
- struct paramroot* branch = param_get_root(root);
- if (branch) {
-
- #ifdef PARAMDEBUG
- post("Getting params from %s",branch->root->s_name);
- if (!branch->params) post("Root contains no params");
- #endif
- return branch->params;
- }
-
- return NULL;
-
-
-}
-
-static t_symbol* param_get_name ( int ac, t_atom* av ) {
-
- if (ac && IS_A_SYMBOL(av, 0)) {
- char *firstChar = (atom_getsymbol(av))->s_name;
- if (*firstChar == *separator) {
- return atom_getsymbol(av);
- }
- }
- post("param requires a name that starts with a \"/\"");
- return NULL;
-}
-
-// Name can be NULL
-
-static t_symbol* param_get_path( t_canvas* i_canvas, t_symbol* name) {
-
- char* sbuf_name = param_buf_temp_a;
- char* sbuf_temp = param_buf_temp_b;
- sbuf_name[0] = '\0';
- sbuf_temp[0] = '\0';
- //char* separator = "/";
-
-
- t_symbol* id_s = gensym("/id"); // symbol that points to "/id" symbol
-
- // arguments of the current canvas being analyzed
- int i_ac;
- t_atom * i_av;
-
- // temp pointer to the current id being added to the path
- t_symbol* id_temp;
-
- /* FIND ID AND BASEPATH */
- while( i_canvas->gl_owner) {
- // Ignore all supatches
- if ( tof_canvas_is_not_subpatch(i_canvas) ) {
- tof_get_canvas_arguments(i_canvas,&i_ac, &i_av);
- id_temp=tof_get_canvas_name(i_canvas);
- //id_temp= canvas_realizedollar(i_canvas, gensym("$0"));
- int ac_a = 0;
- t_atom* av_a = NULL;
- int iter = 0;
- //found_id_flag = 0;
-
- while( tof_next_tagged_argument(*separator,i_ac,i_av,&ac_a,&av_a,&iter) ) {
-
- if ( IS_A_SYMBOL(av_a,0)
- && (id_s == av_a->a_w.w_symbol)
- && (ac_a > 1) ) {
- id_temp = atom_getsymbol(av_a+1);
- //id_canvas = i_canvas;
- //found_id_flag = 1;
- break;
- }
- }
- // if ever an /id is missing, this param is not saveable
- //if (found_id_flag == 0) saveable = 0;
-
- // Prepend newly found ID
- strcpy(sbuf_temp,sbuf_name);
- strcpy(sbuf_name, separator);
- strcat(sbuf_name, id_temp->s_name);
- strcat(sbuf_name,sbuf_temp);
- }
- i_canvas = i_canvas->gl_owner;
- }
- //strcat(sbuf_name,separator);
- if ( name != NULL) {
- strcat(sbuf_name,name->s_name);
- } else {
- strcat(sbuf_name, separator);
- }
-
- return gensym(sbuf_name);
-
-}
-
-
-
-// root, path, ac, av, ac_g, av_g
-// From there, deduct id, path_, etc...
-
-//static struct param* register_param( t_canvas* canvas, int o_ac, t_atom* o_av) {
-
-static struct param* param_register(t_symbol* root, t_symbol* path, int ac, t_atom* av,int ac_g, t_atom* av_g) {
-
-
- //char *separator = "/";
-
-
-
- /* GET POINTER TO PARAMLIST FOR THAT ROOT */
- struct paramroot* branch = param_root_attach(root);
- struct param* last = branch->params;
-
- // Search for param with same path
- while( last ) {
- if ( last->path == path) {
- #ifdef PARAMDEBUG
- post("Found param with same name");
- #endif
- last->users = last->users + 1;
- return last;
- }
- if ( last->next == NULL ) break;
- last = last->next;
- }
-
- // Create and add param to the end
-
-
-
-
- struct param* p = getbytes(sizeof(*p));
- p->root = root;
- p->alloc = 0;
- p->path = path;
-
- // Create receive and send symbols: $0/path
- strcpy(param_buf_temp_a,p->root->s_name);
- //strcat(param_buf_temp_a,separator);
- strcat(param_buf_temp_a,p->path->s_name);
- p->receive = gensym(param_buf_temp_a);
- strcat(param_buf_temp_a,"_");
- p->send = gensym(param_buf_temp_a);
-
- p->next = NULL;
- p->users = 1;
- //p->id = id;
- set_param( p, ac, av);
- p->ac_g = ac_g;
- p->av_g = getbytes(ac_g*sizeof(*(p->av_g)));
- tof_copy_atoms(av_g,p->av_g,ac_g);
- if (last) {
- #ifdef PARAMDEBUG
- post("Appending param");
- #endif
- p->previous = last;
- last->next = p;
- } else {
- #ifdef PARAMDEBUG
- post("Creating first param");
- #endif
- p->previous = NULL;
- branch->params = p;
- }
-
-
- return p;
-
-}
-
-static void param_unregister(struct param* p) {
-
- //post("unregistering %s", p->path->s_name);
- struct paramroot* branch = param_get_root(p->root);
- struct param* paramlist = branch->params;
-
- if ( paramlist) {
-
- p->users = p->users - 1;
- if ( p->users == 0 ) {
- // Remove param
- //post("Removing last param of this name");
- if (p->previous) {
- p->previous->next = p->next;
- if (p->next) p->next->previous = p->previous;
- /*
- if (p->next == NULL) {
- p->previous->next = NULL;
- } else {
- p->previous->next = p->next;
- }
- */
- } else {
- paramlist = p->next;
- if ( p->next != NULL) p->next->previous = NULL;
- }
- freebytes(p->av, p->alloc * sizeof *(p->av) );
- freebytes(p->av_g, p->ac_g * sizeof *(p->av_g) );
- freebytes(p, sizeof *p);
- }
-
- // Update the params for that root
- if (paramlist == NULL) {
- if (branch->previous) {
- branch->previous->next = branch->next;
- if (branch->next) branch->next->previous = branch->previous;
- } else {
- paramroots = branch->next;
- if ( branch->next != NULL) branch->next->previous = NULL;
- }
- #ifdef PARAMDEBUG
- post("Removing root:%s",branch->root->s_name);
- #endif
- freebytes(branch, sizeof *branch);
- } else {
- branch->params = paramlist;
- }
-
- } else {
- post("Euh... no params found!");
- }
-
-
-}
-
-
-
-
-
-
-/*
-static void get_param_build_info(t_canvas* canvas, int o_ac, t_atom* o_av, struct param_build_info* pbi, int flag) {
-
- pbi->path = NULL;
- pbi->path_g = NULL;
- pbi->av = NULL;
- int saveable = 1;
- pbi->ac = 0;
- pbi->id = NULL;
- pbi->ac_g = 0;
- pbi->av_g = NULL;
- pbi->basepath = NULL;
- pbi->basename = NULL;
-
- int ac;
- t_atom* av;
- tof_get_canvas_arguments(canvas,&ac, &av);
-
- char *separator = "/";
- char sbuf_name[MAXPDSTRING];
- char sbuf_temp[MAXPDSTRING];
- sbuf_name[0] = '\0';
- sbuf_temp[0] = '\0';
-
- t_symbol* id = gensym("/id");
- t_canvas* id_canvas = canvas;
- t_canvas* i_canvas = canvas;
-
- int i;
-
- int i_ac;
- t_atom * i_av;
-
- // A simple flag to indicate if an ID was found
- int found_id_flag;
-
-
- t_symbol* id_s = NULL;
-
-
- while( i_canvas->gl_owner) {
- // Ignore all supatches
- if ( tof_canvas_is_not_subpatch(i_canvas) ) {
- tof_get_canvas_arguments(i_canvas,&i_ac, &i_av);
- id_s= canvas_realizedollar(i_canvas, gensym("$0"));
-
-
- int start = 0;
- int count = 0;
- found_id_flag = 0;
-
- while( tof_get_tagged_argument('/',i_ac,i_av,&start,&count) ) {
-
- if ( IS_A_SYMBOL(i_av,start)
- && (id == (i_av+start)->a_w.w_symbol)
- && (count > 1) ) {
- id_s = atom_getsymbol(i_av+start+1);
- id_canvas = i_canvas;
- found_id_flag = 1;
- break;
- }
- start= start + count;
- }
-
-
- // if ever an /id is missing, this param is not saveable
- if (found_id_flag == 0) saveable = 0;
-
-
- // Prepend newly found ID
- strcpy(sbuf_temp,sbuf_name);
- strcpy(sbuf_name, "/");
- strcat(sbuf_name, id_s->s_name);
- strcat(sbuf_name,sbuf_temp);
-
- }
- i_canvas = i_canvas->gl_owner;
- }
-
- if ( saveable ) {
-
- if ( id_s) {
-
- int id_buf_length = strlen(id_s->s_name)+2;
- char * id_buf = getbytes(id_buf_length * sizeof (*id_buf));
- strcpy(id_buf, "/");
- strcat(id_buf,id_s->s_name);
- pbi->id = gensym(id_buf);
- freebytes(id_buf,id_buf_length * sizeof (*id_buf));
- } else {
- pbi->id = gensym("/");
- }
-
- }
-
- pbi->basepath = gensym(sbuf_name);
-
- if (flag) {
-
- // FIND NAME
- t_symbol* midpath = NULL;
- //t_symbol* basename = NULL;
-
- if (o_ac && IS_A_SYMBOL(o_av, 0)) {
- char *firstChar = (atom_getsymbol(o_av))->s_name;
- if (*firstChar == (char)'/') {
- strcat(sbuf_name, atom_getsymbol(o_av)->s_name);
- pbi->path = gensym(sbuf_name);
- strcat(sbuf_temp, atom_getsymbol(o_av)->s_name);
- midpath = gensym(sbuf_temp);
- strcat(sbuf_name, "_");
- pbi->path_g = gensym(sbuf_name);
- pbi->basename = atom_getsymbol(o_av);
- }
- }
-
- // if ( x->x_param )
-
-
- if ( pbi->path) {
-
-
- // FIND VALUE
- // A. Find in SUB canvas arguments
- // B. In canvas' arguments
- // C. In object's arguments
- // D. Defaults to a bang
-
- int p_ac =0;
- t_atom* p_av;
-
-
- // A. If name, try to find value in ID canvas' arguments
- if ( midpath) {
- // GET ID CANVAS ARGUMENTS (may be the same as the local canvas)
- //int i_ac;
- //t_atom * i_av;
- tof_get_canvas_arguments(id_canvas,&i_ac , &i_av);
- param_find_value(midpath, i_ac, i_av,&(pbi->ac),&(pbi->av));
- }
-
- // B. If basename, try to find value in LOCAL canvas' arguments
- if ( pbi->basename && pbi->ac == 0 ) {
-
- param_find_value(pbi->basename, ac, av,&(pbi->ac),&(pbi->av));
- }
-
-
- // C. If no value found in canvas' arguments, check the object's arguments
- if ( pbi->ac == 0 && o_ac > 1) {
- int start = 1;
- int count = 0;
- tof_get_tagged_argument('/',o_ac,o_av,&start,&count);
- if (count > 0) {
- pbi->ac = count;
- pbi->av = o_av + start;
- }
- }
-
- //FIND THE GUI TAGS
- param_find_value(gensym("/gui"), o_ac, o_av,&(pbi->ac_g),&(pbi->av_g));
- //post("GUI COUNT:%d",pbi->ac_g);
-
- }
-
-}
-}
-*/
-
-static void param_send_prepend(struct param *p, t_symbol* s,t_symbol* prepend) {
-
- if (p) {
- if((p->selector == &s_bang)) {
- // if (s->s_thing)
- // pd_bang(s->s_thing);
- } else {
- if (s->s_thing) {
- if ( p->selector == &s_list || p->selector == &s_float || p->selector == &s_symbol ) {
- typedmess(s->s_thing, prepend, p->ac, p->av);
- } else {
- int ac = p->ac + 1;
- t_atom *av = getbytes(ac*sizeof(*av));
- tof_copy_atoms(p->av,av+1,p->ac);
- SETSYMBOL(av, p->selector);
- typedmess(s->s_thing, prepend, ac, av);
- freebytes(av, ac*sizeof(*av));
- }
- }
- }
- }
-}
-
-static void param_output(struct param *p, t_outlet* outlet) {
- // SHOULD I COPY THIS DATA BEFORE SENDING IT OUT?
- // OR IS THE NORM TO ONLY COPY ON INPUT?
- if (p) {
- if(!(p->selector == &s_bang) ) {
-
- outlet_anything(outlet, p->selector, p->ac, p->av);
- }
- }
-}
-
-
-static void param_output_prepend(struct param* p, t_outlet* outlet, t_symbol* s) {
-
- if (p->selector == &s_list || p->selector == &s_float || p->selector == &s_symbol) {
- //t_atom *av = (t_atom *)getbytes(p->ac*sizeof(t_atom));
- //tof_copy_atoms(p->av,av,p->ac);
- outlet_anything(outlet,s,p->ac,p->av);
- //freebytes(av, p->ac*sizeof(t_atom));
- } else if (p->selector != &s_bang) {
- int ac = p->ac + 1;
- t_atom *av = (t_atom *)getbytes(ac*sizeof(t_atom));
- tof_copy_atoms(p->av,av+1,p->ac);
- SETSYMBOL(av, p->selector);
- outlet_anything(outlet,s,ac,av);
- freebytes(av, ac*sizeof(t_atom));
- } else if (p->selector == &s_bang) {
- outlet_anything(outlet,s,0,NULL);
- }
-
-}
-
-
-// Write will only save the params that share the same root
-static int param_write(t_canvas* canvas, t_symbol* filename) {
-
-
- int w_error;
-
- //t_symbol* filename = param_makefilename(basename, n);
-
- t_binbuf *bbuf = binbuf_new();
-
- struct param *p = get_param_list(tof_get_dollarzero(canvas));
- while(p) {
- if ((p->selector != &s_bang)) {
- int ac = p->ac + 2;
- t_atom *av = getbytes(ac*sizeof(*av));
- tof_copy_atoms(p->av,av+2,p->ac);
- SETSYMBOL(av, p->path);
- SETSYMBOL(av+1, p->selector);
- binbuf_add(bbuf, ac, av);
- binbuf_addsemi(bbuf);
-
- freebytes(av, ac*sizeof(*av));
- }
- p = p->next;
- }
-
-
- char buf[MAXPDSTRING];
- canvas_makefilename(canvas, filename->s_name,
- buf, MAXPDSTRING);
-
-
- w_error = (binbuf_write(bbuf, buf, "", 0));
- //pd_error("%s: write failed", filename->s_name);
-
- binbuf_free(bbuf);
-
- return w_error;
-
-}
-
-
-static int param_read(t_canvas* canvas, t_symbol* filename)
-{
-
- int r_error;
-
- //t_symbol* filename = param_makefilename(basename, n);
-
- t_binbuf *bbuf = binbuf_new();
-
- r_error= (binbuf_read_via_canvas(bbuf, filename->s_name, canvas, 0));
- //pd_error(x, "%s: read failed", filename->s_name);
-
- t_symbol* root = tof_get_dollarzero(canvas);
-
- int bb_ac = binbuf_getnatom(bbuf);
- int ac = 0;
- t_atom *bb_av = binbuf_getvec(bbuf);
- t_atom *av = bb_av;
-
- while (bb_ac--) {
- if (bb_av->a_type == A_SEMI) {
- if ( IS_A_SYMBOL(av,0) && ac > 1) {
- 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 PARAMDEBUG
- post("Restoring:%s",s->s_name);
- #endif
-
- // STUPID SYMBOL WITH SPACES MANAGEMENT
- if ( s->s_thing && ac > 3 && IS_A_SYMBOL(av,1) && atom_getsymbol(av+1) == &s_symbol) {
- // This whole block is simply to convert symbols saved with spaces to complete symbols
-
- t_binbuf *bbuf_stupid = binbuf_new();
- binbuf_add(bbuf_stupid, ac-2, av+2);
-
- char *char_buf;
- int char_length;
- binbuf_gettext(bbuf_stupid, &char_buf, &char_length);
- char_buf = resizebytes(char_buf, char_length, char_length+1);
- char_buf[char_length] = 0;
- t_symbol* stupid_symbol = gensym(char_buf);
- //post("STUPID: %s",stupid_symbol->s_name);
- freebytes(char_buf, char_length+1);
- binbuf_free(bbuf_stupid);
- t_atom* stupid_atom = getbytes(sizeof(*stupid_atom));
- SETSYMBOL(stupid_atom, stupid_symbol);
- pd_typedmess(s->s_thing, &s_symbol, 1, stupid_atom);
- freebytes(stupid_atom, sizeof(*stupid_atom));
-
- } else {
- if ( s->s_thing) pd_forwardmess(s->s_thing, ac-1, av+1);
- }
- }
-
- ac = 0;
- av = bb_av + 1;
- } else {
-
- ac = ac + 1;
- }
- bb_av++;
- }
-
-
- binbuf_free(bbuf);
-
- return r_error;
-}
-
-
-
-
diff --git a/test/param2-abs.pd b/test/param2-abs.pd
deleted file mode 100644
index f793907..0000000
--- a/test/param2-abs.pd
+++ /dev/null
@@ -1,24 +0,0 @@
-#N canvas 1228 134 711 410 10;
-#X text 84 2 This abstraction is an example for the param external.
-;
-#X obj 175 232 *~;
-#X floatatom 175 147 0 0 0 0 - - -;
-#X floatatom 237 200 0 0 0 0 - - -;
-#X text 64 127 frequency;
-#X text 63 114 modulation;
-#X text 278 216 index;
-#X text 280 197 modulation;
-#X obj 175 172 osc~;
-#X obj 163 341 outlet~;
-#X obj 237 172 param /index 20 /gui nbx;
-#X obj 174 122 param /freq 3 /gui nbx;
-#X obj 172 99 loadbang;
-#X obj 238 148 loadbang;
-#X connect 1 0 9 0;
-#X connect 2 0 8 0;
-#X connect 3 0 1 1;
-#X connect 8 0 1 0;
-#X connect 10 0 3 0;
-#X connect 11 0 2 0;
-#X connect 12 0 11 0;
-#X connect 13 0 10 0;
diff --git a/test/paramDump-help.pd b/test/paramDump-help.pd
deleted file mode 100644
index 1606ddd..0000000
--- a/test/paramDump-help.pd
+++ /dev/null
@@ -1,25 +0,0 @@
-#N canvas 238 80 610 462 10;
-#X obj 38 195 paramDump;
-#X obj 38 228 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
-0;
-#X text 26 68 author: mrtoftrash@gmail.com;
-#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 text 43 294 See the help for the param external to expand your mind:
-;
-#X obj 148 320 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;
diff --git a/test/paramDump.c b/test/paramDump.c
deleted file mode 100644
index a236533..0000000
--- a/test/paramDump.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * paramDump.c
- *
- * Copyright 2009 Thomas O Fredericks <tom@hp>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-
-#include "tof.h"
-#include "param.h"
-
-
-
-static t_class *paramDump_class;
-
-
-typedef struct _paramDump
-{
- t_object x_obj;
- t_outlet* outlet;
- t_symbol* s_set;
- t_symbol* root;
-} t_paramDump;
-
-// Dump out the values of a specific id
-//static void paramDump_values(t_paramDump *x, t_symbol* s, int a_ac, t_atom* a_av) {
-
-/*
-static void paramDump_values(t_paramDump *x, t_symbol* s) {
-
- //if ( s == &s_list && a_ac > 0 && IS_A_SYMBOL(a_av,0) ) s = atom_getsymbol(a_av);
-
- //if ( !(s == &s_list || s == &s_float) ) {
- char* star = "*";
- int all = !(strcmp(s->s_name, star));
-
-
- struct param* pp = get_param_list();
- while (pp) {
- if (pp->root == x->root && (all || pp->id == s) ) {
- param_output_prepend(pp,x->outlet,pp->path);
-
- }
- pp = pp->next;
- }
- //}
-}
-
-*/
-
-static void paramDump_guis(t_paramDump *x, t_symbol* s) {
-
- //char* star = "*";
- //int all = !(strcmp(s->s_name, star));
-
- struct param* pp = get_param_list(x->root);
- while (pp) {
- if (pp->ac_g ) {
-
- outlet_anything(x->outlet,pp->path,pp->ac_g,pp->av_g);
-
- }
- pp = pp->next;
- }
-}
-
-/*
-static void paramDump_update_guis(t_paramDump *x, t_symbol* s) {
-
- char* star = "*";
- int all = !(strcmp(s->s_name, star));
-
- struct param* pp = get_param_list();
- while (pp) {
- if (pp->ac_g && pp->root == x->root && (all || pp->id == s) ) {
-
- param_send_prepend(pp, pp->path_ ,x->s_set );
- //if ( pp->path_g->s_thing)
- // pd_typedmess(pp->path_g->s_thing, pp->selector,pp->ac, pp->av);
-
- //outlet_anything(x->outlet,pp->path,pp->ac_g,pp->av_g);
-
- }
- pp = pp->next;
- }
-}
-*/
-
-
-// Dump out everything (OR THE ID'S OR JUST THE NAMES?)
-static void paramDump_bang(t_paramDump *x) {
-
-
- struct param* pp = get_param_list(x->root);
- #ifdef PARAMDEBUG
- if (pp == NULL) {
- post("No params found");
- } else {
- post("Found params");
- }
- #endif
- while (pp) {
- //if (pp->root == x->root) {
- param_output_prepend(pp,x->outlet,pp->path);
-
- //}
- pp = pp->next;
- }
-
-
-}
-
-
-
-static void paramDump_free(t_paramDump *x)
-{
-
-
-}
-
-
-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->s_set = gensym("set");
-
- x->outlet = outlet_new(&x->x_obj, &s_list);
-
- return (x);
-}
-
-void paramDump_setup(void) {
- paramDump_class = class_new(gensym("paramDump"),
- (t_newmethod)paramDump_new, (t_method)paramDump_free,
- sizeof(t_paramDump), 0, A_GIMME, 0);
-
- class_addbang(paramDump_class, paramDump_bang);
-
- //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_update_guis, gensym("update"), A_DEFSYMBOL,0);
-
-}
diff --git a/test/paramFile-help.pd b/test/paramFile-help.pd
deleted file mode 100644
index 4bca30f..0000000
--- a/test/paramFile-help.pd
+++ /dev/null
@@ -1,52 +0,0 @@
-#N canvas 1102 91 735 547 10;
-#X obj 423 300 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144
--1 -1 0;
-#X obj 474 351 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144
--1 -1 0;
-#X obj 11 36 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577
-0;
-#X text 16 92 author: mrtoftrash@gmail.com;
-#X text 16 113 version: 2009-04-14 (initial release);
-#X obj 30 372 paramFile;
-#X obj 30 291 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
--1;
-#X obj 81 331 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
--1;
-#X text 16 37 description: paramFile is an abstraction than saves and
-restores params in individual files on the hard disk.;
-#X text 16 71 tags: state file param;
-#X text 52 289 Save preset "000";
-#X obj 423 399 paramFile;
-#X floatatom 423 324 5 0 0 0 - - -;
-#X floatatom 474 373 5 0 0 0 - - -;
-#X text 463 322 Save preset N;
-#X text 27 138 Please note that only the param children of the same
-root patch as the paramFile will be saved/restored.;
-#X text 102 328 Restore preset "000";
-#X text 512 372 Restore preset N;
-#X text 423 278 You may save and restore up to 127 different presets.
-;
-#X text 29 178 The data will be saved in the same folder as the root
-patch and will include its name and the preset number as follows:;
-#X text 85 214 root_patch_name-preset#.param;
-#X text 25 234 For example \, if click save on the following bang \,
-the file "paramFile-help-000.param" will be created and will store
-the param "/something_to_save";
-#X text 202 497 See the help for the param external to expand your
-mind.;
-#X text 217 480 --------------------- SEE ALSO -----------------------
-;
-#X obj 34 445 param /something_to_save symbol i_love_you_mary_jane
-;
-#X symbolatom 33 468 40 0 0 0 - - -;
-#X msg 34 420 symbol banana;
-#X msg 128 420 symbol iguana;
-#X connect 0 0 12 0;
-#X connect 1 0 13 0;
-#X connect 6 0 5 0;
-#X connect 7 0 5 1;
-#X connect 12 0 11 0;
-#X connect 13 0 11 1;
-#X connect 24 0 25 0;
-#X connect 26 0 24 0;
-#X connect 27 0 24 0;
diff --git a/test/paramFile.c b/test/paramFile.c
deleted file mode 100644
index 328eb51..0000000
--- a/test/paramFile.c
+++ /dev/null
@@ -1,154 +0,0 @@
-
-#include "tof.h"
-#include "param.h"
-#include <stdio.h>
-#include <fcntl.h>
-
-
-
-static t_class *paramFile_class;
-static t_class *paramFile_inlet2_class;
-struct _paramFile_inlet2;
-
-typedef struct _paramFile
-{
- t_object x_obj;
- //t_outlet *outlet;
- t_canvas *canvas;
- t_symbol *basename;
- struct _paramFile_inlet2 *inlet2;
-} t_paramFile;
-
-typedef struct _paramFile_inlet2 {
- t_object x_obj;
- t_paramFile *x;
-} t_paramFile_inlet2;
-
-
-
-static t_symbol* paramFile_makefilename(t_symbol* basename, t_float f) {
-
- if (f < 0) f = 0;
- if ( f > 127) f = 127;
-
- int i = (int) f;
- int length = strlen(basename->s_name)+11;
- char* buf = getbytes( length * sizeof (*buf));
- sprintf(buf,"%s-%03d.param",basename->s_name,i);
- //strcpy(buf,basename->s_name);
- //strcat(buf,".param");
- t_symbol* filename = gensym(buf);
- freebytes(buf, length * sizeof (*buf));
- //post("File name:%s",filename->s_name);
- return filename;
-}
-
-
-static void paramFile_write(t_paramFile *x, t_float f) {
-
-
- t_symbol* filename = paramFile_makefilename(x->basename,f);
- post("Writing: %s",filename->s_name);
- if ( param_write(x->canvas,filename) ) pd_error(x,"%s: write failed", filename->s_name);
-
-}
-
-
-static void paramFile_read(t_paramFile *x, t_float f) {
-
-
- t_symbol* filename = paramFile_makefilename(x->basename,f);
- post("Reading: %s",filename->s_name);
- if (param_read(x->canvas, filename)) pd_error(x, "%s: read failed", filename->s_name);
-
-
-}
-
-
-
-static void paramFile_bang(t_paramFile *x) {
-
- paramFile_write(x,0);
-}
-
-
-static void paramFile_float(t_paramFile *x, t_float f) {
-
- paramFile_write(x,f);
-
-}
-
-static void paramFile_inlet2_bang(t_paramFile_inlet2 *inlet2) {
-
- paramFile_read(inlet2->x,0);
-
-}
-
-static void paramFile_inlet2_float(t_paramFile_inlet2 *inlet2,t_float f) {
-
- paramFile_read(inlet2->x,f);
-
-}
-
-static void paramFile_free(t_paramFile *x)
-{
-
- if(x->inlet2) pd_free((t_pd *)x->inlet2);
-
-
-}
-
-
-static void* paramFile_new(t_symbol *s, int ac, t_atom *av) {
- t_paramFile *x = (t_paramFile *)pd_new(paramFile_class);
- t_paramFile_inlet2 *inlet2 = (t_paramFile_inlet2 *)pd_new(paramFile_inlet2_class);
-
- inlet2->x = x;
- x->inlet2 = inlet2;
-
- t_canvas* canvas = tof_get_canvas();
- x->canvas = tof_get_root_canvas(canvas);
- t_symbol* canvasname = tof_get_canvas_name(x->canvas);
-
- // remove the .pd (actually removes everything after the .)
- int length = strlen(canvasname->s_name) + 1;
- char* buf = getbytes( (length ) * sizeof (*buf));
- strcpy(buf,canvasname->s_name);
- char* lastperiod = strrchr(buf,'.');
- if ( lastperiod != NULL ) {
- *lastperiod = '\0';
- x->basename = gensym(buf);
- } else {
- x->basename = canvasname;
- }
- freebytes(buf, (length ) * sizeof (*buf));
-
- //x->outlet = outlet_new(&x->x_obj, &s_list);
-
- inlet_new((t_object *)x, (t_pd *)inlet2, 0, 0);
-
- return (x);
-
-}
-
-
-void paramFile_setup(void) {
- paramFile_class = class_new(gensym("paramFile"),
- (t_newmethod)paramFile_new, (t_method)paramFile_free,
- sizeof(t_paramFile), 0, A_GIMME, 0);
-
- class_addbang(paramFile_class, paramFile_bang);
- class_addfloat(paramFile_class, paramFile_float);
-
- paramFile_inlet2_class = class_new(gensym("paramFile_inlet2"),
- 0, 0, sizeof(t_paramFile_inlet2), CLASS_PD | CLASS_NOINLET, 0);
-
- class_addbang(paramFile_inlet2_class, paramFile_inlet2_bang);
- class_addfloat(paramFile_inlet2_class, paramFile_inlet2_float);
-
- class_addmethod(paramFile_class, (t_method) paramFile_read, gensym("load"), A_DEFFLOAT,0);
- class_addmethod(paramFile_class, (t_method) paramFile_write, gensym("save"), A_DEFFLOAT,0);
-
-}
-
-
diff --git a/test/paramRoute-help.pd b/test/paramRoute-help.pd
deleted file mode 100644
index a201d06..0000000
--- a/test/paramRoute-help.pd
+++ /dev/null
@@ -1,39 +0,0 @@
-#N canvas 62 155 886 436 10;
-#X obj 11 36 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577
-0;
-#X text 16 92 author: mrtoftrash@gmail.com;
-#X text 16 113 version: 2009-09-19 (localized version);
-#X text 16 37 description: routes param messages.;
-#X floatatom 389 200 5 0 0 0 - - -;
-#X obj 602 243 hsl 100 15 0 1 0 0 \$0/FM_MOD/volume \$0/FM_MOD/volume_
-/FM_MOD/volume 105 7 0 10 -262144 -1 -1 0 1;
-#X obj 602 263 hsl 100 15 200 2000 0 0 \$0/FM_MOD/carrier \$0/FM_MOD/carrier_
-/FM_MOD/carrier 105 7 0 10 -262144 -1 -1 3300 1;
-#X obj 600 302 nbx 5 14 -1e+37 1e+37 0 0 \$0/FM_MOD/modulation/index
-\$0/FM_MOD/modulation/index_ /FM_MOD/modulation/index 57 7 0 10 -262144
--1 -1 20 256;
-#X obj 600 283 nbx 5 14 -1e+37 1e+37 0 0 \$0/FM_MOD/modulation/freq
-\$0/FM_MOD/modulation/freq_ /FM_MOD/modulation/freq 57 7 0 10 -262144
--1 -1 3 256;
-#X msg 389 222 modulation/index \$1;
-#X obj 429 246 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
--1 -1 0 1;
-#X msg 426 268 volume \$1;
-#X obj 389 293 param-abs /id FM_MOD;
-#X obj 384 327 dac~;
-#X text 13 185 paramRoute routes messages to params that are included
-inside abstractions. It uses a relative path to simplify things.;
-#X text 20 287 Open the "param-abs" abstraction to the right and you
-should undertand what that means (I hope).;
-#X text 216 357 --------------------- SEE ALSO -----------------------
-;
-#X text 190 378 See the help for the param external to expand your
-mind:;
-#X obj 342 398 param /dummy;
-#X text 16 71 tags: state routing param;
-#X connect 4 0 9 0;
-#X connect 9 0 12 0;
-#X connect 10 0 11 0;
-#X connect 11 0 12 0;
-#X connect 12 0 13 0;
-#X connect 12 0 13 1;
diff --git a/test/paramRoute.c b/test/paramRoute.c
deleted file mode 100644
index 4e4f756..0000000
--- a/test/paramRoute.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * paramRoute.c
- *
- * Copyright 2009 Thomas O Fredericks <tom@hp>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-
-
-
-#include "tof.h"
-#include "param.h"
-
-
-static t_class *paramRoute_class;
-
-typedef struct _paramRoute
-{
- t_object x_obj;
- t_symbol *path;
- t_outlet *x_outlet;
- t_symbol *s_save;
- t_symbol *s_load;
- t_symbol* s_empty;
- t_canvas* canvas;
- t_symbol* root;
-
-} 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
-
- if (s == x->s_save) { // Save
-
- //~ if (x->id) {
- //~ int n = 0;
- //~ if ( ac ) n = atom_getfloat(av);
- //~ t_symbol* filename = paramRoute_makefilename(x->id,n);
- //~ if ( param_write(x->canvas,filename, x->id) )
- //~ pd_error("[paramRoute] could not write %s",filename->s_name);
- //~ } else {
- //~ pd_error(x,"[paramRoute] requires an /id");
- //~ }
- } else if ( s == x->s_load) { // Load
- //~ if (x->id) {
- //~ int n = 0;
- //~ if ( ac ) n = atom_getfloat(av);
- //~ t_symbol* filename = paramRoute_makefilename(x->id,n);
- //~ if ( param_read(x->canvas, paramRoute_makefilename(x->id,n)) )
- //~ pd_error("[paramRoute] could not read %s",filename->s_name);;
- //~ } else {
- //~ pd_error(x,"[paramRoute] requires an /id");
- //~ }
- } else { // Try to send
-
- if (ac) {
- //int sendBufLength = strlen(x->path->s_name) + strlen(s->s_name) + 1;
- //char *sendBuf = (char*)getbytes((sendBufLength)*sizeof(char));
-
- 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);
- 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);
- //freebytes(sendBuf, (sendBufLength)*sizeof(char));
- //post("target:%s",target->s_name);
- if (target->s_thing) {
- pd_forwardmess(target->s_thing, ac, av);
- } else {
- outlet_anything(x->x_outlet,path,ac,av);
- }
-
- }
-
- }
-
-}
-
-// DECONSTRUCTOR
-static void paramRoute_free(t_paramRoute*x)
-{
-
-}
-
-// CONSTRUCTOR
-static void *paramRoute_new(t_symbol *s, int ac, t_atom *av) {
- t_paramRoute *x = (t_paramRoute *)pd_new(paramRoute_class);
-
- x->s_save = gensym("save");
- x->s_load = gensym("load");
- x->s_empty = gensym("");
-
-
- // GET THE CURRENT CANVAS
- t_canvas *canvas=tof_get_canvas();
-
- // Get the root canvas
- x->canvas = tof_get_root_canvas(canvas);
-
- x->root = tof_get_dollarzero(x->canvas);
-
- x->path = param_get_path(canvas,NULL);
-
- // INLETS AND OUTLETS
- x->x_outlet = outlet_new(&x->x_obj, &s_list);
- return (x);
-}
-
-void paramRoute_setup(void) {
- paramRoute_class = class_new(gensym("paramRoute"),
- (t_newmethod)paramRoute_new, (t_method)paramRoute_free,
- sizeof(t_paramRoute), 0, A_GIMME, 0);
-
- class_addanything(paramRoute_class, paramRoute_anything);
-
-}