From 41c8a8b33323d85ee9d5a6da4bcadccb93181803 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 14 May 2010 03:49:55 +0000 Subject: sorted out all the objectclasses in cxc, more or less, now let's try debianizing svn path=/trunk/externals/cxc/; revision=13541 --- Makefile | 2 +- counter.c | 226 ----------------------------------------------- cxavgdev-help.pd | 119 +++++++++++++++++++++++++ cxc.c | 16 ++-- cxc_counter-help.pd | 9 ++ cxc_counter.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++ cxc_prepend-help.pd | 13 +++ cxc_prepend.c | 121 +++++++++++++++++++++++++ cxc_split-help.pd | 52 +++++++++++ cxc_split.c | 174 ++++++++++++++++++++++++++++++++++++ cxmean-help.pd | 119 +++++++++++++++++++++++++ cxstddev-help.pd | 119 +++++++++++++++++++++++++ hex2dec-help.pd | 8 ++ ixprint-help.pd | 8 ++ mean~-help.pd | 119 +++++++++++++++++++++++++ mean~.c | 16 ++-- prepend.c | 121 ------------------------- reference/cxc.prepend.pd | 13 --- reference/cxc.split.pd | 52 ----------- reference/statistics.pd | 120 ------------------------- split.c | 174 ------------------------------------ 21 files changed, 1104 insertions(+), 723 deletions(-) delete mode 100644 counter.c create mode 100644 cxavgdev-help.pd create mode 100644 cxc_counter-help.pd create mode 100644 cxc_counter.c create mode 100644 cxc_prepend-help.pd create mode 100644 cxc_prepend.c create mode 100644 cxc_split-help.pd create mode 100644 cxc_split.c create mode 100644 cxmean-help.pd create mode 100644 cxstddev-help.pd create mode 100644 hex2dec-help.pd create mode 100644 ixprint-help.pd create mode 100644 mean~-help.pd delete mode 100644 prepend.c delete mode 100644 reference/cxc.prepend.pd delete mode 100644 reference/cxc.split.pd delete mode 100644 reference/statistics.pd delete mode 100644 split.c diff --git a/Makefile b/Makefile index 5c4cbb9..a674121 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ LIBRARY_NAME = cxc # add your .c source files to the SOURCES variable, help files will be # included automatically -SOURCES = ENV.c ascseq.c ascwave.c bfilt.c bfilt2.c binshift.c counter.c cxavgdev.c cxmean.c cxstddev.c delta~.c dist_normal.c hex2dec.c ixprint.c mean~.c prepend.c random1.c random1~.c random_fl.c random_fl~.c random_icg.c random_icg~.c random_tw.c reson~.c split.c utime.c +SOURCES = ENV.c ascseq.c ascwave.c bfilt.c bfilt2.c cxc_counter.c cxavgdev.c cxc_prepend.c cxc_split.c cxmean.c cxstddev.c delta~.c dist_normal.c hex2dec.c ixprint.c mean~.c random1.c random1~.c random_fl.c random_fl~.c random_icg.c random_icg~.c random_tw.c reson~.c utime.c # For objects that only build on certain platforms, add those to the SOURCES # line for the right platforms. diff --git a/counter.c b/counter.c deleted file mode 100644 index 436cb42..0000000 --- a/counter.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 1997-1999 Mark Danks. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. - */ - -#include "m_pd.h" - -/* -------------------------- counter ------------------------------ */ - -/* instance structure */ -static t_class *counter_class; - -typedef struct _counter -{ - t_object x_obj; /* obligatory object header */ - int c_current; /* current number */ - int c_high; /* highest number */ - int c_low; /* lowest number */ - int c_updown; /* 0 = going up, 1 = going down */ - int c_dir; /* counter dir. 1=up, 2=down, 3=up/down */ - t_outlet *t_out1; /* the outlet */ - t_outlet *t_out2; /* the outlet */ -} t_counter; - -void counter_bang(t_counter *x) -{ - int sendBang = 0; - switch(x->c_dir) - { - // count up - case 1: - x->c_current++; - if (x->c_current > x->c_high) - x->c_current = x->c_low; - else if (x->c_current < x->c_low) - x->c_current = x->c_low; - else if (x->c_current == x->c_high) - sendBang = 1; - break; - // count down - case 2: - x->c_current--; - if (x->c_current < x->c_low) - x->c_current = x->c_high; - else if (x->c_current > x->c_high) - x->c_current = x->c_high; - else if (x->c_current == x->c_low) - sendBang = 1; - break; - // count up and down - case 3: - // going up - if (x->c_updown == 0) - { - x->c_current++; - if (x->c_current > x->c_high) - { - x->c_current = x->c_high - 1; - x->c_updown = 1; - } - else if (x->c_current < x->c_low) - x->c_current = x->c_low; - else if (x->c_current == x->c_high) - sendBang = 1; - } - // going down - else if (x->c_updown == 1) - { - x->c_current--; - if (x->c_current < x->c_low) - { - x->c_current = x->c_low + 1; - x->c_updown = 0; - } - else if (x->c_current > x->c_high) - x->c_current = x->c_high; - else if (x->c_current == x->c_low) - sendBang = 1; - } - else - { - error("up/down wrong"); - return; - } - break; - default: - error("dir wrong"); - return; - } - outlet_float(x->t_out1, (float)x->c_current); - if (sendBang) - outlet_bang(x->t_out2); -} - -void counter_dir(t_counter *x, t_floatarg n) -{ - if (n == 1 || n == 2 || n == 3) x->c_dir = (int)n; - else error("bad dir"); -} - -void counter_high(t_counter *x, t_floatarg n) -{ - x->c_high = (int)n; -} - -void counter_low(t_counter *x, t_floatarg n) -{ - x->c_low = (int)n; -} - -void counter_reset(t_counter *x, t_symbol *s, int argc, t_atom *argv) -{ - if (!argc) - { - switch(x->c_dir) - { - case 1: - x->c_current = x->c_low; - break; - case 2: - x->c_current = x->c_high; - break; - case 3: - if (x->c_updown == 0) x->c_current = x->c_low; - else if (x->c_updown == 1) x->c_current = x->c_high; - break; - default: - return; - } - } - else - { - switch(argv[0].a_type) - { - case A_FLOAT : - x->c_current = (int)argv[0].a_w.w_float; - break; - default : - error ("counter: reset not float"); - break; - } - } - outlet_float(x->t_out1, (float)x->c_current); -} - -void counter_clear(t_counter *x, t_symbol *s, int argc, t_atom *argv) -{ - if (!argc) - { - switch(x->c_dir) - { - case 1: - x->c_current = x->c_low - 1; - break; - case 2: - x->c_current = x->c_high + 1; - break; - case 3: - if (x->c_updown == 0) x->c_current = x->c_low - 1; - else if (x->c_updown == 1) x->c_current = x->c_high + 1; - break; - default: - break; - } - } - else - { - switch(argv[0].a_type) - { - case A_FLOAT : - x->c_current = (int)argv[0].a_w.w_float - 1; - break; - default : - error ("counter: reset not float"); - break; - } - } -} - -void *counter_new(t_floatarg f, t_floatarg g, t_floatarg h) /* init vals in struc */ -{ - t_counter *x = (t_counter *)pd_new(counter_class); - x->t_out1 = outlet_new(&x->x_obj, 0); - x->t_out2 = outlet_new(&x->x_obj, 0); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1")); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2")); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl3")); - x->c_current = 0; - x->c_updown = 0; - if (h) - { - counter_low(x, f); - counter_high(x, g); - counter_dir(x, h); - } - else if (g) - { - x->c_dir = 1; - counter_low(x, f); - counter_high(x, g); - } - else if (f) - { - x->c_dir = x->c_low = 1; - counter_high(x, f); - } - else - { - x->c_dir = x->c_low = 1; - x->c_high = 10; - } - return (x); -} - -void counter_setup(void) -{ - counter_class = class_new(gensym("counter"), (t_newmethod)counter_new, 0, - sizeof(t_counter), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addbang(counter_class, (t_method)counter_bang); - class_addmethod(counter_class, (t_method)counter_dir, gensym("fl1"), A_FLOAT, 0); - class_addmethod(counter_class, (t_method)counter_low, gensym("fl2"), A_FLOAT, 0); - class_addmethod(counter_class, (t_method)counter_high, gensym("fl3"), A_FLOAT, 0); - class_addmethod(counter_class, (t_method)counter_reset, gensym("reset"), A_GIMME, 0); - class_addmethod(counter_class, (t_method)counter_clear, gensym("clear"), A_GIMME, 0); -} diff --git a/cxavgdev-help.pd b/cxavgdev-help.pd new file mode 100644 index 0000000..d9c75f3 --- /dev/null +++ b/cxavgdev-help.pd @@ -0,0 +1,119 @@ +#N canvas 110 368 622 369 10; +#X obj 64 102 noise~; +#X obj 463 105 mean~ blir; +#X obj 21 262 table blir; +#N canvas 162 270 331 246 fillary 0; +#X obj 34 53 until; +#X obj 34 79 count; +#X msg 85 27 bang; +#X obj 34 105 - 1; +#X obj 34 130 t b f; +#X obj 34 166 random_fl -1 1; +#X obj 162 16 loadbang; +#X obj 192 64 utime; +#X obj 200 100 +; +#X msg 200 124 seed \$1; +#X obj 162 39 t b b b; +#X obj 232 13 inlet; +#X obj 120 65 t b b; +#X msg 34 27 1000; +#X msg 132 108 set \$1; +#X obj 280 13 inlet; +#X obj 178 165 random_icg -1 1; +#X obj 34 192 tabwrite blor; +#X connect 0 0 1 0; +#X connect 1 0 3 0; +#X connect 2 0 1 1; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X connect 4 1 17 1; +#X connect 5 0 17 0; +#X connect 6 0 10 0; +#X connect 7 0 8 0; +#X connect 7 1 8 1; +#X connect 8 0 9 0; +#X connect 9 0 5 0; +#X connect 9 0 16 0; +#X connect 10 0 12 0; +#X connect 10 1 7 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 12 1 2 0; +#X connect 13 0 0 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 16 0 17 0; +#X restore 152 241 pd fillary; +#X obj 21 175 tabwrite~ blir; +#X msg 21 147 bang; +#X obj 356 102 samplerate~; +#X floatatom 356 126 5 0 0 0 - - -; +#X obj 356 80 loadbang; +#X floatatom 463 129 8 0 0 0 - - -; +#X obj 64 150 +~ 0.1; +#X floatatom 101 127 5 0 0 0 - - -; +#X msg 152 218 bang; +#X text 44 30 mean~ ; +#X floatatom 160 160 5 0 0 0 - - -; +#X obj 160 183 t f f; +#X text 206 163 set arraysize; +#X text 529 130 mean; +#X text 43 10 this is supposed to calculate the signal mean of an array. +; +#X msg 463 82 mean; +#X msg 503 82 ad; +#X msg 534 82 sd; +#X obj 462 35 mean 1 2 3; +#X floatatom 462 59 5 0 0 0 - - -; +#X msg 462 13 1 2 3.6677; +#X floatatom 271 305 8 0 0 0 - - -; +#X msg 316 228 mean; +#X msg 350 228 ad; +#X obj 21 291 table blor; +#X floatatom 341 325 10 0 0 0 - - -; +#X floatatom 461 326 10 0 0 0 - - -; +#X obj 392 150 loadbang; +#X obj 316 272 t f f f; +#X text 542 36 pd's mean; +#X text 544 115 dont need this; +#X msg 392 218 set \$1; +#X obj 392 194 symbol; +#X msg 392 173 blir; +#X msg 429 173 blor; +#X msg 20 214 \; blir resize \$1 \;; +#X msg 113 270 \; blor resize \$1 \;; +#X obj 460 304 cxstddev blir; +#X obj 342 304 cxavgdev blir; +#X obj 316 251 cxmean blir; +#X connect 0 0 10 0; +#X connect 1 0 9 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 8 0 6 0; +#X connect 10 0 4 0; +#X connect 11 0 10 1; +#X connect 12 0 3 0; +#X connect 14 0 15 0; +#X connect 15 0 39 0; +#X connect 15 0 40 0; +#X connect 15 1 3 1; +#X connect 19 0 1 0; +#X connect 20 0 1 0; +#X connect 21 0 1 0; +#X connect 22 0 23 0; +#X connect 24 0 22 0; +#X connect 26 0 43 0; +#X connect 27 0 43 0; +#X connect 31 0 38 0; +#X connect 32 0 25 0; +#X connect 32 1 42 0; +#X connect 32 2 41 0; +#X connect 35 0 41 0; +#X connect 35 0 42 0; +#X connect 35 0 43 0; +#X connect 36 0 35 0; +#X connect 37 0 36 0; +#X connect 38 0 36 0; +#X connect 41 0 30 0; +#X connect 42 0 29 0; +#X connect 43 0 32 0; diff --git a/cxc.c b/cxc.c index 25717ed..3a14da4 100644 --- a/cxc.c +++ b/cxc.c @@ -17,7 +17,7 @@ typedef struct _cxc static t_class* cxc_class; -void binshift_setup(); +//void binshift_setup(); void ascwave_setup(); void ascseq_setup(); void ixprint_setup(); @@ -30,11 +30,11 @@ void bfilt2_setup(); /* void routeOSC_setup(); */ //void testy_tilde_setup(); //void garlic_tilde_setup(); -void counter_setup(); +void cxc_counter_setup(); void reson_tilde_setup(); //void serialize_setup(); -void prepend_setup(); -void split_setup(); +void cxc_prepend_setup(); +void cxc_split_setup(); void utime_setup(); // RNG's void random1_setup(); @@ -67,7 +67,7 @@ void cxc_setup(void) cxc_class = class_new(gensym("cxc"), (t_newmethod)cxc_new, 0, sizeof(t_cxc), 0,0); ixprint_setup(); - binshift_setup(); +// binshift_setup(); ascwave_setup(); ascseq_setup(); // mixer_setup(); @@ -77,11 +77,11 @@ void cxc_setup(void) /* sendOSC_setup(); */ /* dumpOSC_setup(); */ /* routeOSC_setup(); */ - counter_setup(); + cxc_counter_setup(); reson_tilde_setup(); //serialize_setup(); - prepend_setup(); - split_setup(); + cxc_prepend_setup(); + cxc_split_setup(); utime_setup(); // RNG's random1_setup(); diff --git a/cxc_counter-help.pd b/cxc_counter-help.pd new file mode 100644 index 0000000..c1833aa --- /dev/null +++ b/cxc_counter-help.pd @@ -0,0 +1,9 @@ +#N canvas 344 237 450 300 10; +#X obj 192 146 cxc_counter; +#X floatatom 194 192 5 0 0 0 - - -; +#X obj 193 90 metro 500; +#X obj 196 61 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 2 0; diff --git a/cxc_counter.c b/cxc_counter.c new file mode 100644 index 0000000..c84f851 --- /dev/null +++ b/cxc_counter.c @@ -0,0 +1,226 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- counter ------------------------------ */ + +/* instance structure */ +static t_class *counter_class; + +typedef struct _counter +{ + t_object x_obj; /* obligatory object header */ + int c_current; /* current number */ + int c_high; /* highest number */ + int c_low; /* lowest number */ + int c_updown; /* 0 = going up, 1 = going down */ + int c_dir; /* counter dir. 1=up, 2=down, 3=up/down */ + t_outlet *t_out1; /* the outlet */ + t_outlet *t_out2; /* the outlet */ +} t_counter; + +void counter_bang(t_counter *x) +{ + int sendBang = 0; + switch(x->c_dir) + { + // count up + case 1: + x->c_current++; + if (x->c_current > x->c_high) + x->c_current = x->c_low; + else if (x->c_current < x->c_low) + x->c_current = x->c_low; + else if (x->c_current == x->c_high) + sendBang = 1; + break; + // count down + case 2: + x->c_current--; + if (x->c_current < x->c_low) + x->c_current = x->c_high; + else if (x->c_current > x->c_high) + x->c_current = x->c_high; + else if (x->c_current == x->c_low) + sendBang = 1; + break; + // count up and down + case 3: + // going up + if (x->c_updown == 0) + { + x->c_current++; + if (x->c_current > x->c_high) + { + x->c_current = x->c_high - 1; + x->c_updown = 1; + } + else if (x->c_current < x->c_low) + x->c_current = x->c_low; + else if (x->c_current == x->c_high) + sendBang = 1; + } + // going down + else if (x->c_updown == 1) + { + x->c_current--; + if (x->c_current < x->c_low) + { + x->c_current = x->c_low + 1; + x->c_updown = 0; + } + else if (x->c_current > x->c_high) + x->c_current = x->c_high; + else if (x->c_current == x->c_low) + sendBang = 1; + } + else + { + error("up/down wrong"); + return; + } + break; + default: + error("dir wrong"); + return; + } + outlet_float(x->t_out1, (float)x->c_current); + if (sendBang) + outlet_bang(x->t_out2); +} + +void counter_dir(t_counter *x, t_floatarg n) +{ + if (n == 1 || n == 2 || n == 3) x->c_dir = (int)n; + else error("bad dir"); +} + +void counter_high(t_counter *x, t_floatarg n) +{ + x->c_high = (int)n; +} + +void counter_low(t_counter *x, t_floatarg n) +{ + x->c_low = (int)n; +} + +void counter_reset(t_counter *x, t_symbol *s, int argc, t_atom *argv) +{ + if (!argc) + { + switch(x->c_dir) + { + case 1: + x->c_current = x->c_low; + break; + case 2: + x->c_current = x->c_high; + break; + case 3: + if (x->c_updown == 0) x->c_current = x->c_low; + else if (x->c_updown == 1) x->c_current = x->c_high; + break; + default: + return; + } + } + else + { + switch(argv[0].a_type) + { + case A_FLOAT : + x->c_current = (int)argv[0].a_w.w_float; + break; + default : + error ("counter: reset not float"); + break; + } + } + outlet_float(x->t_out1, (float)x->c_current); +} + +void counter_clear(t_counter *x, t_symbol *s, int argc, t_atom *argv) +{ + if (!argc) + { + switch(x->c_dir) + { + case 1: + x->c_current = x->c_low - 1; + break; + case 2: + x->c_current = x->c_high + 1; + break; + case 3: + if (x->c_updown == 0) x->c_current = x->c_low - 1; + else if (x->c_updown == 1) x->c_current = x->c_high + 1; + break; + default: + break; + } + } + else + { + switch(argv[0].a_type) + { + case A_FLOAT : + x->c_current = (int)argv[0].a_w.w_float - 1; + break; + default : + error ("counter: reset not float"); + break; + } + } +} + +void *counter_new(t_floatarg f, t_floatarg g, t_floatarg h) /* init vals in struc */ +{ + t_counter *x = (t_counter *)pd_new(counter_class); + x->t_out1 = outlet_new(&x->x_obj, 0); + x->t_out2 = outlet_new(&x->x_obj, 0); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl3")); + x->c_current = 0; + x->c_updown = 0; + if (h) + { + counter_low(x, f); + counter_high(x, g); + counter_dir(x, h); + } + else if (g) + { + x->c_dir = 1; + counter_low(x, f); + counter_high(x, g); + } + else if (f) + { + x->c_dir = x->c_low = 1; + counter_high(x, f); + } + else + { + x->c_dir = x->c_low = 1; + x->c_high = 10; + } + return (x); +} + +void cxc_counter_setup(void) +{ + counter_class = class_new(gensym("cxc_counter"), (t_newmethod)counter_new, 0, + sizeof(t_counter), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(counter_class, (t_method)counter_bang); + class_addmethod(counter_class, (t_method)counter_dir, gensym("fl1"), A_FLOAT, 0); + class_addmethod(counter_class, (t_method)counter_low, gensym("fl2"), A_FLOAT, 0); + class_addmethod(counter_class, (t_method)counter_high, gensym("fl3"), A_FLOAT, 0); + class_addmethod(counter_class, (t_method)counter_reset, gensym("reset"), A_GIMME, 0); + class_addmethod(counter_class, (t_method)counter_clear, gensym("clear"), A_GIMME, 0); +} diff --git a/cxc_prepend-help.pd b/cxc_prepend-help.pd new file mode 100644 index 0000000..bc05e5d --- /dev/null +++ b/cxc_prepend-help.pd @@ -0,0 +1,13 @@ +#N canvas 322 265 450 300 10; +#X obj 186 244 print; +#X msg 200 102 itsch ni san chi; +#X obj 186 187 cxc_prepend /bla; +#X obj 186 210 cxc_prepend send; +#X floatatom 155 79 5 0 0; +#X msg 214 138 qui qua 2 3.4555 "bla ha"; +#X text 25 11 prepend arbitrary length lists/anythings with stuff; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 3 0 0 0; +#X connect 4 0 2 0; +#X connect 5 0 2 0; diff --git a/cxc_prepend.c b/cxc_prepend.c new file mode 100644 index 0000000..c7e186f --- /dev/null +++ b/cxc_prepend.c @@ -0,0 +1,121 @@ +#include +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +/* this is taken from ggee, where the file was hanging around but the object was not + funtional. i keep it here for reference since i dont wnat to fix it over and over ;) + but its not included in the makefile to avoid namespace clash with ggee.prepend + anyhow, i ll just rename it cxc_prepend +*/ + +/* ------------------------ prepend ----------------------------- */ + +static t_class *prepend_class; + + +typedef struct _prepend +{ + t_object x_obj; + t_symbol* x_s; +} t_prepend; + + +void prepend_anything(t_prepend *x,t_symbol* s,t_int argc,t_atom* argv) +{ + int i = argc; + t_symbol* cur; + t_atom a_out[256]; + int c_out = 0; + t_atom* a = a_out; + +#if 1 + // post("sym: %s",s->s_name); + SETSYMBOL(a,s); + a++; + c_out++; +#endif + + while (i--) { + switch( argv->a_type) { + case A_FLOAT: + // post("flo: %f",atom_getfloat(argv)); + SETFLOAT(a,atom_getfloat(argv)); + a++; + c_out++; + break; + case A_SYMBOL: + // post("sym: %s",atom_getsymbol(argv)->s_name); + SETSYMBOL(a,atom_getsymbol(argv)); + a++; + c_out++; + break; + default: + post("prepend.c: unknown type"); + } + argv++; + } + + outlet_anything(x->x_obj.ob_outlet,x->x_s,c_out,(t_atom*)&a_out); + //post("done"); +} + +void prepend_list(t_prepend *x,t_symbol* s,t_int argc,t_atom* argv) +{ + int i = argc; + t_symbol* cur; + t_atom a_out[256]; + int c_out = 0; + t_atom* a = a_out; + + while (i--) { + switch( argv->a_type) { + case A_FLOAT: + // post("flo: %f",atom_getfloat(argv)); + SETFLOAT(a,atom_getfloat(argv)); + a++; + c_out++; + break; + case A_SYMBOL: + // post("sym: %s",atom_getsymbol(argv)->s_name); + SETSYMBOL(a,atom_getsymbol(argv)); + a++; + c_out++; + break; + default: + post("prepend.c: unknown type"); + } + argv++; + } + + outlet_anything(x->x_obj.ob_outlet,x->x_s,c_out,(t_atom*)&a_out); + //post("done"); +} + +static void *prepend_new(t_symbol* s) +{ + t_prepend *x = (t_prepend *)pd_new(prepend_class); + outlet_new(&x->x_obj, &s_float); + if (s != &s_) + x->x_s = s; + else + x->x_s = gensym("cxc_prepend"); + return (x); +} + +static void prepend_set(t_prepend *x, t_symbol *s) +{ + x->x_s = s; +} + +void cxc_prepend_setup(void) +{ + prepend_class = class_new(gensym("cxc_prepend"), (t_newmethod)prepend_new, 0, + sizeof(t_prepend), 0,A_DEFSYM,NULL); + class_addlist(prepend_class, prepend_list); + class_addanything(prepend_class,prepend_anything); + class_addmethod(prepend_class, (t_method)prepend_set, gensym("set"), A_SYMBOL, 0); +} + + diff --git a/cxc_split-help.pd b/cxc_split-help.pd new file mode 100644 index 0000000..26442d7 --- /dev/null +++ b/cxc_split-help.pd @@ -0,0 +1,52 @@ +#N canvas 100 100 576 380 10; +#X msg 239 145 set x; +#X msg 172 144 set .; +#X obj 25 324 unpack f f f f; +#X floatatom 25 354 5 0 0 0 - - -; +#X floatatom 67 354 5 0 0 0 - - -; +#X floatatom 108 354 5 0 0 0 - - -; +#X floatatom 147 354 5 0 0 0 - - -; +#X msg 284 91 bli.5.bla.8.90; +#X msg 25 59 62.116.7.89; +#X msg 113 143 set /; +#X msg 158 60 /home/someone/pd/test/patches/bla.pd; +#X msg 322 145 set azwejdgb; +#X obj 336 236 print; +#X text 320 125 only the 1st character is used; +#X obj 336 205 cxc_split .; +#X obj 25 196 cxc_split .; +#X text 110 123 set the delimiter; +#X obj 368 308 unpack s s s s; +#X symbolatom 367 347 10 0 0 0 - - -; +#X symbolatom 449 346 10 0 0 0 - - -; +#X msg 56 149 set \$1; +#X symbolatom 55 114 10 0 0 0 - - -; +#X obj 63 230 print; +#X obj 25 299 route list; +#X msg 41 89 12.334/345.555/666.666/2389.23; +#X text 26 5 split or tokenize the incoming string at the specified +delimiter \, digit-only substrings (including the .) are converted +to numbers.; +#X connect 0 0 14 0; +#X connect 1 0 14 0; +#X connect 2 0 3 0; +#X connect 2 1 4 0; +#X connect 2 2 5 0; +#X connect 2 3 6 0; +#X connect 7 0 14 0; +#X connect 8 0 15 0; +#X connect 9 0 14 0; +#X connect 10 0 14 0; +#X connect 11 0 14 0; +#X connect 14 0 12 0; +#X connect 14 0 17 0; +#X connect 15 0 23 0; +#X connect 17 0 18 0; +#X connect 17 1 19 0; +#X connect 20 0 15 0; +#X connect 21 0 20 0; +#X connect 23 0 2 0; +#X connect 23 0 22 0; +#X connect 23 1 2 0; +#X connect 23 1 22 0; +#X connect 24 0 15 0; diff --git a/cxc_split.c b/cxc_split.c new file mode 100644 index 0000000..0d55f3a --- /dev/null +++ b/cxc_split.c @@ -0,0 +1,174 @@ +#include +#include +#include +#include +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +/* this is taken from ggee, where the file was hanging around but the object was not + funtional. i keep it here for reference since i dont wnat to fix it over and over ;) + but its not included in the makefile to avoid namespace clash with ggee.prepend + anyhow, i ll just rename it cxc.prepend +*/ + +/* ------------------------ split ----------------------------- */ + +// why have to do this? +void split_anything(); + +static t_class *split_class; + + +typedef struct _split +{ + t_object x_obj; + t_symbol* x_splitter; +} t_split; + + +void split_symbol(t_split *x, t_symbol *s) +{ + t_atom* a; + split_anything(x, s, 0, a); +} + + +// move these to generic location later on +int split_string_isnum(char* s) +{ + // int isnum = 1; + char tc; + while((tc = *s++) != '\0') { + // tc= s; + switch(tc) { + case 46: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: + // post("yo numba: %c", tc); + break; + default: + return 0; + break; + } + } + return 1; +} + +void split_anything(t_split *x,t_symbol* s,t_int argc,t_atom* argv) +{ + int i = argc; int j; + t_symbol* cur; + t_atom a_out[256]; + int c_out = 0; + t_atom* a = a_out; + // char *str; + char u[MAXPDSTRING]; + char v[MAXPDSTRING]; + // char *v; + u[0] = '\0'; + v[0] = '\0'; + int isnum = 1; + // float tf; + + for(j=0; js_name); j++) { + u[0] = s->s_name[j]; + if(u[0] == x->x_splitter->s_name[0]) { + if(v[0] != '\0') { // delimiter is first character + // check if string is digits only + if(split_string_isnum(v)) { + SETFLOAT(a, (float)atof(v)); + } + else { + SETSYMBOL(a, gensym(v)); + } + a++; c_out++; + // reset stuff + v[0] = '\0'; + isnum = 1; + } // v[0] != '\0' + } else { + strncat(v, u, 1); + } // char matches splitter + } + + // have to do this again here, damn. + if(split_string_isnum(v)) { + SETFLOAT(a, (float)atof(v)); + } + else { + SETSYMBOL(a, gensym(v)); + } + a++, c_out++; + + outlet_list(x->x_obj.ob_outlet, &s_list, c_out, (t_atom*)&a_out); + // outlet_anything(x->x_obj.ob_outlet,gensym("list"),c_out,(t_atom*)&a_out); +} + +void split_list(t_split *x,t_symbol* s,t_int argc,t_atom* argv) +{ + int i = argc; + t_symbol* cur; + t_atom a_out[256]; + int c_out = 0; + t_atom* a = a_out; + + while (i--) { + switch( argv->a_type) { + case A_FLOAT: + // post("flo: %f",atom_getfloat(argv)); + SETFLOAT(a,atom_getfloat(argv)); + a++; + c_out++; + break; + case A_SYMBOL: + // post("sym: %s",atom_getsymbol(argv)->s_name); + SETSYMBOL(a,atom_getsymbol(argv)); + a++; + c_out++; + break; + default: + post("split.c: unknown type"); + } + argv++; + } + + outlet_anything(x->x_obj.ob_outlet,x->x_splitter,c_out,(t_atom*)&a_out); + //post("done"); +} + +static void *split_new(t_symbol* s) +{ + t_split *x = (t_split *)pd_new(split_class); + outlet_new(&x->x_obj, &s_float); + if (s != &s_) + x->x_splitter = s; + else + x->x_splitter = gensym("cxc_split"); + return (x); +} + +static void split_set(t_split *x, t_symbol *s) +{ + t_symbol *t; + // init temp splitter + char u[1]; u[0] = '\0'; + + if(strlen(s->s_name) > 1) { + // t = gensym((char*)s->s_name[0]); + // post("%d", s->s_name[0]); + strncat(u, s->s_name, 1); + t = gensym(u); + } else + t = s; + x->x_splitter = t; +} + +void cxc_split_setup(void) +{ + split_class = class_new(gensym("cxc_split"), (t_newmethod)split_new, 0, + sizeof(t_split), 0,A_DEFSYM,NULL); + // class_addlist(split_class, split_list); + class_addanything(split_class,split_anything); + class_addmethod(split_class, (t_method)split_set, gensym("set"), A_SYMBOL, 0); + class_addsymbol(split_class, split_symbol); +} diff --git a/cxmean-help.pd b/cxmean-help.pd new file mode 100644 index 0000000..d9c75f3 --- /dev/null +++ b/cxmean-help.pd @@ -0,0 +1,119 @@ +#N canvas 110 368 622 369 10; +#X obj 64 102 noise~; +#X obj 463 105 mean~ blir; +#X obj 21 262 table blir; +#N canvas 162 270 331 246 fillary 0; +#X obj 34 53 until; +#X obj 34 79 count; +#X msg 85 27 bang; +#X obj 34 105 - 1; +#X obj 34 130 t b f; +#X obj 34 166 random_fl -1 1; +#X obj 162 16 loadbang; +#X obj 192 64 utime; +#X obj 200 100 +; +#X msg 200 124 seed \$1; +#X obj 162 39 t b b b; +#X obj 232 13 inlet; +#X obj 120 65 t b b; +#X msg 34 27 1000; +#X msg 132 108 set \$1; +#X obj 280 13 inlet; +#X obj 178 165 random_icg -1 1; +#X obj 34 192 tabwrite blor; +#X connect 0 0 1 0; +#X connect 1 0 3 0; +#X connect 2 0 1 1; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X connect 4 1 17 1; +#X connect 5 0 17 0; +#X connect 6 0 10 0; +#X connect 7 0 8 0; +#X connect 7 1 8 1; +#X connect 8 0 9 0; +#X connect 9 0 5 0; +#X connect 9 0 16 0; +#X connect 10 0 12 0; +#X connect 10 1 7 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 12 1 2 0; +#X connect 13 0 0 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 16 0 17 0; +#X restore 152 241 pd fillary; +#X obj 21 175 tabwrite~ blir; +#X msg 21 147 bang; +#X obj 356 102 samplerate~; +#X floatatom 356 126 5 0 0 0 - - -; +#X obj 356 80 loadbang; +#X floatatom 463 129 8 0 0 0 - - -; +#X obj 64 150 +~ 0.1; +#X floatatom 101 127 5 0 0 0 - - -; +#X msg 152 218 bang; +#X text 44 30 mean~ ; +#X floatatom 160 160 5 0 0 0 - - -; +#X obj 160 183 t f f; +#X text 206 163 set arraysize; +#X text 529 130 mean; +#X text 43 10 this is supposed to calculate the signal mean of an array. +; +#X msg 463 82 mean; +#X msg 503 82 ad; +#X msg 534 82 sd; +#X obj 462 35 mean 1 2 3; +#X floatatom 462 59 5 0 0 0 - - -; +#X msg 462 13 1 2 3.6677; +#X floatatom 271 305 8 0 0 0 - - -; +#X msg 316 228 mean; +#X msg 350 228 ad; +#X obj 21 291 table blor; +#X floatatom 341 325 10 0 0 0 - - -; +#X floatatom 461 326 10 0 0 0 - - -; +#X obj 392 150 loadbang; +#X obj 316 272 t f f f; +#X text 542 36 pd's mean; +#X text 544 115 dont need this; +#X msg 392 218 set \$1; +#X obj 392 194 symbol; +#X msg 392 173 blir; +#X msg 429 173 blor; +#X msg 20 214 \; blir resize \$1 \;; +#X msg 113 270 \; blor resize \$1 \;; +#X obj 460 304 cxstddev blir; +#X obj 342 304 cxavgdev blir; +#X obj 316 251 cxmean blir; +#X connect 0 0 10 0; +#X connect 1 0 9 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 8 0 6 0; +#X connect 10 0 4 0; +#X connect 11 0 10 1; +#X connect 12 0 3 0; +#X connect 14 0 15 0; +#X connect 15 0 39 0; +#X connect 15 0 40 0; +#X connect 15 1 3 1; +#X connect 19 0 1 0; +#X connect 20 0 1 0; +#X connect 21 0 1 0; +#X connect 22 0 23 0; +#X connect 24 0 22 0; +#X connect 26 0 43 0; +#X connect 27 0 43 0; +#X connect 31 0 38 0; +#X connect 32 0 25 0; +#X connect 32 1 42 0; +#X connect 32 2 41 0; +#X connect 35 0 41 0; +#X connect 35 0 42 0; +#X connect 35 0 43 0; +#X connect 36 0 35 0; +#X connect 37 0 36 0; +#X connect 38 0 36 0; +#X connect 41 0 30 0; +#X connect 42 0 29 0; +#X connect 43 0 32 0; diff --git a/cxstddev-help.pd b/cxstddev-help.pd new file mode 100644 index 0000000..d9c75f3 --- /dev/null +++ b/cxstddev-help.pd @@ -0,0 +1,119 @@ +#N canvas 110 368 622 369 10; +#X obj 64 102 noise~; +#X obj 463 105 mean~ blir; +#X obj 21 262 table blir; +#N canvas 162 270 331 246 fillary 0; +#X obj 34 53 until; +#X obj 34 79 count; +#X msg 85 27 bang; +#X obj 34 105 - 1; +#X obj 34 130 t b f; +#X obj 34 166 random_fl -1 1; +#X obj 162 16 loadbang; +#X obj 192 64 utime; +#X obj 200 100 +; +#X msg 200 124 seed \$1; +#X obj 162 39 t b b b; +#X obj 232 13 inlet; +#X obj 120 65 t b b; +#X msg 34 27 1000; +#X msg 132 108 set \$1; +#X obj 280 13 inlet; +#X obj 178 165 random_icg -1 1; +#X obj 34 192 tabwrite blor; +#X connect 0 0 1 0; +#X connect 1 0 3 0; +#X connect 2 0 1 1; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X connect 4 1 17 1; +#X connect 5 0 17 0; +#X connect 6 0 10 0; +#X connect 7 0 8 0; +#X connect 7 1 8 1; +#X connect 8 0 9 0; +#X connect 9 0 5 0; +#X connect 9 0 16 0; +#X connect 10 0 12 0; +#X connect 10 1 7 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 12 1 2 0; +#X connect 13 0 0 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 16 0 17 0; +#X restore 152 241 pd fillary; +#X obj 21 175 tabwrite~ blir; +#X msg 21 147 bang; +#X obj 356 102 samplerate~; +#X floatatom 356 126 5 0 0 0 - - -; +#X obj 356 80 loadbang; +#X floatatom 463 129 8 0 0 0 - - -; +#X obj 64 150 +~ 0.1; +#X floatatom 101 127 5 0 0 0 - - -; +#X msg 152 218 bang; +#X text 44 30 mean~ ; +#X floatatom 160 160 5 0 0 0 - - -; +#X obj 160 183 t f f; +#X text 206 163 set arraysize; +#X text 529 130 mean; +#X text 43 10 this is supposed to calculate the signal mean of an array. +; +#X msg 463 82 mean; +#X msg 503 82 ad; +#X msg 534 82 sd; +#X obj 462 35 mean 1 2 3; +#X floatatom 462 59 5 0 0 0 - - -; +#X msg 462 13 1 2 3.6677; +#X floatatom 271 305 8 0 0 0 - - -; +#X msg 316 228 mean; +#X msg 350 228 ad; +#X obj 21 291 table blor; +#X floatatom 341 325 10 0 0 0 - - -; +#X floatatom 461 326 10 0 0 0 - - -; +#X obj 392 150 loadbang; +#X obj 316 272 t f f f; +#X text 542 36 pd's mean; +#X text 544 115 dont need this; +#X msg 392 218 set \$1; +#X obj 392 194 symbol; +#X msg 392 173 blir; +#X msg 429 173 blor; +#X msg 20 214 \; blir resize \$1 \;; +#X msg 113 270 \; blor resize \$1 \;; +#X obj 460 304 cxstddev blir; +#X obj 342 304 cxavgdev blir; +#X obj 316 251 cxmean blir; +#X connect 0 0 10 0; +#X connect 1 0 9 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 8 0 6 0; +#X connect 10 0 4 0; +#X connect 11 0 10 1; +#X connect 12 0 3 0; +#X connect 14 0 15 0; +#X connect 15 0 39 0; +#X connect 15 0 40 0; +#X connect 15 1 3 1; +#X connect 19 0 1 0; +#X connect 20 0 1 0; +#X connect 21 0 1 0; +#X connect 22 0 23 0; +#X connect 24 0 22 0; +#X connect 26 0 43 0; +#X connect 27 0 43 0; +#X connect 31 0 38 0; +#X connect 32 0 25 0; +#X connect 32 1 42 0; +#X connect 32 2 41 0; +#X connect 35 0 41 0; +#X connect 35 0 42 0; +#X connect 35 0 43 0; +#X connect 36 0 35 0; +#X connect 37 0 36 0; +#X connect 38 0 36 0; +#X connect 41 0 30 0; +#X connect 42 0 29 0; +#X connect 43 0 32 0; diff --git a/hex2dec-help.pd b/hex2dec-help.pd new file mode 100644 index 0000000..0bd39ce --- /dev/null +++ b/hex2dec-help.pd @@ -0,0 +1,8 @@ +#N canvas 0 22 450 300 10; +#X obj 138 153 hex2dec; +#X floatatom 137 189 5 0 0 0 - - -; +#X msg 139 105 symbol fff; +#X msg 237 123 123; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; diff --git a/ixprint-help.pd b/ixprint-help.pd new file mode 100644 index 0000000..b6b0949 --- /dev/null +++ b/ixprint-help.pd @@ -0,0 +1,8 @@ +#N canvas 160 134 450 300 10; +#X obj 123 115 ixprint; +#X msg 122 59 1 2 3; +#X obj 173 83 pointer; +#X msg 172 54 bang; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 2 0; diff --git a/mean~-help.pd b/mean~-help.pd new file mode 100644 index 0000000..d9c75f3 --- /dev/null +++ b/mean~-help.pd @@ -0,0 +1,119 @@ +#N canvas 110 368 622 369 10; +#X obj 64 102 noise~; +#X obj 463 105 mean~ blir; +#X obj 21 262 table blir; +#N canvas 162 270 331 246 fillary 0; +#X obj 34 53 until; +#X obj 34 79 count; +#X msg 85 27 bang; +#X obj 34 105 - 1; +#X obj 34 130 t b f; +#X obj 34 166 random_fl -1 1; +#X obj 162 16 loadbang; +#X obj 192 64 utime; +#X obj 200 100 +; +#X msg 200 124 seed \$1; +#X obj 162 39 t b b b; +#X obj 232 13 inlet; +#X obj 120 65 t b b; +#X msg 34 27 1000; +#X msg 132 108 set \$1; +#X obj 280 13 inlet; +#X obj 178 165 random_icg -1 1; +#X obj 34 192 tabwrite blor; +#X connect 0 0 1 0; +#X connect 1 0 3 0; +#X connect 2 0 1 1; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X connect 4 1 17 1; +#X connect 5 0 17 0; +#X connect 6 0 10 0; +#X connect 7 0 8 0; +#X connect 7 1 8 1; +#X connect 8 0 9 0; +#X connect 9 0 5 0; +#X connect 9 0 16 0; +#X connect 10 0 12 0; +#X connect 10 1 7 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 12 1 2 0; +#X connect 13 0 0 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 16 0 17 0; +#X restore 152 241 pd fillary; +#X obj 21 175 tabwrite~ blir; +#X msg 21 147 bang; +#X obj 356 102 samplerate~; +#X floatatom 356 126 5 0 0 0 - - -; +#X obj 356 80 loadbang; +#X floatatom 463 129 8 0 0 0 - - -; +#X obj 64 150 +~ 0.1; +#X floatatom 101 127 5 0 0 0 - - -; +#X msg 152 218 bang; +#X text 44 30 mean~ ; +#X floatatom 160 160 5 0 0 0 - - -; +#X obj 160 183 t f f; +#X text 206 163 set arraysize; +#X text 529 130 mean; +#X text 43 10 this is supposed to calculate the signal mean of an array. +; +#X msg 463 82 mean; +#X msg 503 82 ad; +#X msg 534 82 sd; +#X obj 462 35 mean 1 2 3; +#X floatatom 462 59 5 0 0 0 - - -; +#X msg 462 13 1 2 3.6677; +#X floatatom 271 305 8 0 0 0 - - -; +#X msg 316 228 mean; +#X msg 350 228 ad; +#X obj 21 291 table blor; +#X floatatom 341 325 10 0 0 0 - - -; +#X floatatom 461 326 10 0 0 0 - - -; +#X obj 392 150 loadbang; +#X obj 316 272 t f f f; +#X text 542 36 pd's mean; +#X text 544 115 dont need this; +#X msg 392 218 set \$1; +#X obj 392 194 symbol; +#X msg 392 173 blir; +#X msg 429 173 blor; +#X msg 20 214 \; blir resize \$1 \;; +#X msg 113 270 \; blor resize \$1 \;; +#X obj 460 304 cxstddev blir; +#X obj 342 304 cxavgdev blir; +#X obj 316 251 cxmean blir; +#X connect 0 0 10 0; +#X connect 1 0 9 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 8 0 6 0; +#X connect 10 0 4 0; +#X connect 11 0 10 1; +#X connect 12 0 3 0; +#X connect 14 0 15 0; +#X connect 15 0 39 0; +#X connect 15 0 40 0; +#X connect 15 1 3 1; +#X connect 19 0 1 0; +#X connect 20 0 1 0; +#X connect 21 0 1 0; +#X connect 22 0 23 0; +#X connect 24 0 22 0; +#X connect 26 0 43 0; +#X connect 27 0 43 0; +#X connect 31 0 38 0; +#X connect 32 0 25 0; +#X connect 32 1 42 0; +#X connect 32 2 41 0; +#X connect 35 0 41 0; +#X connect 35 0 42 0; +#X connect 35 0 43 0; +#X connect 36 0 35 0; +#X connect 37 0 36 0; +#X connect 38 0 36 0; +#X connect 41 0 30 0; +#X connect 42 0 29 0; +#X connect 43 0 32 0; diff --git a/mean~.c b/mean~.c index 2e5472d..223152a 100644 --- a/mean~.c +++ b/mean~.c @@ -24,7 +24,7 @@ typedef struct _cxmean int x_nsampsintab; } t_cxmean; -void *cxmean_new(t_symbol *s) +static void *cxmean_new(t_symbol *s) { t_cxmean *x = (t_cxmean *)pd_new(cxmean_class); x->x_arrayname = s; @@ -52,7 +52,7 @@ static void cxmean_set(t_cxmean *x, t_symbol *s) else garray_usedindsp(a); } -void cxmean_bang(t_cxmean *x) +static void cxmean_bang(t_cxmean *x) { outlet_float(x->x_obj.ob_outlet,x->x_mean); } @@ -123,7 +123,7 @@ typedef struct _cxavgdev int x_nsampsintab; } t_cxavgdev; -void *cxavgdev_new(t_symbol *s) +static void *cxavgdev_new(t_symbol *s) { t_cxavgdev *x = (t_cxavgdev *)pd_new(cxavgdev_class); x->x_arrayname = s; @@ -151,7 +151,7 @@ static void cxavgdev_set(t_cxavgdev *x, t_symbol *s) else garray_usedindsp(a); } -void cxavgdev_bang(t_cxavgdev *x) +static void cxavgdev_bang(t_cxavgdev *x) { outlet_float(x->x_obj.ob_outlet,x->x_avgdev); } @@ -227,7 +227,7 @@ typedef struct _cxstddev int x_nsampsintab; } t_cxstddev; -void *cxstddev_new(t_symbol *s) +static void *cxstddev_new(t_symbol *s) { t_cxstddev *x = (t_cxstddev *)pd_new(cxstddev_class); x->x_arrayname = s; @@ -255,7 +255,7 @@ static void cxstddev_set(t_cxstddev *x, t_symbol *s) else garray_usedindsp(a); } -void cxstddev_bang(t_cxstddev *x) +static void cxstddev_bang(t_cxstddev *x) { outlet_float(x->x_obj.ob_outlet,x->x_stddev); } @@ -328,7 +328,7 @@ typedef struct _mean_tilde int x_nsampsintab; } t_mean_tilde; -void *mean_tilde_new(t_symbol *s) +static void *mean_tilde_new(t_symbol *s) { t_mean_tilde *x = (t_mean_tilde *)pd_new(mean_tilde_class); x->x_arrayname = s; @@ -384,7 +384,7 @@ static void mean_tilde_dsp(t_mean_tilde *x, t_signal **sp) dsp_add(mean_tilde_perform, 2, x, sp[0]->s_n); } -void mean_tilde_bang(t_mean_tilde *x) +static void mean_tilde_bang(t_mean_tilde *x) { outlet_float(x->x_obj.ob_outlet,x->x_mean); } diff --git a/prepend.c b/prepend.c deleted file mode 100644 index 933f455..0000000 --- a/prepend.c +++ /dev/null @@ -1,121 +0,0 @@ -#include -#ifdef _MSC_VER -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -/* this is taken from ggee, where the file was hanging around but the object was not - funtional. i keep it here for reference since i dont wnat to fix it over and over ;) - but its not included in the makefile to avoid namespace clash with ggee.prepend - anyhow, i ll just rename it cxc_prepend -*/ - -/* ------------------------ prepend ----------------------------- */ - -static t_class *prepend_class; - - -typedef struct _prepend -{ - t_object x_obj; - t_symbol* x_s; -} t_prepend; - - -void prepend_anything(t_prepend *x,t_symbol* s,t_int argc,t_atom* argv) -{ - int i = argc; - t_symbol* cur; - t_atom a_out[256]; - int c_out = 0; - t_atom* a = a_out; - -#if 1 - // post("sym: %s",s->s_name); - SETSYMBOL(a,s); - a++; - c_out++; -#endif - - while (i--) { - switch( argv->a_type) { - case A_FLOAT: - // post("flo: %f",atom_getfloat(argv)); - SETFLOAT(a,atom_getfloat(argv)); - a++; - c_out++; - break; - case A_SYMBOL: - // post("sym: %s",atom_getsymbol(argv)->s_name); - SETSYMBOL(a,atom_getsymbol(argv)); - a++; - c_out++; - break; - default: - post("prepend.c: unknown type"); - } - argv++; - } - - outlet_anything(x->x_obj.ob_outlet,x->x_s,c_out,(t_atom*)&a_out); - //post("done"); -} - -void prepend_list(t_prepend *x,t_symbol* s,t_int argc,t_atom* argv) -{ - int i = argc; - t_symbol* cur; - t_atom a_out[256]; - int c_out = 0; - t_atom* a = a_out; - - while (i--) { - switch( argv->a_type) { - case A_FLOAT: - // post("flo: %f",atom_getfloat(argv)); - SETFLOAT(a,atom_getfloat(argv)); - a++; - c_out++; - break; - case A_SYMBOL: - // post("sym: %s",atom_getsymbol(argv)->s_name); - SETSYMBOL(a,atom_getsymbol(argv)); - a++; - c_out++; - break; - default: - post("prepend.c: unknown type"); - } - argv++; - } - - outlet_anything(x->x_obj.ob_outlet,x->x_s,c_out,(t_atom*)&a_out); - //post("done"); -} - -static void *prepend_new(t_symbol* s) -{ - t_prepend *x = (t_prepend *)pd_new(prepend_class); - outlet_new(&x->x_obj, &s_float); - if (s != &s_) - x->x_s = s; - else - x->x_s = gensym("cxc_prepend"); - return (x); -} - -static void prepend_set(t_prepend *x, t_symbol *s) -{ - x->x_s = s; -} - -void prepend_setup(void) -{ - prepend_class = class_new(gensym("prepend"), (t_newmethod)prepend_new, 0, - sizeof(t_prepend), 0,A_DEFSYM,NULL); - class_addlist(prepend_class, prepend_list); - class_addanything(prepend_class,prepend_anything); - class_addmethod(prepend_class, (t_method)prepend_set, gensym("set"), A_SYMBOL, 0); -} - - diff --git a/reference/cxc.prepend.pd b/reference/cxc.prepend.pd deleted file mode 100644 index eaa57dc..0000000 --- a/reference/cxc.prepend.pd +++ /dev/null @@ -1,13 +0,0 @@ -#N canvas 322 265 450 300 10; -#X obj 186 244 print; -#X msg 200 102 itsch ni san chi; -#X obj 186 187 cxc.prepend /bla; -#X obj 186 210 cxc.prepend send; -#X floatatom 155 79 5 0 0; -#X msg 214 138 qui qua 2 3.4555 "bla ha"; -#X text 25 11 prepend arbitrary length lists/anythings with stuff; -#X connect 1 0 2 0; -#X connect 2 0 3 0; -#X connect 3 0 0 0; -#X connect 4 0 2 0; -#X connect 5 0 2 0; diff --git a/reference/cxc.split.pd b/reference/cxc.split.pd deleted file mode 100644 index 9306dbd..0000000 --- a/reference/cxc.split.pd +++ /dev/null @@ -1,52 +0,0 @@ -#N canvas 100 100 576 380 10; -#X msg 239 145 set x; -#X msg 172 144 set .; -#X obj 25 324 unpack f f f f; -#X floatatom 25 354 5 0 0 0 - - -; -#X floatatom 67 354 5 0 0 0 - - -; -#X floatatom 108 354 5 0 0 0 - - -; -#X floatatom 147 354 5 0 0 0 - - -; -#X msg 284 91 bli.5.bla.8.90; -#X msg 25 59 62.116.7.89; -#X msg 113 143 set /; -#X msg 158 60 /home/someone/pd/test/patches/bla.pd; -#X msg 322 145 set azwejdgb; -#X obj 336 236 print; -#X text 320 125 only the 1st character is used; -#X obj 336 205 cxc.split .; -#X obj 25 196 cxc.split .; -#X text 110 123 set the delimiter; -#X obj 368 308 unpack s s s s; -#X symbolatom 367 347 10 0 0 0 - - -; -#X symbolatom 449 346 10 0 0 0 - - -; -#X msg 56 149 set \$1; -#X symbolatom 55 114 10 0 0 0 - - -; -#X obj 63 230 print; -#X obj 25 299 route list; -#X msg 41 89 12.334/345.555/666.666/2389.23; -#X text 26 5 split or tokenize the incoming string at the specified -delimiter \, digit-only substrings (including the .) are converted -to numbers.; -#X connect 0 0 14 0; -#X connect 1 0 14 0; -#X connect 2 0 3 0; -#X connect 2 1 4 0; -#X connect 2 2 5 0; -#X connect 2 3 6 0; -#X connect 7 0 14 0; -#X connect 8 0 15 0; -#X connect 9 0 14 0; -#X connect 10 0 14 0; -#X connect 11 0 14 0; -#X connect 14 0 12 0; -#X connect 14 0 17 0; -#X connect 15 0 23 0; -#X connect 17 0 18 0; -#X connect 17 1 19 0; -#X connect 20 0 15 0; -#X connect 21 0 20 0; -#X connect 23 0 2 0; -#X connect 23 0 22 0; -#X connect 23 1 2 0; -#X connect 23 1 22 0; -#X connect 24 0 15 0; diff --git a/reference/statistics.pd b/reference/statistics.pd deleted file mode 100644 index 24d7ca3..0000000 --- a/reference/statistics.pd +++ /dev/null @@ -1,120 +0,0 @@ -#N canvas 416 554 622 369 10; -#X obj 64 102 noise~; -#X obj 463 105 mean~ blir; -#X obj 21 262 table blir; -#N canvas 162 270 331 246 fillary 0; -#X obj 34 53 until; -#X obj 34 79 count; -#X msg 85 27 bang; -#X obj 34 105 - 1; -#X obj 34 130 t b f; -#X obj 34 166 random_fl -1 1; -#X obj 162 16 loadbang; -#X obj 192 64 utime; -#X obj 200 100 +; -#X msg 200 124 seed \$1; -#X obj 162 39 t b b b; -#X obj 232 13 inlet; -#X obj 120 65 t b b; -#X msg 34 27 1000; -#X msg 132 108 set \$1; -#X obj 280 13 inlet; -#X obj 178 165 random_icg -1 1; -#X obj 34 192 tabwrite blor; -#X connect 0 0 1 0; -#X connect 1 0 3 0; -#X connect 2 0 1 1; -#X connect 3 0 4 0; -#X connect 4 0 5 0; -#X connect 4 1 17 1; -#X connect 5 0 17 0; -#X connect 6 0 10 0; -#X connect 7 0 8 0; -#X connect 7 1 8 1; -#X connect 8 0 9 0; -#X connect 9 0 5 0; -#X connect 9 0 16 0; -#X connect 10 0 12 0; -#X connect 10 1 7 0; -#X connect 11 0 12 0; -#X connect 12 0 13 0; -#X connect 12 1 2 0; -#X connect 13 0 0 0; -#X connect 14 0 13 0; -#X connect 15 0 14 0; -#X connect 16 0 17 0; -#X restore 152 241 pd fillary; -#X obj 21 175 tabwrite~ blir; -#X msg 21 147 bang; -#X obj 356 102 samplerate~; -#X floatatom 356 126 5 0 0; -#X obj 356 80 loadbang; -#X floatatom 463 129 8 0 0; -#X obj 64 150 +~ 0.1; -#X floatatom 101 127 5 0 0; -#X msg 152 218 bang; -#X text 44 30 mean~ ; -#X floatatom 160 160 5 0 0; -#X obj 160 183 t f f; -#X text 206 163 set arraysize; -#X text 529 130 mean; -#X text 43 10 this is supposed to calculate the signal mean of an array. -; -#X msg 463 82 mean; -#X msg 503 82 ad; -#X msg 534 82 sd; -#X obj 462 35 mean 1 2 3; -#X floatatom 462 59 5 0 0; -#X msg 462 13 1 2 3.6677; -#X obj 316 251 cx.mean blir; -#X floatatom 271 305 8 0 0; -#X msg 316 228 mean; -#X msg 350 228 ad; -#X obj 446 251 histo; -#X obj 21 291 table blor; -#X obj 342 304 cx.avgdev blir; -#X floatatom 341 325 10 0 0; -#X floatatom 461 326 10 0 0; -#X obj 392 150 loadbang; -#X obj 460 304 cx.stddev blir; -#X obj 316 272 t f f f; -#X text 542 36 pd's mean; -#X text 544 115 dont need this; -#X msg 392 218 set \$1; -#X obj 392 194 symbol; -#X msg 392 173 blir; -#X msg 429 173 blor; -#X msg 20 214 \; blir resize \$1 \;; -#X msg 113 270 \; blor resize \$1 \;; -#X connect 0 0 10 0; -#X connect 1 0 9 0; -#X connect 5 0 4 0; -#X connect 6 0 7 0; -#X connect 8 0 6 0; -#X connect 10 0 4 0; -#X connect 11 0 10 1; -#X connect 12 0 3 0; -#X connect 14 0 15 0; -#X connect 15 0 43 0; -#X connect 15 0 44 0; -#X connect 15 1 3 1; -#X connect 19 0 1 0; -#X connect 20 0 1 0; -#X connect 21 0 1 0; -#X connect 22 0 23 0; -#X connect 24 0 22 0; -#X connect 25 0 36 0; -#X connect 27 0 25 0; -#X connect 28 0 25 0; -#X connect 31 0 32 0; -#X connect 34 0 42 0; -#X connect 35 0 33 0; -#X connect 36 0 26 0; -#X connect 36 1 31 0; -#X connect 36 2 35 0; -#X connect 39 0 25 0; -#X connect 39 0 31 0; -#X connect 39 0 35 0; -#X connect 40 0 39 0; -#X connect 41 0 40 0; -#X connect 42 0 40 0; diff --git a/split.c b/split.c deleted file mode 100644 index 92fe73d..0000000 --- a/split.c +++ /dev/null @@ -1,174 +0,0 @@ -#include -#include -#include -#include -#ifdef _MSC_VER -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -/* this is taken from ggee, where the file was hanging around but the object was not - funtional. i keep it here for reference since i dont wnat to fix it over and over ;) - but its not included in the makefile to avoid namespace clash with ggee.prepend - anyhow, i ll just rename it cxc.prepend -*/ - -/* ------------------------ split ----------------------------- */ - -// why have to do this? -void split_anything(); - -static t_class *split_class; - - -typedef struct _split -{ - t_object x_obj; - t_symbol* x_splitter; -} t_split; - - -void split_symbol(t_split *x, t_symbol *s) -{ - t_atom* a; - split_anything(x, s, 0, a); -} - - -// move these to generic location later on -int split_string_isnum(char* s) -{ - // int isnum = 1; - char tc; - while((tc = *s++) != '\0') { - // tc= s; - switch(tc) { - case 46: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: - // post("yo numba: %c", tc); - break; - default: - return 0; - break; - } - } - return 1; -} - -void split_anything(t_split *x,t_symbol* s,t_int argc,t_atom* argv) -{ - int i = argc; int j; - t_symbol* cur; - t_atom a_out[256]; - int c_out = 0; - t_atom* a = a_out; - // char *str; - char u[MAXPDSTRING]; - char v[MAXPDSTRING]; - // char *v; - u[0] = '\0'; - v[0] = '\0'; - int isnum = 1; - // float tf; - - for(j=0; js_name); j++) { - u[0] = s->s_name[j]; - if(u[0] == x->x_splitter->s_name[0]) { - if(v[0] != '\0') { // delimiter is first character - // check if string is digits only - if(split_string_isnum(v)) { - SETFLOAT(a, (float)atof(v)); - } - else { - SETSYMBOL(a, gensym(v)); - } - a++; c_out++; - // reset stuff - v[0] = '\0'; - isnum = 1; - } // v[0] != '\0' - } else { - strncat(v, u, 1); - } // char matches splitter - } - - // have to do this again here, damn. - if(split_string_isnum(v)) { - SETFLOAT(a, (float)atof(v)); - } - else { - SETSYMBOL(a, gensym(v)); - } - a++, c_out++; - - outlet_list(x->x_obj.ob_outlet, &s_list, c_out, (t_atom*)&a_out); - // outlet_anything(x->x_obj.ob_outlet,gensym("list"),c_out,(t_atom*)&a_out); -} - -void split_list(t_split *x,t_symbol* s,t_int argc,t_atom* argv) -{ - int i = argc; - t_symbol* cur; - t_atom a_out[256]; - int c_out = 0; - t_atom* a = a_out; - - while (i--) { - switch( argv->a_type) { - case A_FLOAT: - // post("flo: %f",atom_getfloat(argv)); - SETFLOAT(a,atom_getfloat(argv)); - a++; - c_out++; - break; - case A_SYMBOL: - // post("sym: %s",atom_getsymbol(argv)->s_name); - SETSYMBOL(a,atom_getsymbol(argv)); - a++; - c_out++; - break; - default: - post("split.c: unknown type"); - } - argv++; - } - - outlet_anything(x->x_obj.ob_outlet,x->x_splitter,c_out,(t_atom*)&a_out); - //post("done"); -} - -static void *split_new(t_symbol* s) -{ - t_split *x = (t_split *)pd_new(split_class); - outlet_new(&x->x_obj, &s_float); - if (s != &s_) - x->x_splitter = s; - else - x->x_splitter = gensym("cxc_split"); - return (x); -} - -static void split_set(t_split *x, t_symbol *s) -{ - t_symbol *t; - // init temp splitter - char u[1]; u[0] = '\0'; - - if(strlen(s->s_name) > 1) { - // t = gensym((char*)s->s_name[0]); - // post("%d", s->s_name[0]); - strncat(u, s->s_name, 1); - t = gensym(u); - } else - t = s; - x->x_splitter = t; -} - -void split_setup(void) -{ - split_class = class_new(gensym("cxc_split"), (t_newmethod)split_new, 0, - sizeof(t_split), 0,A_DEFSYM,NULL); - // class_addlist(split_class, split_list); - class_addanything(split_class,split_anything); - class_addmethod(split_class, (t_method)split_set, gensym("set"), A_SYMBOL, 0); - class_addsymbol(split_class, split_symbol); -} -- cgit v1.2.1