From 82c0f9c8e917102c29dc0f3fbdb5183781305fef Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Wed, 30 Sep 2009 18:52:19 +0000 Subject: Fools, put~ and get~ are now part of tof svn path=/trunk/externals/tof/; revision=12500 --- help/get~-help.pd | 48 ++++++++++++++++++++++++++++ help/put~-help.pd | 48 ++++++++++++++++++++++++++++ src/crossfade~.c | 5 +-- src/get~.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/put~.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++ test/get~.c | 93 ------------------------------------------------------- test/put~.c | 89 ---------------------------------------------------- 7 files changed, 281 insertions(+), 184 deletions(-) create mode 100644 help/get~-help.pd create mode 100644 help/put~-help.pd create mode 100644 src/get~.c create mode 100644 src/put~.c delete mode 100644 test/get~.c delete mode 100644 test/put~.c diff --git a/help/get~-help.pd b/help/get~-help.pd new file mode 100644 index 0000000..1b50e9a --- /dev/null +++ b/help/get~-help.pd @@ -0,0 +1,48 @@ +#N canvas 1165 85 541 614 10; +#X obj 9 39 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577 +0; +#X text 14 87 author: mrtoftrash@gmail.com; +#X text 14 39 description: many to many nonlocal signal connections. +; +#X text 13 65 tags: flow~; +#X text 14 108 version: 2009-09-30 (initial release); +#X obj 46 260 tof/put~ A; +#X obj 312 262 tof/put~ B; +#X obj 45 205 osc~ 800; +#X obj 311 225 noise~; +#X obj 45 232 *~ 0.5; +#X obj 155 263 tof/put~ A; +#X obj 154 235 *~ 0.5; +#X obj 154 208 osc~ 600; +#X obj 70 476 dac~; +#X obj 77 383 tof/get~; +#X msg 77 330 set A; +#X msg 150 333 set B; +#X msg 385 224 set A; +#X msg 407 252 set B; +#X obj 78 432 *~ 0.1; +#X obj 148 399 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144 +-1 -1 0 1; +#X msg 225 345 set C; +#X text 50 507 All put~ objects copy their input to a local buffer +which all receive~ objects of the same name read from. They may be +in different windows or even different patches. Any number of get~ +objects may be associated with any number of put~ objects . Because +of the buffer \, the signal is delayed by one block.; +#X text 33 152 Argument: the name.; +#X text 32 168 get~ takes "set" messages to switch between put~ objects. +; +#X connect 7 0 9 0; +#X connect 8 0 6 0; +#X connect 9 0 5 0; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 14 0 19 0; +#X connect 15 0 14 0; +#X connect 16 0 14 0; +#X connect 17 0 6 0; +#X connect 18 0 6 0; +#X connect 19 0 13 0; +#X connect 19 0 13 1; +#X connect 20 0 19 1; +#X connect 21 0 14 0; diff --git a/help/put~-help.pd b/help/put~-help.pd new file mode 100644 index 0000000..eaef8b6 --- /dev/null +++ b/help/put~-help.pd @@ -0,0 +1,48 @@ +#N canvas 206 49 525 620 10; +#X obj -1 29 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577 +0; +#X text 4 77 author: mrtoftrash@gmail.com; +#X text 4 29 description: many to many nonlocal signal connections. +; +#X text 3 55 tags: flow~; +#X text 4 98 version: 2009-09-30 (initial release); +#X obj 36 250 tof/put~ A; +#X obj 302 252 tof/put~ B; +#X obj 35 195 osc~ 800; +#X obj 301 215 noise~; +#X obj 35 222 *~ 0.5; +#X obj 145 253 tof/put~ A; +#X obj 144 225 *~ 0.5; +#X obj 144 198 osc~ 600; +#X obj 60 466 dac~; +#X obj 67 373 tof/get~; +#X msg 67 320 set A; +#X msg 140 323 set B; +#X msg 375 214 set A; +#X msg 397 242 set B; +#X obj 68 422 *~ 0.1; +#X obj 138 389 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144 +-1 -1 800 1; +#X msg 215 335 set C; +#X text 40 497 All put~ objects copy their input to a local buffer +which all receive~ objects of the same name read from. They may be +in different windows or even different patches. Any number of get~ +objects may be associated with any number of put~ objects . Because +of the buffer \, the signal is delayed by one block.; +#X text 23 142 Argument: the name.; +#X text 23 160 put~ takes "set" messages to switch between get~ objects. +; +#X connect 7 0 9 0; +#X connect 8 0 6 0; +#X connect 9 0 5 0; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 14 0 19 0; +#X connect 15 0 14 0; +#X connect 16 0 14 0; +#X connect 17 0 6 0; +#X connect 18 0 6 0; +#X connect 19 0 13 0; +#X connect 19 0 13 1; +#X connect 20 0 19 1; +#X connect 21 0 14 0; diff --git a/src/crossfade~.c b/src/crossfade~.c index 6a546cd..98348f9 100644 --- a/src/crossfade~.c +++ b/src/crossfade~.c @@ -142,9 +142,10 @@ static void *crossfade_tilde_new(t_floatarg f) (t_newmethod)crossfade_tilde_new, (t_method)crossfade_tilde_free, sizeof(t_crossfade_tilde), 0, A_DEFFLOAT, 0); - + + CLASS_MAINSIGNALIN(crossfade_tilde_class, t_crossfade_tilde, f); class_addmethod(crossfade_tilde_class, (t_method)crossfade_tilde_dsp, gensym("dsp"), 0); // class_addmethod(crossfade_tilde_class, nullfn, gensym("signal"), 0); - CLASS_MAINSIGNALIN(crossfade_tilde_class, t_crossfade_tilde, f); + } diff --git a/src/get~.c b/src/get~.c new file mode 100644 index 0000000..4d6356d --- /dev/null +++ b/src/get~.c @@ -0,0 +1,93 @@ +#include "putget~.h" + +static t_class *get_tilde_class; + +typedef struct _get_tilde { + t_object x_obj; + t_sample f_put; + struct putget* pg; + t_sample f; +} t_get_tilde; + +t_int *get_tilde_perform(t_int *w) +{ + t_get_tilde *x = (t_get_tilde *)(w[1]); + t_sample *out = (t_sample *)(w[2]); + int n = (int)(w[3]); + + if ( x->pg) { + + putget_arm( x->pg); + + + t_sample *samples = x->pg->r; + + while (n--) { + *out++ = *samples++; + } + } else { + while (n--) { + *out++ = 0; + } + } + + return (w+4); +} + +static void get_tilde_set(t_get_tilde *x, t_symbol* s) { + + if (gensym("") != s ) { + if ( x->pg ) { + if ( x->pg->name != s) { + putget_unregister(x->pg,0); + x->pg = putget_register(s,0); + } + } else { + x->pg = putget_register(s,0); + } + } + +} + +void get_tilde_dsp(t_get_tilde *x, t_signal **sp) +{ + + if ( sp[0]->s_n == 64 ) { + dsp_add(get_tilde_perform, 3, x,sp[0]->s_vec, sp[0]->s_n); + } else { + pd_error(x,"get~ only works with a block size of 64"); + } +} + +static void get_tilde_free( t_get_tilde *x) { + + if (x->pg) putget_unregister(x->pg,0); +} + + +void *get_tilde_new(t_symbol* s) +{ + t_get_tilde *x = (t_get_tilde *)pd_new(get_tilde_class); + + + if (gensym("") != s ) x->pg = putget_register(s,0); + + outlet_new(&x->x_obj, &s_signal); + + return (void *)x; +} + +void get_tilde_setup(void) { + get_tilde_class = class_new(gensym("get~"), + (t_newmethod)get_tilde_new, + (t_method)get_tilde_free, sizeof(t_get_tilde), + CLASS_DEFAULT, + A_DEFSYMBOL, 0); + + class_addmethod(get_tilde_class, + (t_method)get_tilde_set, gensym("set"), A_SYMBOL, 0); + + class_addmethod(get_tilde_class, + (t_method)get_tilde_dsp, gensym("dsp"), 0); + //CLASS_MAINSIGNALIN(get_tilde_class, t_get_tilde, f); +} diff --git a/src/put~.c b/src/put~.c new file mode 100644 index 0000000..9074888 --- /dev/null +++ b/src/put~.c @@ -0,0 +1,89 @@ +#include "putget~.h" + +static t_class *put_tilde_class; + +typedef struct _put_tilde { + t_object x_obj; + //t_sample f_put; + struct putget* pg; + t_sample f; +} t_put_tilde; + +static t_int* put_tilde_perform(t_int *w) +{ + + t_put_tilde *x = (t_put_tilde *)(w[1]); + + if (x->pg && (x->pg->users > x->pg->writers)) { + t_sample *in = (t_sample *)(w[2]); + int n = (int)(w[3]); + t_sample *samples = x->pg->w; + + while (n--) { + *samples = *samples + *in; + samples++; in++; + } + + } + return (w+4); +} + + +static void put_tilde_set(t_put_tilde *x, t_symbol* s) { + + if (gensym("") != s ) { + if ( x->pg ) { + if ( x->pg->name != s) { + putget_unregister(x->pg,1); + x->pg = putget_register(s,1); + } + } else { + x->pg = putget_register(s,1); + } + } + +} + + +static void put_tilde_dsp(t_put_tilde *x, t_signal **sp) +{ + + if ( (int) sp[0]->s_n == 64 ) { + dsp_add(put_tilde_perform, 3, x,sp[0]->s_vec, sp[0]->s_n); + + } else { + error("put~ only works with a block size of 64"); + } + +} + +static void put_tilde_free( t_put_tilde *x) { + + if (x->pg) putget_unregister(x->pg,1); +} + + +static void *put_tilde_new(t_symbol* s) +{ + t_put_tilde *x = (t_put_tilde *)pd_new(put_tilde_class); + + if (gensym("") != s ) x->pg = putget_register(s,1); + + + return (void *)x; +} + +void put_tilde_setup(void) { + put_tilde_class = class_new(gensym("put~"), + (t_newmethod)put_tilde_new, + (t_method)put_tilde_free, sizeof(t_put_tilde), + 0, A_DEFSYM, 0); + + class_addmethod(put_tilde_class, + (t_method)put_tilde_dsp, gensym("dsp"), 0); + + class_addmethod(put_tilde_class, + (t_method)put_tilde_set, gensym("set"), A_SYMBOL, 0); + + CLASS_MAINSIGNALIN(put_tilde_class, t_put_tilde, f); +} diff --git a/test/get~.c b/test/get~.c deleted file mode 100644 index 4d6356d..0000000 --- a/test/get~.c +++ /dev/null @@ -1,93 +0,0 @@ -#include "putget~.h" - -static t_class *get_tilde_class; - -typedef struct _get_tilde { - t_object x_obj; - t_sample f_put; - struct putget* pg; - t_sample f; -} t_get_tilde; - -t_int *get_tilde_perform(t_int *w) -{ - t_get_tilde *x = (t_get_tilde *)(w[1]); - t_sample *out = (t_sample *)(w[2]); - int n = (int)(w[3]); - - if ( x->pg) { - - putget_arm( x->pg); - - - t_sample *samples = x->pg->r; - - while (n--) { - *out++ = *samples++; - } - } else { - while (n--) { - *out++ = 0; - } - } - - return (w+4); -} - -static void get_tilde_set(t_get_tilde *x, t_symbol* s) { - - if (gensym("") != s ) { - if ( x->pg ) { - if ( x->pg->name != s) { - putget_unregister(x->pg,0); - x->pg = putget_register(s,0); - } - } else { - x->pg = putget_register(s,0); - } - } - -} - -void get_tilde_dsp(t_get_tilde *x, t_signal **sp) -{ - - if ( sp[0]->s_n == 64 ) { - dsp_add(get_tilde_perform, 3, x,sp[0]->s_vec, sp[0]->s_n); - } else { - pd_error(x,"get~ only works with a block size of 64"); - } -} - -static void get_tilde_free( t_get_tilde *x) { - - if (x->pg) putget_unregister(x->pg,0); -} - - -void *get_tilde_new(t_symbol* s) -{ - t_get_tilde *x = (t_get_tilde *)pd_new(get_tilde_class); - - - if (gensym("") != s ) x->pg = putget_register(s,0); - - outlet_new(&x->x_obj, &s_signal); - - return (void *)x; -} - -void get_tilde_setup(void) { - get_tilde_class = class_new(gensym("get~"), - (t_newmethod)get_tilde_new, - (t_method)get_tilde_free, sizeof(t_get_tilde), - CLASS_DEFAULT, - A_DEFSYMBOL, 0); - - class_addmethod(get_tilde_class, - (t_method)get_tilde_set, gensym("set"), A_SYMBOL, 0); - - class_addmethod(get_tilde_class, - (t_method)get_tilde_dsp, gensym("dsp"), 0); - //CLASS_MAINSIGNALIN(get_tilde_class, t_get_tilde, f); -} diff --git a/test/put~.c b/test/put~.c deleted file mode 100644 index 9074888..0000000 --- a/test/put~.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "putget~.h" - -static t_class *put_tilde_class; - -typedef struct _put_tilde { - t_object x_obj; - //t_sample f_put; - struct putget* pg; - t_sample f; -} t_put_tilde; - -static t_int* put_tilde_perform(t_int *w) -{ - - t_put_tilde *x = (t_put_tilde *)(w[1]); - - if (x->pg && (x->pg->users > x->pg->writers)) { - t_sample *in = (t_sample *)(w[2]); - int n = (int)(w[3]); - t_sample *samples = x->pg->w; - - while (n--) { - *samples = *samples + *in; - samples++; in++; - } - - } - return (w+4); -} - - -static void put_tilde_set(t_put_tilde *x, t_symbol* s) { - - if (gensym("") != s ) { - if ( x->pg ) { - if ( x->pg->name != s) { - putget_unregister(x->pg,1); - x->pg = putget_register(s,1); - } - } else { - x->pg = putget_register(s,1); - } - } - -} - - -static void put_tilde_dsp(t_put_tilde *x, t_signal **sp) -{ - - if ( (int) sp[0]->s_n == 64 ) { - dsp_add(put_tilde_perform, 3, x,sp[0]->s_vec, sp[0]->s_n); - - } else { - error("put~ only works with a block size of 64"); - } - -} - -static void put_tilde_free( t_put_tilde *x) { - - if (x->pg) putget_unregister(x->pg,1); -} - - -static void *put_tilde_new(t_symbol* s) -{ - t_put_tilde *x = (t_put_tilde *)pd_new(put_tilde_class); - - if (gensym("") != s ) x->pg = putget_register(s,1); - - - return (void *)x; -} - -void put_tilde_setup(void) { - put_tilde_class = class_new(gensym("put~"), - (t_newmethod)put_tilde_new, - (t_method)put_tilde_free, sizeof(t_put_tilde), - 0, A_DEFSYM, 0); - - class_addmethod(put_tilde_class, - (t_method)put_tilde_dsp, gensym("dsp"), 0); - - class_addmethod(put_tilde_class, - (t_method)put_tilde_set, gensym("set"), A_SYMBOL, 0); - - CLASS_MAINSIGNALIN(put_tilde_class, t_put_tilde, f); -} -- cgit v1.2.1