[PD-cvs] externals/zexy/src absgn~.c, 1.5, 1.6 abs~.c, 1.4, 1.5 avg~.c, 1.5, 1.6 blockmirror~.c, 1.5, 1.6 blockshuffle~.c, 1.3, 1.4 blockswap~.c, 1.5, 1.6 demultiplex~.c, 1.7, 1.8 dfreq~.c, 1.5, 1.6 dirac~.c, 1.6, 1.7 envrms~.c, 1.5, 1.6 limiter~.c, 1.8, 1.9 multiline~.c, 1.6, 1.7 multiplex~.c, 1.6, 1.7 noish~.c, 1.5, 1.6 noisi~.c, 1.5, 1.6 pack~.c, 1.4, 1.5 pdf~.c, 1.5, 1.6 quantize~.c, 1.6, 1.7 sgn~.c, 1.7, 1.8 sigzero~.c, 1.7, 1.8 step~.c, 1.4, 1.5 swap~.c, 1.4, 1.5 tavg~.c, 1.6, 1.7 unpack~.c, 1.6, 1.7 z~.c, 1.5, 1.6
IOhannes m zmölnig
zmoelnig at users.sourceforge.net
Tue Oct 30 10:21:54 CET 2007
- Previous message: [PD-cvs] externals/zexy/src zexy.h,1.26,1.27
- Next message: [PD-cvs] externals/zexy/src atoi.c, 1.5, 1.6 demultiplex.c, 1.6, 1.7 fifop.c, 1.15, 1.16 length.c, 1.8, 1.9 lifop.c, 1.13, 1.14 lpt.c, 1.14, 1.15 matchbox.c, 1.6, 1.7 mavg.c, 1.5, 1.6 minmax.c, 1.6, 1.7 multiplex.c, 1.8, 1.9 regex.c, 1.9, 1.10 repack.c, 1.5, 1.6 sort.c, 1.8, 1.9 sum.c, 1.5, 1.6 urn.c, 1.6, 1.7 wrap.c, 1.8, 1.9 z~.c, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/externals/zexy/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3936
Modified Files:
absgn~.c abs~.c avg~.c blockmirror~.c blockshuffle~.c
blockswap~.c demultiplex~.c dfreq~.c dirac~.c envrms~.c
limiter~.c multiline~.c multiplex~.c noish~.c noisi~.c pack~.c
pdf~.c quantize~.c sgn~.c sigzero~.c step~.c swap~.c tavg~.c
unpack~.c z~.c
Log Message:
use t_float and t_sample when possible
Index: dirac~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/dirac~.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** dirac~.c 14 Mar 2007 09:08:56 -0000 1.6
--- dirac~.c 30 Oct 2007 09:21:51 -0000 1.7
***************
*** 39,76 ****
typedef struct _dirac
{
! t_object x_obj;
! t_int position;
! t_int do_it;
} t_dirac;
static void dirac_bang(t_dirac *x)
{
! x->do_it = x->position;
}
static void dirac_float(t_dirac *x, t_float where)
{
! x->do_it = x->position = (t_int)where;
}
static t_int *dirac_perform(t_int *w)
{
! t_dirac *x = (t_dirac *)(w[1]);
! t_float *out = (t_float *)(w[2]);
! int n = (int)(w[3]);
! t_int do_it = x->do_it;
! zero_perform(w+1);
! if (do_it >= n)
! x->do_it -= n;
! else if(do_it >= 0)
! {
! out[do_it] = 1.f;
! x->do_it = -1;
! }
! return (w+4);
}
--- 39,76 ----
typedef struct _dirac
{
! t_object x_obj;
! t_int position;
! t_int do_it;
} t_dirac;
static void dirac_bang(t_dirac *x)
{
! x->do_it = x->position;
}
static void dirac_float(t_dirac *x, t_float where)
{
! x->do_it = x->position = (t_int)where;
}
static t_int *dirac_perform(t_int *w)
{
! t_dirac *x = (t_dirac *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
! int n = (int)(w[3]);
! t_int do_it = x->do_it;
! zero_perform(w+1);
! if (do_it >= n)
! x->do_it -= n;
! else if(do_it >= 0)
! {
! out[do_it] = 1.f;
! x->do_it = -1;
! }
! return (w+4);
}
***************
*** 78,126 ****
static t_int *dirac_perf8(t_int *w)
{
! t_dirac *x = (t_dirac *)(w[1]);
! t_float *out = (t_float *)(w[2]);
! int n = (int)(w[3]);
! t_int do_it = x->do_it;
#ifndef __WIN32__
! /* LATER: investigate the occurence of zero_perf8() */
! /* it seems, like pd has the symbol zero_perf8(),
! * but it is not exported by m_pd.h:
! * so linux can use it, but w32 not
! * have to tell miller about that
! */
! zero_perf8(w+1);
#else
! zero_perform(w+1);
#endif
! if (do_it >= n)
! x->do_it -= n;
! else if(do_it >= 0)
! {
! out[do_it] = 1.f;
! x->do_it = -1;
! }
! return (w+4);
}
static void dirac_dsp(t_dirac *x, t_signal **sp)
{
! if (sp[0]->s_n & 7)
! dsp_add(dirac_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
! else
! dsp_add(dirac_perf8, 3, x, sp[0]->s_vec, sp[0]->s_n);
}
static void dirac_helper(void)
{
! post("%c dirac~-object :: generates a dirac (unity-pulse)", HEARTSYMBOL);
! post("creation : \"dirac~ [<position>]\" : create a dirac at specified position (in samples)\n"
! "inlet\t: <position>\t: create a dirac at new position\n"
! "\t 'bang'\t: create a dirac at specified position\n"
! "\t 'help'\t: view this\n"
! "outlet\t: signal~");
}
--- 78,126 ----
static t_int *dirac_perf8(t_int *w)
{
! t_dirac *x = (t_dirac *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
! int n = (int)(w[3]);
! t_int do_it = x->do_it;
#ifndef __WIN32__
! /* LATER: investigate the occurence of zero_perf8() */
! /* it seems, like pd has the symbol zero_perf8(),
! * but it is not exported by m_pd.h:
! * so linux can use it, but w32 not
! * have to tell miller about that
! */
! zero_perf8(w+1);
#else
! zero_perform(w+1);
#endif
! if (do_it >= n)
! x->do_it -= n;
! else if(do_it >= 0)
! {
! out[do_it] = 1.f;
! x->do_it = -1;
! }
! return (w+4);
}
static void dirac_dsp(t_dirac *x, t_signal **sp)
{
! if (sp[0]->s_n & 7)
! dsp_add(dirac_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
! else
! dsp_add(dirac_perf8, 3, x, sp[0]->s_vec, sp[0]->s_n);
}
static void dirac_helper(void)
{
! post("%c dirac~-object :: generates a dirac (unity-pulse)", HEARTSYMBOL);
! post("creation : \"dirac~ [<position>]\" : create a dirac at specified position (in samples)\n"
! "inlet\t: <position>\t: create a dirac at new position\n"
! "\t 'bang'\t: create a dirac at specified position\n"
! "\t 'help'\t: view this\n"
! "outlet\t: signal~");
}
***************
*** 129,154 ****
static void *dirac_new(t_floatarg where)
{
! t_dirac *x = (t_dirac *)pd_new(dirac_class);
! outlet_new(&x->x_obj, gensym("signal"));
! x->do_it = where;
! if (where > 0)
! x->position = where;
! else
! x->position = -where;
! return (x);
}
void dirac_tilde_setup(void)
{
! dirac_class = class_new(gensym("dirac~"), (t_newmethod)dirac_new, 0,
! sizeof(t_dirac), 0, A_DEFFLOAT, 0);
! class_addfloat(dirac_class, dirac_float);
! class_addbang(dirac_class, dirac_bang);
! class_addmethod(dirac_class, (t_method)dirac_dsp, gensym("dsp"), 0);
! class_addmethod(dirac_class, (t_method)dirac_helper, gensym("help"), 0);
zexy_register("dirac~");
}
--- 129,154 ----
static void *dirac_new(t_floatarg where)
{
! t_dirac *x = (t_dirac *)pd_new(dirac_class);
! outlet_new(&x->x_obj, gensym("signal"));
! x->do_it = where;
! if (where > 0)
! x->position = where;
! else
! x->position = -where;
! return (x);
}
void dirac_tilde_setup(void)
{
! dirac_class = class_new(gensym("dirac~"), (t_newmethod)dirac_new, 0,
! sizeof(t_dirac), 0, A_DEFFLOAT, 0);
! class_addfloat(dirac_class, dirac_float);
! class_addbang(dirac_class, dirac_bang);
! class_addmethod(dirac_class, (t_method)dirac_dsp, gensym("dsp"), 0);
! class_addmethod(dirac_class, (t_method)dirac_helper, gensym("help"), 0);
zexy_register("dirac~");
}
Index: noisi~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/noisi~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** noisi~.c 14 Mar 2007 09:08:56 -0000 1.5
--- noisi~.c 30 Oct 2007 09:21:52 -0000 1.6
***************
*** 42,49 ****
t_object x_obj;
int val;
! t_float current;
! t_float decrement;
! t_float updater;
! t_float to_go;
} t_nois;
--- 42,49 ----
t_object x_obj;
int val;
! t_sample current;
! t_sample decrement;
! t_sample updater;
! t_sample to_go;
} t_nois;
***************
*** 59,62 ****
--- 59,70 ----
}
+
+ static void set_noisseed(t_nois *x, t_floatarg seed)
+ {
+ x->val = seed;
+ }
+
+
+
/* ------------------------ noisi~ ----------------------------- */
***************
*** 65,77 ****
static t_int *noisi_perform(t_int *w){
t_nois *x = (t_nois *)(w[1]);
! t_float *out = (t_float *)(w[2]);
int n = (int)(w[3]);
! int *vp = (int *)(&x->val); /* what the ... */
! int i_value = *vp;
! t_float f_value = x->current;
! t_float decrement = x->decrement;
! t_float all_to_go = x->updater;
! t_float still_to_go = x->to_go;
if (all_to_go == 1) {
--- 73,84 ----
static t_int *noisi_perform(t_int *w){
t_nois *x = (t_nois *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3]);
! int i_value = x->val;
! t_sample f_value = x->current;
! t_sample decrement = x->decrement;
! t_sample all_to_go = x->updater;
! t_sample still_to_go = x->to_go;
if (all_to_go == 1) {
***************
*** 99,103 ****
((t_sample)((i_value & 0x7fffffff)-0x40000000))*(t_sample)(1.0 / 0x40000000)) -
((t_sample)(((i_value = i_value * 435898247 + 382842987) & 0x7fffffff)
! - 0x40000000)) * (t_sample)(1.0 / 0x40000000)
) / all_to_go;
--- 106,110 ----
((t_sample)((i_value & 0x7fffffff)-0x40000000))*(t_sample)(1.0 / 0x40000000)) -
((t_sample)(((i_value = i_value * 435898247 + 382842987) & 0x7fffffff)
! - 0x40000000)) * (t_sample)(1.0 / 0x40000000)
) / all_to_go;
***************
*** 120,124 ****
}
! *vp = i_value;
x->current = f_value;
x->decrement = decrement;
--- 127,131 ----
}
! x->val = i_value;
x->current = f_value;
x->decrement = decrement;
***************
*** 163,166 ****
--- 170,175 ----
class_addmethod(noisi_class, (t_method)noisi_dsp, gensym("dsp"), 0);
+ class_addmethod(noisi_class, (t_method)set_noisseed, gensym("seed"), A_FLOAT, 0);
+
class_addmethod(noisi_class, (t_method)noisi_helper, gensym("help"), 0);
zexy_register("noisi~");
Index: dfreq~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/dfreq~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** dfreq~.c 14 Mar 2007 09:08:56 -0000 1.5
--- dfreq~.c 30 Oct 2007 09:21:51 -0000 1.6
***************
*** 29,36 ****
t_object x_obj;
! t_float freq; /*freqenz variable */
! t_float alt;
! float sampcount;
! t_float sr;
} t_dfreq;
--- 29,36 ----
t_object x_obj;
! t_sample freq; /*frequenz variable */
! t_sample alt;
! t_sample sampcount;
! t_sample sr;
} t_dfreq;
***************
*** 38,50 ****
static t_int *dfreq_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
! t_float *out = (t_float *)(w[2]);
int n = (int)(w[3]);
t_dfreq *x = (t_dfreq *) w[4];
! t_float a = x->alt, c = x->sampcount;
! t_float freq = x->freq, sr=x->sr;
! t_float delta_inv;
while (n--) {
--- 38,52 ----
static t_int *dfreq_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3]);
t_dfreq *x = (t_dfreq *) w[4];
! t_sample a = x->alt;
! t_sample c = x->sampcount;
! t_sample freq = x->freq;
! t_sample sr=x->sr;
! t_sample delta_inv;
while (n--) {
***************
*** 52,61 ****
if( (a * *in) < 0 && (a < *in)){
! /* interpolate for real zerocross */
! delta_inv = 1./(*in-a);
if(c > 0.0)
! freq = sr / ((t_float) c + a*delta_inv);
else
! freq = sr;
c = *in*delta_inv; /*rest of time */
--- 54,63 ----
if( (a * *in) < 0 && (a < *in)){
! /* interpolate for real zerocross */
! delta_inv = 1./(*in-a);
if(c > 0.0)
! freq = sr / ((t_sample) c + a*delta_inv);
else
! freq = sr;
c = *in*delta_inv; /*rest of time */
***************
*** 77,81 ****
static void dfreq_dsp(t_dfreq *x, t_signal **sp)
{
! dsp_add(dfreq_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n,x);
}
--- 79,83 ----
static void dfreq_dsp(t_dfreq *x, t_signal **sp)
{
! dsp_add(dfreq_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n,x);
}
***************
*** 94,100 ****
static void dfreq_tilde_helper(void)
{
! post("\n%c dfreq~\t :: pitch-detector that counts zero-crossings", HEARTSYMBOL);
! post("\noutputs a frequency estimate as a stream~ that will be updated every zero-X");
! post("\ncreation::\t'dfreq~': that's all");
}
--- 96,102 ----
static void dfreq_tilde_helper(void)
{
! post("\n%c dfreq~\t :: pitch-detector that counts zero-crossings", HEARTSYMBOL);
! post("\noutputs a frequency estimate as a stream~ that will be updated every zero-X");
! post("\ncreation::\t'dfreq~': that's all");
}
***************
*** 102,111 ****
void dfreq_tilde_setup(void)
{
! dfreq_class = class_new(gensym("dfreq~"), (t_newmethod)dfreq_new, 0,
! sizeof(t_dfreq), 0, A_NULL);
! class_addmethod(dfreq_class, nullfn, gensym("signal"), 0);
! class_addmethod(dfreq_class, (t_method)dfreq_dsp, gensym("dsp"), 0);
! class_addmethod(dfreq_class, (t_method)dfreq_tilde_helper, gensym("help"), 0);
zexy_register("dfreq~");
}
--- 104,113 ----
void dfreq_tilde_setup(void)
{
! dfreq_class = class_new(gensym("dfreq~"), (t_newmethod)dfreq_new, 0,
! sizeof(t_dfreq), 0, A_NULL);
! class_addmethod(dfreq_class, nullfn, gensym("signal"), 0);
! class_addmethod(dfreq_class, (t_method)dfreq_dsp, gensym("dsp"), 0);
! class_addmethod(dfreq_class, (t_method)dfreq_tilde_helper, gensym("help"), 0);
zexy_register("dfreq~");
}
Index: unpack~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/unpack~.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** unpack~.c 14 Mar 2007 09:08:56 -0000 1.6
--- unpack~.c 30 Oct 2007 09:21:52 -0000 1.7
***************
*** 30,35 ****
{
t_object x_obj;
! t_float *buffer;
! t_float *rp, *wp;
int bufsize;
--- 30,35 ----
{
t_object x_obj;
! t_sample *buffer;
! t_sample *rp, *wp;
int bufsize;
***************
*** 48,60 ****
t_atom *ap = argv;
int i;
- ZEXY_USEVAR(s);
-
for (i = 0, ap = argv; i < argc; ap++, i++) {
! // if (ap->a_type == A_FLOAT) {
! if (x->wp + 1 != x->rp) {
! *(x->wp)++ = atom_getfloat(ap);
! if (x->wp == x->buffer + x->bufsize) x->wp = x->buffer;
! }
! // }
}
}
--- 48,56 ----
t_atom *ap = argv;
int i;
for (i = 0, ap = argv; i < argc; ap++, i++) {
! if (x->wp + 1 != x->rp) {
! *(x->wp)++ = atom_getfloat(ap);
! if (x->wp == x->buffer + x->bufsize) x->wp = x->buffer;
! }
}
}
***************
*** 63,71 ****
static t_int *sigunpack_perform(t_int *w)
{
! t_float *out = (t_float *)(w[1]);
t_sigunpack *x = (t_sigunpack *)w[2];
int n = (int)(w[3]);
! t_float *buf = x->rp;
int hitchhike = 0;
--- 59,67 ----
static t_int *sigunpack_perform(t_int *w)
{
! t_sample *out = (t_sample *)(w[1]);
t_sigunpack *x = (t_sigunpack *)w[2];
int n = (int)(w[3]);
! t_sample *buf = x->rp;
int hitchhike = 0;
***************
*** 87,92 ****
if (x->bufsize % sp[0]->s_n) {
int newsize = sp[0]->s_n*(1+(int)(x->bufsize/sp[0]->s_n));
! freebytes(x->buffer, x->bufsize * sizeof(t_float));
! x->buffer = (t_float *)getbytes(newsize * sizeof(t_float));
x->rp = x->wp = x->buffer;
--- 83,88 ----
if (x->bufsize % sp[0]->s_n) {
int newsize = sp[0]->s_n*(1+(int)(x->bufsize/sp[0]->s_n));
! freebytes(x->buffer, x->bufsize * sizeof(*x->buffer));
! x->buffer = (t_sample *)getbytes(newsize * sizeof(*x->buffer));
x->rp = x->wp = x->buffer;
***************
*** 106,110 ****
else bufsize = (suggestedsize % 64)?(64*(1+(int)(suggestedsize/64))):suggestedsize;
! x->buffer = (t_float *)getbytes(bufsize * sizeof(t_float));
x->bufsize = bufsize;
x->rp = x->wp = x->buffer;
--- 102,106 ----
else bufsize = (suggestedsize % 64)?(64*(1+(int)(suggestedsize/64))):suggestedsize;
! x->buffer = (t_sample *)getbytes(bufsize * sizeof(*x->buffer));
x->bufsize = bufsize;
x->rp = x->wp = x->buffer;
***************
*** 123,127 ****
{
sigunpack_class = class_new(gensym("unpack~"), (t_newmethod)sigunpack_new, 0,
! sizeof(t_sigunpack), 0, A_DEFFLOAT, 0);
class_addmethod(sigunpack_class, (t_method)sigunpack_dsp, gensym("dsp"), 0);
class_addfloat(sigunpack_class, (t_method)sigunpack_float);
--- 119,123 ----
{
sigunpack_class = class_new(gensym("unpack~"), (t_newmethod)sigunpack_new, 0,
! sizeof(t_sigunpack), 0, A_DEFFLOAT, 0);
class_addmethod(sigunpack_class, (t_method)sigunpack_dsp, gensym("dsp"), 0);
class_addfloat(sigunpack_class, (t_method)sigunpack_float);
Index: demultiplex~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/demultiplex~.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** demultiplex~.c 14 Mar 2007 09:08:55 -0000 1.7
--- demultiplex~.c 30 Oct 2007 09:21:51 -0000 1.8
***************
*** 86,117 ****
static void *demux_new(t_symbol *s, int argc, t_atom *argv)
{
! t_demux *x = (t_demux *)pd_new(demux_class);
! int i;
! ZEXY_USEVAR(s);
! ZEXY_USEVAR(argv);
! if (!argc)argc=2;
! x->n_out=argc;
! x->output=0;
! while(argc--)outlet_new(&x->x_obj, gensym("signal"));
! x->out = (t_sample **)getbytes(x->n_out * sizeof(t_sample *));
! i=x->n_out;
! while(i--)x->out[i]=0;
! return (x);
}
void demultiplex_tilde_setup(void)
{
! demux_class = class_new(gensym("demultiplex~"), (t_newmethod)demux_new, (t_method)demux_free, sizeof(t_demux), 0, A_GIMME, 0);
! class_addcreator((t_newmethod)demux_new, gensym("demux~"), A_GIMME, 0);
! class_addfloat(demux_class, demux_output);
! class_addmethod(demux_class, (t_method)demux_dsp, gensym("dsp"), 0);
! class_addmethod(demux_class, nullfn, gensym("signal"), 0);
! class_addmethod(demux_class, (t_method)demux_helper, gensym("help"), 0);
zexy_register("demultiplex~");
--- 86,117 ----
static void *demux_new(t_symbol *s, int argc, t_atom *argv)
{
! t_demux *x = (t_demux *)pd_new(demux_class);
! int i;
! ZEXY_USEVAR(s);
! ZEXY_USEVAR(argv);
! if (!argc)argc=2;
! x->n_out=argc;
! x->output=0;
! while(argc--)outlet_new(&x->x_obj, gensym("signal"));
! x->out = (t_sample **)getbytes(x->n_out * sizeof(t_sample *));
! i=x->n_out;
! while(i--)x->out[i]=0;
! return (x);
}
void demultiplex_tilde_setup(void)
{
! demux_class = class_new(gensym("demultiplex~"), (t_newmethod)demux_new, (t_method)demux_free, sizeof(t_demux), 0, A_GIMME, 0);
! class_addcreator((t_newmethod)demux_new, gensym("demux~"), A_GIMME, 0);
! class_addfloat(demux_class, demux_output);
! class_addmethod(demux_class, (t_method)demux_dsp, gensym("dsp"), 0);
! class_addmethod(demux_class, nullfn, gensym("signal"), 0);
! class_addmethod(demux_class, (t_method)demux_helper, gensym("help"), 0);
zexy_register("demultiplex~");
***************
*** 119,123 ****
void demux_tilde_setup(void)
{
! demultiplex_tilde_setup();
}
--- 119,123 ----
void demux_tilde_setup(void)
{
! demultiplex_tilde_setup();
}
Index: multiplex~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/multiplex~.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** multiplex~.c 14 Mar 2007 09:08:56 -0000 1.6
--- multiplex~.c 30 Oct 2007 09:21:52 -0000 1.7
***************
*** 29,33 ****
int n_in;
! t_float **in;
} t_mux;
--- 29,33 ----
int n_in;
! t_sample **in;
} t_mux;
***************
*** 44,51 ****
{
t_mux *x = (t_mux *)(w[1]);
! t_float *out = (t_float *)(w[2]);
int n = (int)(w[3]);
! t_float *in = x->in[x->input];
while(n--)*out++=*in++;
--- 44,51 ----
{
t_mux *x = (t_mux *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3]);
! t_sample *in = x->in[x->input];
while(n--)*out++=*in++;
***************
*** 57,61 ****
{
int n = 0;
! t_float **dummy=x->in;
for(n=0;n<x->n_in;n++)*dummy++=sp[n]->s_vec;
--- 57,61 ----
{
int n = 0;
! t_sample **dummy=x->in;
for(n=0;n<x->n_in;n++)*dummy++=sp[n]->s_vec;
***************
*** 74,118 ****
static void mux_free(t_mux *x)
{
! freebytes(x->in, x->n_in * sizeof(t_float *));
}
static void *mux_new(t_symbol *s, int argc, t_atom *argv)
{
! t_mux *x = (t_mux *)pd_new(mux_class);
! int i;
! ZEXY_USEVAR(s);
! ZEXY_USEVAR(argv);
! if (!argc)argc=2;
! x->n_in=argc;
! x->input=0;
! argc--;
! while(argc--)inlet_new(&x->x_obj,&x->x_obj.ob_pd,&s_signal,&s_signal);
! x->in = (t_float **)getbytes(x->n_in * sizeof(t_float *));
! i=x->n_in;
! while(i--)x->in[i]=0;
! outlet_new(&x->x_obj, gensym("signal"));
! return (x);
}
void multiplex_tilde_setup(void)
{
! mux_class = class_new(gensym("multiplex~"), (t_newmethod)mux_new, (t_method)mux_free, sizeof(t_mux), 0, A_GIMME, 0);
! class_addcreator((t_newmethod)mux_new, gensym("mux~"), A_GIMME, 0);
! class_addfloat(mux_class, mux_input);
! class_addmethod(mux_class, (t_method)mux_dsp, gensym("dsp"), 0);
! class_addmethod(mux_class, nullfn, gensym("signal"), 0);
! class_addmethod(mux_class, (t_method)mux_helper, gensym("help"), 0);
zexy_register("multiplex~");
}
void mux_tilde_setup(void)
{
! multiplex_tilde_setup();
}
--- 74,118 ----
static void mux_free(t_mux *x)
{
! freebytes(x->in, x->n_in * sizeof(t_sample *));
}
static void *mux_new(t_symbol *s, int argc, t_atom *argv)
{
! t_mux *x = (t_mux *)pd_new(mux_class);
! int i;
! ZEXY_USEVAR(s);
! ZEXY_USEVAR(argv);
! if (!argc)argc=2;
! x->n_in=argc;
! x->input=0;
! argc--;
! while(argc--)inlet_new(&x->x_obj,&x->x_obj.ob_pd,&s_signal,&s_signal);
! x->in = (t_sample **)getbytes(x->n_in * sizeof(t_sample *));
! i=x->n_in;
! while(i--)x->in[i]=0;
! outlet_new(&x->x_obj, gensym("signal"));
! return (x);
}
void multiplex_tilde_setup(void)
{
! mux_class = class_new(gensym("multiplex~"), (t_newmethod)mux_new, (t_method)mux_free, sizeof(t_mux), 0, A_GIMME, 0);
! class_addcreator((t_newmethod)mux_new, gensym("mux~"), A_GIMME, 0);
! class_addfloat(mux_class, mux_input);
! class_addmethod(mux_class, (t_method)mux_dsp, gensym("dsp"), 0);
! class_addmethod(mux_class, nullfn, gensym("signal"), 0);
! class_addmethod(mux_class, (t_method)mux_helper, gensym("help"), 0);
zexy_register("multiplex~");
}
void mux_tilde_setup(void)
{
! multiplex_tilde_setup();
}
Index: limiter~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/limiter~.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** limiter~.c 14 Mar 2007 09:08:56 -0000 1.8
--- limiter~.c 30 Oct 2007 09:21:52 -0000 1.9
***************
*** 17,26 ****
/*
! --------------------------------- limiter/compressor ---------------------------------
! for details on how it works watch out for "http://iem.kug.ac.at/~zmoelnig/pd"
! ...and search for "limiter"
! mail2me4more!n4m8ion : zmoelnig at iem.kug.ac.at
*/
--- 17,26 ----
/*
! --------------------------------- limiter/compressor ---------------------------------
! for details on how it works watch out for "http://iem.kug.ac.at/~zmoelnig/pd"
! ...and search for "limiter"
! mail2me4more!n4m8ion : zmoelnig at iem.kug.ac.at
*/
***************
*** 63,82 ****
typedef struct _limctl
{ // variables changed by user
! float limit, hold_samples, change_of_amplification;
} t_limctl;
typedef struct _cmpctl
{
! float treshold, ratio; // uclimit is the very same is the limiter1-limit (decalculated relative to our treshold)
! float uclimit, climit_inverse; // climit == compressed limit (uclimit == uncompressed limit)
! float limiter_limit; // start limiting (stop compressing); == tresh/limit;
! float treshdB, oneminusratio;
} t_cmpctl;
typedef struct _inbuf
{
! float* ringbuf;
int buf_position;
} t_inbuf;
--- 63,82 ----
typedef struct _limctl
{ // variables changed by user
! t_float limit, hold_samples, change_of_amplification;
} t_limctl;
typedef struct _cmpctl
{
! t_float treshold, ratio; // uclimit is the very same is the limiter1-limit (decalculated relative to our treshold)
! t_float uclimit, climit_inverse; // climit == compressed limit (uclimit == uncompressed limit)
! t_float limiter_limit; // start limiting (stop compressing); == tresh/limit;
! t_float treshdB, oneminusratio;
} t_cmpctl;
typedef struct _inbuf
{
! t_sample* ringbuf;
int buf_position;
} t_inbuf;
***************
*** 90,95 ****
// variables changed by process
! float amplification;
! float samples_left, still_left;
int mode;
--- 90,95 ----
// variables changed by process
! t_sample amplification;
! t_float samples_left, still_left;
int mode;
***************
*** 115,119 ****
static t_float calc_holdsamples(t_float htime, int buf)
{ // hold_time must be greater than buffer_time to make sure that any peak_sample is amplified with its own factor
! float min_hold = buf / sys_getsr();
return (0.001 * sys_getsr() * ((htime > min_hold)?htime:((min_hold > 50)?min_hold:50)));
}
--- 115,119 ----
static t_float calc_holdsamples(t_float htime, int buf)
{ // hold_time must be greater than buffer_time to make sure that any peak_sample is amplified with its own factor
! t_float min_hold = buf / sys_getsr();
return (0.001 * sys_getsr() * ((htime > min_hold)?htime:((min_hold > 50)?min_hold:50)));
}
***************
*** 138,145 ****
// settings
! static void set_treshold(t_limiter *x, float treshold)
{
t_cmpctl *c = x->cmp;
! float tresh = dbtorms (treshold);
if (tresh > x->val1->limit) tresh = x->val1->limit;
--- 138,145 ----
// settings
! static void set_treshold(t_limiter *x, t_float treshold)
{
t_cmpctl *c = x->cmp;
! t_float tresh = dbtorms (treshold);
if (tresh > x->val1->limit) tresh = x->val1->limit;
***************
*** 149,153 ****
}
! static void set_ratio(t_limiter *x, float ratio)
{
if (ratio < 0) ratio = 1;
--- 149,153 ----
}
! static void set_ratio(t_limiter *x, t_float ratio)
{
if (ratio < 0) ratio = 1;
***************
*** 157,161 ****
}
! static void set_mode(t_limiter *x, float mode)
{
int modus = mode;
--- 157,161 ----
}
! static void set_mode(t_limiter *x, t_float mode)
{
int modus = mode;
***************
*** 193,197 ****
}
! static void set_bufsize(t_limiter *x, float size)
{ // this is really unneeded...and for historical reasons only
if (size < BUFSIZE) size = BUFSIZE;
--- 193,197 ----
}
! static void set_bufsize(t_limiter *x, int size)
{ // this is really unneeded...and for historical reasons only
if (size < BUFSIZE) size = BUFSIZE;
***************
*** 359,364 ****
t_limiter *x = (t_limiter *)w[1];
t_inbuf *buf = (t_inbuf *)w[2];
! t_float *in = (t_float *)w[3];
! t_float *out = (t_float *)w[4];
int n = x->s_n;
--- 359,364 ----
t_limiter *x = (t_limiter *)w[1];
t_inbuf *buf = (t_inbuf *)w[2];
! t_sample *in = (t_sample *)w[3];
! t_sample *out = (t_sample *)w[4];
int n = x->s_n;
***************
*** 367,371 ****
int i = buf->buf_position;
! t_float *vp = buf->ringbuf, *ep = vp + bufsize, *bp = vp + XTRASAMPS + i;
i += n;
--- 367,371 ----
int i = buf->buf_position;
! t_sample *vp = buf->ringbuf, *ep = vp + bufsize, *bp = vp + XTRASAMPS + i;
i += n;
***************
*** 373,378 ****
while (n--)
{
! t_float os1, os2, max;
! t_float last4, last3, last2, last1, sinccurrent, current, next1, next2, next3, next4;
if (bp == ep)
--- 373,378 ----
while (n--)
{
! t_sample os1, os2, max;
! t_sample last4, last3, last2, last1, sinccurrent, current, next1, next2, next3, next4;
if (bp == ep)
***************
*** 437,442 ****
int n = x->s_n;
! t_float *in = (t_float *)w[2];
! t_float *out= (t_float *)w[3];
t_limctl *v1 = (t_limctl *)(x->val1);
--- 437,442 ----
int n = x->s_n;
! t_sample *in = (t_sample *)w[2];
! t_sample *out= (t_sample *)w[3];
t_limctl *v1 = (t_limctl *)(x->val1);
***************
*** 482,494 ****
samplesleft = holdlong;
} else
! {
! if (samplesleft > 0)
! {
! samplesleft--;
! } else
! {
! if ((amp *= coa_long) > 1) amp = 1;
! }
! }
*out++ = amp;
--- 482,494 ----
samplesleft = holdlong;
} else
! {
! if (samplesleft > 0)
! {
! samplesleft--;
! } else
! {
! if ((amp *= coa_long) > 1) amp = 1;
! }
! }
*out++ = amp;
***************
*** 507,532 ****
stillleft = holdlong;
} else
! {
! if (samplesleft > 0)
! {
! samplesleft--;
! stillleft--;
! } else
! {
! if (amp < alimit)
! {
! if ((amp *= coa_short) > 1) amp = 1;
! } else
! {
! if (stillleft > 0)
! {
! samplesleft = stillleft;
! } else
! {
! if ((amp *= coa_long) > 1) amp = 1;
! }
! }
! }
! }
*out++ = amp;
*in++ = 0;
--- 507,532 ----
stillleft = holdlong;
} else
! {
! if (samplesleft > 0)
! {
! samplesleft--;
! stillleft--;
! } else
! {
! if (amp < alimit)
! {
! if ((amp *= coa_short) > 1) amp = 1;
! } else
! {
! if (stillleft > 0)
! {
! samplesleft = stillleft;
! } else
! {
! if ((amp *= coa_long) > 1) amp = 1;
! }
! }
! }
! }
*out++ = amp;
*in++ = 0;
***************
*** 573,577 ****
{
int i = 0;
! t_float* sig_buf = (t_float *)getbytes(sizeof(t_float) * sp[0]->s_n);
x->s_n = sp[0]->s_n;
--- 573,577 ----
{
int i = 0;
! t_sample* sig_buf = (t_sample *)getbytes(sizeof(*sig_buf) * sp[0]->s_n);
x->s_n = sp[0]->s_n;
***************
*** 623,627 ****
{
int n;
! t_float* buf = (float *)getbytes(sizeof(float) * x->buf_size);
x->in[i].ringbuf = buf;
x->in[i].buf_position = 0;
--- 623,627 ----
{
int n;
! t_sample* buf = (t_sample *)getbytes(sizeof(*buf) * x->buf_size);
x->in[i].ringbuf = buf;
x->in[i].buf_position = 0;
***************
*** 654,658 ****
freebytes(x->cmp , sizeof(t_cmpctl));
! while (i < x->number_of_inlets) freebytes(x->in[i++].ringbuf, x->buf_size * sizeof(t_float));
freebytes(x->in, x->number_of_inlets * sizeof(t_inbuf));
--- 654,658 ----
freebytes(x->cmp , sizeof(t_cmpctl));
! while (i < x->number_of_inlets) freebytes(x->in[i++].ringbuf, x->buf_size * sizeof(t_sample));
freebytes(x->in, x->number_of_inlets * sizeof(t_inbuf));
Index: swap~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/swap~.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** swap~.c 14 Mar 2007 09:08:56 -0000 1.4
--- swap~.c 30 Oct 2007 09:21:52 -0000 1.5
***************
*** 15,22 ****
/*
! the long waited for swap~-object that does a byte swap
! of course, we unfortunately have to quantize the float-signal to 16bit (to get bytes)
! 1110:forum::für::umläute:1999
*/
--- 15,22 ----
/*
! the long waited for swap~-object that does a byte swap
! of course, we unfortunately have to quantize the float-signal to 16bit (to get bytes)
! 1110:forum::für::umläute:1999
*/
***************
*** 48,53 ****
{
t_swap *x = (t_swap *)(w[1]);
! t_float *in = (t_float *)(w[2]);
! t_float *out = (t_float *)(w[3]);
int n = (int)(w[4]);
--- 48,53 ----
{
t_swap *x = (t_swap *)(w[1]);
! t_sample *in = (t_sample *)(w[2]);
! t_sample *out = (t_sample *)(w[3]);
int n = (int)(w[4]);
Index: tavg~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/tavg~.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** tavg~.c 14 Mar 2007 09:08:56 -0000 1.6
--- tavg~.c 30 Oct 2007 09:21:52 -0000 1.7
***************
*** 24,30 ****
{
t_object x_obj;
! t_float n_inv;
! t_float buf;
! int blocks;
} t_tavgtilde;
--- 24,30 ----
{
t_object x_obj;
! t_sample n_inv;
! t_sample buf;
! unsigned int blocks;
} t_tavgtilde;
***************
*** 33,37 ****
{
if (x->blocks) {
! outlet_float(x->x_obj.ob_outlet, x->buf*x->n_inv/x->blocks);
x->blocks = 0;
x->buf = 0.;
--- 33,38 ----
{
if (x->blocks) {
! t_float result=x->buf*x->n_inv/x->blocks;
! outlet_float(x->x_obj.ob_outlet, result);
x->blocks = 0;
x->buf = 0.;
***************
*** 41,87 ****
static t_int *tavg_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
! t_tavgtilde *x = (t_tavgtilde *)w[2];
! int n = (int)(w[3]);
!
! t_float buf = x->buf;
!
! while (n--) buf += *in++;
!
! x->buf = buf;
! x->blocks++;
! return (w+4);
}
static void tavg_dsp(t_tavgtilde *x, t_signal **sp)
{
! x->n_inv=1./sp[0]->s_n;
! dsp_add(tavg_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
}
static void *tavg_new(void)
{
! t_tavgtilde *x = (t_tavgtilde *)pd_new(tavg_class);
! outlet_new(&x->x_obj, gensym("float"));
! return (x);
}
static void tavg_help(void)
{
! post("tavg~\t\t:: outputs the arithmetic mean of a signal when triggered");
! post("<bang>\t\t: triggers the output");
}
void tavg_tilde_setup(void)
{
! tavg_class = class_new(gensym("tavg~"), (t_newmethod)tavg_new, 0,
! sizeof(t_tavgtilde), 0, A_DEFFLOAT, 0);
! class_addmethod(tavg_class, nullfn, gensym("signal"), 0);
! class_addmethod(tavg_class, (t_method)tavg_dsp, gensym("dsp"), 0);
! class_addbang(tavg_class, tavg_bang);
! class_addmethod(tavg_class, (t_method)tavg_help, gensym("help"), 0);
zexy_register("tavg~");
}
--- 42,85 ----
static t_int *tavg_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
! t_tavgtilde *x = (t_tavgtilde *)w[2];
! int n = (int)(w[3]);
! t_sample buf = x->buf;
! while (n--) buf += *in++;
! x->buf = buf;
! x->blocks++;
! return (w+4);
}
static void tavg_dsp(t_tavgtilde *x, t_signal **sp)
{
! x->n_inv=1./sp[0]->s_n;
! dsp_add(tavg_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
}
static void *tavg_new(void)
{
! t_tavgtilde *x = (t_tavgtilde *)pd_new(tavg_class);
! outlet_new(&x->x_obj, &s_float);
! return (x);
}
static void tavg_help(void)
{
! post("tavg~\t\t:: outputs the arithmetic mean of a signal when triggered");
! post("<bang>\t\t: triggers the output");
}
void tavg_tilde_setup(void)
{
! tavg_class = class_new(gensym("tavg~"), (t_newmethod)tavg_new, 0,
! sizeof(t_tavgtilde), 0, A_DEFFLOAT, 0);
! class_addmethod(tavg_class, nullfn, gensym("signal"), 0);
! class_addmethod(tavg_class, (t_method)tavg_dsp, gensym("dsp"), 0);
! class_addbang(tavg_class, tavg_bang);
! class_addmethod(tavg_class, (t_method)tavg_help, gensym("help"), 0);
zexy_register("tavg~");
}
Index: pack~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/pack~.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pack~.c 14 Mar 2007 09:08:56 -0000 1.4
--- pack~.c 30 Oct 2007 09:21:52 -0000 1.5
***************
*** 34,38 ****
static t_int *sigpack_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
t_sigpack *x = (t_sigpack *)w[2];
int n = (int)(w[3]), i = 0;
--- 34,38 ----
static t_int *sigpack_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
t_sigpack *x = (t_sigpack *)w[2];
int n = (int)(w[3]), i = 0;
***************
*** 40,46 ****
while (n--) {
! SETFLOAT(&buf[i], *in++);
i++;
}
outlet_list(x->x_obj.ob_outlet, &s_list, x->vector_length, x->buffer);
--- 40,49 ----
while (n--) {
! t_float f=*in++;
! SETFLOAT(&buf[i], f);
i++;
}
+ #warning defer list-output to next block with a clock!
+
outlet_list(x->x_obj.ob_outlet, &s_list, x->vector_length, x->buffer);
***************
*** 76,80 ****
{
sigpack_class = class_new(gensym("pack~"), (t_newmethod)sigpack_new, 0,
! sizeof(t_sigpack), 0, A_DEFFLOAT, 0);
class_addmethod(sigpack_class, nullfn, gensym("signal"), 0);
class_addmethod(sigpack_class, (t_method)sigpack_dsp, gensym("dsp"), 0);
--- 79,83 ----
{
sigpack_class = class_new(gensym("pack~"), (t_newmethod)sigpack_new, 0,
! sizeof(t_sigpack), 0, A_DEFFLOAT, 0);
class_addmethod(sigpack_class, nullfn, gensym("signal"), 0);
class_addmethod(sigpack_class, (t_method)sigpack_dsp, gensym("dsp"), 0);
Index: blockswap~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/blockswap~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** blockswap~.c 14 Mar 2007 09:08:55 -0000 1.5
--- blockswap~.c 30 Oct 2007 09:21:51 -0000 1.6
***************
*** 30,34 ****
int doit;
int blocksize;
! t_float *blockbuffer;
} t_blockswap;
--- 30,34 ----
int doit;
int blocksize;
! t_sample *blockbuffer;
} t_blockswap;
***************
*** 41,51 ****
{
t_blockswap *x = (t_blockswap *)(w[1]);
! t_float *in = (t_float *)(w[2]);
! t_float *out = (t_float *)(w[3]);
int N = (int)(w[4]);
int N2=N/2;
if (x->doit) {
int n=N2;
! t_float *dummy=x->blockbuffer;
while(n--)*dummy++=*in++;
n=N-N2;
--- 41,51 ----
{
t_blockswap *x = (t_blockswap *)(w[1]);
! t_sample *in = (t_sample *)(w[2]);
! t_sample *out = (t_sample *)(w[3]);
int N = (int)(w[4]);
int N2=N/2;
if (x->doit) {
int n=N2;
! t_sample *dummy=x->blockbuffer;
while(n--)*dummy++=*in++;
n=N-N2;
***************
*** 61,67 ****
{
if (x->blocksize*2<sp[0]->s_n){
! if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
x->blocksize = sp[0]->s_n/2;
! x->blockbuffer = getbytes(sizeof(t_float)*x->blocksize);
}
dsp_add(blockswap_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
--- 61,67 ----
{
if (x->blocksize*2<sp[0]->s_n){
! if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize);
x->blocksize = sp[0]->s_n/2;
! x->blockbuffer = getbytes(sizeof(*x->blockbuffer)*x->blocksize);
}
dsp_add(blockswap_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
***************
*** 79,83 ****
{
if(x->blockbuffer){
! freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
}
x->blockbuffer=0;
--- 79,83 ----
{
if(x->blockbuffer){
! freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize);
}
x->blockbuffer=0;
***************
*** 96,100 ****
{
blockswap_class = class_new(gensym("blockswap~"), (t_newmethod)blockswap_new, 0,
! sizeof(t_blockswap), 0, A_NULL);
class_addmethod(blockswap_class, nullfn, gensym("signal"), 0);
class_addmethod(blockswap_class, (t_method)blockswap_dsp, gensym("dsp"), 0);
--- 96,100 ----
{
blockswap_class = class_new(gensym("blockswap~"), (t_newmethod)blockswap_new, 0,
! sizeof(t_blockswap), 0, A_NULL);
class_addmethod(blockswap_class, nullfn, gensym("signal"), 0);
class_addmethod(blockswap_class, (t_method)blockswap_dsp, gensym("dsp"), 0);
Index: absgn~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/absgn~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** absgn~.c 14 Mar 2007 09:08:55 -0000 1.5
--- absgn~.c 30 Oct 2007 09:21:51 -0000 1.6
***************
*** 17,21 ****
{
t_object x_obj;
! float x_f;
} t_absgn;
--- 17,21 ----
{
t_object x_obj;
! t_float x_f;
} t_absgn;
***************
*** 27,38 ****
static t_int *sigABSGN_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
! t_float *out = (t_float *)(w[2]);
! t_float *out2 = (t_float *)(w[3]);
int n = (int)(w[4]);
while (n--)
! {
! t_float val = *in++;
*out++ = fabsf(val);
--- 27,38 ----
static t_int *sigABSGN_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
! t_sample *out2 = (t_sample *)(w[3]);
int n = (int)(w[4]);
while (n--)
! {
! t_sample val = *in++;
*out++ = fabsf(val);
***************
*** 40,44 ****
else if (val<0.) *out2++=-1.;
else *out2++=0.;
! }
--- 40,44 ----
else if (val<0.) *out2++=-1.;
else *out2++=0.;
! }
***************
*** 95,99 ****
Z_SIMD_CHKALIGN(sp[0]->s_vec)&&
Z_SIMD_CHKALIGN(sp[1]->s_vec)&&
! Z_SIMD_CHKALIGN(sp[2]->s_vec)
)
{
--- 95,100 ----
Z_SIMD_CHKALIGN(sp[0]->s_vec)&&
Z_SIMD_CHKALIGN(sp[1]->s_vec)&&
! Z_SIMD_CHKALIGN(sp[2]->s_vec)&&
! ZEXY_TYPE_EQUAL(t_sample, float)
)
{
***************
*** 126,130 ****
{
sigABSGN_class = class_new(gensym("absgn~"), (t_newmethod)sigABSGN_new, 0,
! sizeof(t_absgn), 0, A_DEFFLOAT, 0);
CLASS_MAINSIGNALIN(sigABSGN_class, t_absgn, x_f);
class_addmethod(sigABSGN_class, (t_method)sigABSGN_dsp, gensym("dsp"), 0);
--- 127,131 ----
{
sigABSGN_class = class_new(gensym("absgn~"), (t_newmethod)sigABSGN_new, 0,
! sizeof(t_absgn), 0, A_DEFFLOAT, 0);
CLASS_MAINSIGNALIN(sigABSGN_class, t_absgn, x_f);
class_addmethod(sigABSGN_class, (t_method)sigABSGN_dsp, gensym("dsp"), 0);
Index: blockmirror~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/blockmirror~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** blockmirror~.c 14 Mar 2007 09:08:55 -0000 1.5
--- blockmirror~.c 30 Oct 2007 09:21:51 -0000 1.6
***************
*** 34,38 ****
int doit;
int blocksize;
! t_float *blockbuffer;
} t_blockmirror;
--- 34,38 ----
int doit;
int blocksize;
! t_sample *blockbuffer;
} t_blockmirror;
***************
*** 45,55 ****
{
t_blockmirror *x = (t_blockmirror *)(w[1]);
! t_float *in = (t_float *)(w[2]);
! t_float *out = (t_float *)(w[3]);
int n = (int)(w[4]);
if (x->doit) {
if (in==out){
int N=n;
! t_float *dummy=x->blockbuffer;
while(n--)*dummy++=*in++;
dummy--;
--- 45,55 ----
{
t_blockmirror *x = (t_blockmirror *)(w[1]);
! t_sample *in = (t_sample *)(w[2]);
! t_sample *out = (t_sample *)(w[3]);
int n = (int)(w[4]);
if (x->doit) {
if (in==out){
int N=n;
! t_sample *dummy=x->blockbuffer;
while(n--)*dummy++=*in++;
dummy--;
***************
*** 66,72 ****
{
if (x->blocksize<sp[0]->s_n){
! if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
x->blocksize = sp[0]->s_n;
! x->blockbuffer = getbytes(sizeof(t_float)*x->blocksize);
}
dsp_add(blockmirror_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
--- 66,72 ----
{
if (x->blocksize<sp[0]->s_n){
! if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize);
x->blocksize = sp[0]->s_n;
! x->blockbuffer = getbytes(sizeof(*x->blockbuffer)*x->blocksize);
}
dsp_add(blockmirror_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
***************
*** 83,87 ****
{
if(x->blockbuffer)
! freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
x->blockbuffer=0;
}
--- 83,87 ----
{
if(x->blockbuffer)
! freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize);
x->blockbuffer=0;
}
Index: quantize~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/quantize~.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** quantize~.c 14 Mar 2007 09:08:56 -0000 1.6
--- quantize~.c 30 Oct 2007 09:21:52 -0000 1.7
***************
*** 31,75 ****
typedef struct _quantize
{
! t_object x_obj;
! t_float quantiz, dequantiz;
} t_quantize;
static void quantize_float(t_quantize *x, t_floatarg f)
{
! x->quantiz = f;
! x->dequantiz = 1./f;
}
static void quantize_16bit(t_quantize *x)
{
! x->quantiz = 32768.;
! x->dequantiz = 1./32768.;
}
static void quantize_8bit(t_quantize *x)
{
! x->quantiz = 128.;
! x->dequantiz = 1./128.;
}
static t_int *quantize_perform(t_int *w)
{
! t_quantize *x = (t_quantize *)(w[1]);
! t_float *in = (t_float *)(w[2]);
! t_float *out = (t_float *)(w[3]);
! int n = (int)(w[4]);
! t_float quantiz = x->quantiz, dequantiz = x->dequantiz;
! if (quantiz)
! while (n--) *out++ = dequantiz*(int)(quantiz**in++);
! else while (n--) *out++ = *in++;
! return (w+5);
}
static void quantize_dsp(t_quantize *x, t_signal **sp)
{
! dsp_add(quantize_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
}
--- 31,75 ----
typedef struct _quantize
{
! t_object x_obj;
! t_sample quantiz, dequantiz;
} t_quantize;
static void quantize_float(t_quantize *x, t_floatarg f)
{
! x->quantiz = f;
! x->dequantiz = 1./f;
}
static void quantize_16bit(t_quantize *x)
{
! x->quantiz = 32768.;
! x->dequantiz = 1./32768.;
}
static void quantize_8bit(t_quantize *x)
{
! x->quantiz = 128.;
! x->dequantiz = 1./128.;
}
static t_int *quantize_perform(t_int *w)
{
! t_quantize *x = (t_quantize *)(w[1]);
! t_sample *in = (t_sample *)(w[2]);
! t_sample *out = (t_sample *)(w[3]);
! int n = (int)(w[4]);
! t_sample quantiz = x->quantiz, dequantiz = x->dequantiz;
! if (quantiz)
! while (n--) *out++ = dequantiz*(int)(quantiz**in++);
! else while (n--) *out++ = *in++;
! return (w+5);
}
static void quantize_dsp(t_quantize *x, t_signal **sp)
{
! dsp_add(quantize_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
}
***************
*** 77,88 ****
{
ZEXY_USEVAR(x);
! post("%c quantize~-object\t:: used for quantizing signals by various degrees", HEARTSYMBOL);
! post("<quants> : quantize a signal into <quants> steps ('0' turns quantizing off)\n"
! "'8bit' : quantize to 8 bit\n"
! "'16bit' : quantize to 16 bit (default)\n"
! "'float' : pass-through the signal unchanged\n"
! "'help' : view this\n"
! "signal~\n");
! post("creation:: \"quantize~ [<quants>]\"");
}
--- 77,88 ----
{
ZEXY_USEVAR(x);
! post("%c quantize~-object\t:: used for quantizing signals by various degrees", HEARTSYMBOL);
! post("<quants> : quantize a signal into <quants> steps ('0' turns quantizing off)\n"
! "'8bit' : quantize to 8 bit\n"
! "'16bit' : quantize to 16 bit (default)\n"
! "'float' : pass-through the signal unchanged\n"
! "'help' : view this\n"
! "signal~\n");
! post("creation:: \"quantize~ [<quants>]\"");
}
***************
*** 90,99 ****
static void *quantize_new(t_floatarg f)
{
! t_quantize *x = (t_quantize *)pd_new(quantize_class);
! outlet_new(&x->x_obj, gensym("signal"));
! if (f) quantize_float(x, f);
! else quantize_16bit(x);
! return (x);
}
--- 90,99 ----
static void *quantize_new(t_floatarg f)
{
! t_quantize *x = (t_quantize *)pd_new(quantize_class);
! outlet_new(&x->x_obj, gensym("signal"));
! if (f) quantize_float(x, f);
! else quantize_16bit(x);
! return (x);
}
Index: z~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/z~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** z~.c 14 Mar 2007 09:08:56 -0000 1.5
--- z~.c 30 Oct 2007 09:21:52 -0000 1.6
***************
*** 16,24 ****
/*
! here we do some sample-wise delay, so you can do your own FIR-filter-designs
! here are :: "z^(-1)", "z^(-N)"
! to do :: a "lattice~" section ...
! 1302:forum::für::umläute:2000
*/
--- 16,24 ----
/*
! here we do some sample-wise delay, so you can do your own FIR-filter-designs
! here are :: "z^(-1)", "z^(-N)"
! to do :: a "lattice~" section ...
! 1302:forum::für::umläute:2000
*/
***************
*** 33,37 ****
t_object x_obj;
! t_float *buf;
int bufsize, phase;
--- 33,37 ----
t_object x_obj;
! t_sample *buf;
int bufsize, phase;
***************
*** 43,49 ****
if (i<1)i=1;
if (i==x->bufsize)return;
! freebytes(x->buf, x->bufsize*sizeof(t_float));
x->bufsize=i;
! x->buf=(t_float *)getbytes(x->bufsize*sizeof(t_float));
x->phase=0;
}
--- 43,49 ----
if (i<1)i=1;
if (i==x->bufsize)return;
! freebytes(x->buf, x->bufsize*sizeof(t_sample));
x->bufsize=i;
! x->buf=(t_sample *)getbytes(x->bufsize*sizeof(t_sample));
x->phase=0;
}
***************
*** 51,60 ****
static t_int *zN_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
! t_float *out = (t_float *)(w[2]);
t_zNdelay *x = (t_zNdelay *)(w[3]);
int n = (int)(w[4]);
! t_float *buf = x->buf;
int bufsize=x->bufsize, ph=x->phase;
--- 51,60 ----
static t_int *zN_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
t_zNdelay *x = (t_zNdelay *)(w[3]);
int n = (int)(w[4]);
! t_sample *buf = x->buf;
int bufsize=x->bufsize, ph=x->phase;
***************
*** 62,66 ****
if (in!=out)while(n--)*out++=*in++;
} else if (bufsize==2) {
! register t_float f, last=*buf;
while(n--){
f=*in++;
--- 62,66 ----
if (in!=out)while(n--)*out++=*in++;
} else if (bufsize==2) {
! register t_sample f, last=*buf;
while(n--){
f=*in++;
***************
*** 89,93 ****
t_zNdelay *x = (t_zNdelay *)pd_new(zNdelay_class);
int i = f;
! t_float *b;
if (i<=0) i=1;
--- 89,93 ----
t_zNdelay *x = (t_zNdelay *)pd_new(zNdelay_class);
int i = f;
! t_sample *b;
if (i<=0) i=1;
***************
*** 95,99 ****
x->bufsize = i;
! x->buf = (t_float *)getbytes(sizeof(t_float) * x->bufsize);
b=x->buf;
while (i--) {
--- 95,99 ----
x->bufsize = i;
! x->buf = (t_sample *)getbytes(sizeof(t_sample) * x->bufsize);
b=x->buf;
while (i--) {
***************
*** 109,113 ****
static void zNdelay_free(t_zNdelay *x)
{
! freebytes(x->buf, sizeof(t_float) * x->bufsize);
}
--- 109,113 ----
static void zNdelay_free(t_zNdelay *x)
{
! freebytes(x->buf, sizeof(t_sample) * x->bufsize);
}
Index: pdf~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/pdf~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pdf~.c 14 Mar 2007 09:08:56 -0000 1.5
--- pdf~.c 30 Oct 2007 09:21:52 -0000 1.6
***************
*** 69,73 ****
static t_int *pdf_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
t_pdf *x = (t_pdf *)(w[2]);
int n = (int)(w[3]);
--- 69,73 ----
static t_int *pdf_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
t_pdf *x = (t_pdf *)(w[2]);
int n = (int)(w[3]);
***************
*** 78,82 ****
while (n--)
{
! t_float f = *in++;
int iindex = ((f + 1.0) * halfsize)+0.5;
buf[(iindex<0)?0:((iindex>=x->size)?x->size-1:iindex)]+=1.;
--- 78,82 ----
while (n--)
{
! t_sample f = *in++;
int iindex = ((f + 1.0) * halfsize)+0.5;
buf[(iindex<0)?0:((iindex>=x->size)?x->size-1:iindex)]+=1.;
***************
*** 99,103 ****
x->size = (i)?i:64;
! x->buf = (t_float *)getbytes(x->size * sizeof(t_float));
buf = x->buf;
clear_pdfbuf(x);
--- 99,103 ----
x->size = (i)?i:64;
! x->buf = (t_float *)getbytes(x->size * sizeof(*x->buf));
buf = x->buf;
clear_pdfbuf(x);
***************
*** 110,124 ****
static void pdf_free(t_pdf *x)
{
! freebytes(x->buf, x->size*sizeof(t_float));
}
static void pdf_tilde_helper(void)
{
! post("\n%c pdf~\t:: get the probability density function of a signal (-1.0 to +1.0)", HEARTSYMBOL);
! post("'bang'\t : output a list of the probabilities of 'n' function values"
! "\n'clear'\t : clear the buffer (set all probabilities to zero)"
! "\n<1/0>\t : short for 'bang' and 'clear'"
! "\n'help'\t : view this");
! post("creation :: 'pdf~ [<n>]':: get the pdf for <n> (default: 64) values");
}
--- 110,125 ----
static void pdf_free(t_pdf *x)
{
! if(x->buf)
! freebytes(x->buf, x->size*sizeof(*x->buf));
}
static void pdf_tilde_helper(void)
{
! post("\n%c pdf~\t:: get the probability density function of a signal (-1.0 to +1.0)", HEARTSYMBOL);
! post("'bang'\t : output a list of the probabilities of 'n' function values"
! "\n'clear'\t : clear the buffer (set all probabilities to zero)"
! "\n<1/0>\t : short for 'bang' and 'clear'"
! "\n'help'\t : view this");
! post("creation :: 'pdf~ [<n>]':: get the pdf for <n> (default: 64) values");
}
Index: avg~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/avg~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** avg~.c 14 Mar 2007 09:08:55 -0000 1.5
--- avg~.c 30 Oct 2007 09:21:51 -0000 1.6
***************
*** 25,33 ****
typedef struct _avg
{
! t_object x_obj;
! t_float n_inv;
! t_float buf;
! int blocks;
} t_avg;
--- 25,32 ----
typedef struct _avg
{
! t_object x_obj;
! t_float n_inv;
! int blocks;
} t_avg;
***************
*** 37,72 ****
static t_int *avg_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
! t_avg *x = (t_avg *)w[2];
! int n = (int)(w[3]);
! t_float buf = 0.;
! while (n--)
{
! buf += *in++;
}
! outlet_float(x->x_obj.ob_outlet, buf*x->n_inv);
! return (w+4);
}
static void avg_dsp(t_avg *x, t_signal **sp)
{
! x->n_inv=1./sp[0]->s_n;
! dsp_add(avg_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
}
static void *avg_new(void)
{
! t_avg *x = (t_avg *)pd_new(avg_class);
! outlet_new(&x->x_obj, gensym("float"));
! return (x);
}
static void avg_help(void)
{
! post("avg~\t:: outputs the arithmetic mean of each signal-vector");
}
--- 36,71 ----
static t_int *avg_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
! t_avg *x = (t_avg *)w[2];
! int n = (int)(w[3]);
! t_sample buf = 0.;
! while (n--)
{
! buf += *in++;
}
! outlet_float(x->x_obj.ob_outlet, buf*x->n_inv);
! return (w+4);
}
static void avg_dsp(t_avg *x, t_signal **sp)
{
! x->n_inv=1./sp[0]->s_n;
! dsp_add(avg_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
}
static void *avg_new(void)
{
! t_avg *x = (t_avg *)pd_new(avg_class);
! outlet_new(&x->x_obj, &s_float);
! return (x);
}
static void avg_help(void)
{
! post("avg~\t:: outputs the arithmetic mean of each signal-vector");
}
***************
*** 74,83 ****
void avg_tilde_setup(void)
{
! avg_class = class_new(gensym("avg~"), (t_newmethod)avg_new, 0,
! sizeof(t_avg), 0, A_DEFFLOAT, 0);
! class_addmethod(avg_class, nullfn, gensym("signal"), 0);
! class_addmethod(avg_class, (t_method)avg_dsp, gensym("dsp"), 0);
! class_addmethod(avg_class, (t_method)avg_help, gensym("help"), 0);
zexy_register("avg~");
}
--- 73,82 ----
void avg_tilde_setup(void)
{
! avg_class = class_new(gensym("avg~"), (t_newmethod)avg_new, 0,
! sizeof(t_avg), 0, A_DEFFLOAT, 0);
! class_addmethod(avg_class, nullfn, gensym("signal"), 0);
! class_addmethod(avg_class, (t_method)avg_dsp, gensym("dsp"), 0);
! class_addmethod(avg_class, (t_method)avg_help, gensym("help"), 0);
zexy_register("avg~");
}
Index: sigzero~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/sigzero~.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** sigzero~.c 14 Mar 2007 09:08:56 -0000 1.7
--- sigzero~.c 30 Oct 2007 09:21:52 -0000 1.8
***************
*** 16,21 ****
/* ------------------------ sigzero~ ----------------------------- */
/*
! a very useful function, which detects, whether a signal is zeroes-only this block or not
! this is really great together with the "switch~"-object
*/
--- 16,21 ----
/* ------------------------ sigzero~ ----------------------------- */
/*
! a very useful function, which detects, whether a signal is zeroes-only this block or not
! this is really great together with the "switch~"-object
*/
***************
*** 27,89 ****
typedef struct _sigzero
{
! t_object x_obj;
! int activate;
! int current; /* 0 == (signalblock == 0); 1==(signalblock != 0) */
} t_sigzero;
static void sigzero_activate(t_sigzero *x, t_floatarg activate)
{
! x->activate = (activate)?1:0;
}
static void sigzero_banged(t_sigzero *x)
{
! x->activate = 1;
}
static void sigzero_off(t_sigzero *x)
{
! x->activate = 0;
}
static t_int *sigzero_perform(t_int *w)
{
! t_float *in = (t_float *)w[1];
! t_sigzero *x = (t_sigzero *)w[2];
! int n = (int)w[3];
! int non_zero = 0;
! if (x->activate) {
! while (n--)
! {
! if (*in++ != 0.) {
! non_zero = 1;
! break;
! }
! }
! if (non_zero != x->current) {
! outlet_float(x->x_obj.ob_outlet, x->current = non_zero);
! }
! // else post("non_zero=%d\tcurrent=%d", non_zero, x->current);
! }
! return (w+4);
}
static void sigzero_dsp(t_sigzero *x, t_signal **sp)
{
! dsp_add(sigzero_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
}
static void sigzero_tilde_helper(void)
{
! post("\n%c sigzero~-object :: for detecting whether a signal is currently zero or not", HEARTSYMBOL);
! post("'bang'\t: turn the detector on\n"
! "'off'\t: turn it off\n"
! "<1/0>\t: turn it on/off\n"
! "'help'\t: view this\n"
! "signal~");
! post("outlet :: 1/0\t: signal turned to non-zero/zero\n");
}
--- 27,88 ----
typedef struct _sigzero
{
! t_object x_obj;
! int activate;
! int current; /* 0 == (signalblock == 0); 1==(signalblock != 0) */
} t_sigzero;
static void sigzero_activate(t_sigzero *x, t_floatarg activate)
{
! x->activate = (activate)?1:0;
}
static void sigzero_banged(t_sigzero *x)
{
! x->activate = 1;
}
static void sigzero_off(t_sigzero *x)
{
! x->activate = 0;
}
static t_int *sigzero_perform(t_int *w)
{
! t_sample *in = (t_sample *)w[1];
! t_sigzero *x = (t_sigzero *)w[2];
! int n = (int)w[3];
! int non_zero = 0;
! if (x->activate) {
! while (n--)
! {
! if (*in++ != 0.) {
! non_zero = 1;
! break;
! }
! }
! if (non_zero != x->current) {
! outlet_float(x->x_obj.ob_outlet, x->current = non_zero);
! }
! }
! return (w+4);
}
static void sigzero_dsp(t_sigzero *x, t_signal **sp)
{
! dsp_add(sigzero_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
}
static void sigzero_tilde_helper(void)
{
! post("\n%c sigzero~-object :: for detecting whether a signal is currently zero or not", HEARTSYMBOL);
! post("'bang'\t: turn the detector on\n"
! "'off'\t: turn it off\n"
! "<1/0>\t: turn it on/off\n"
! "'help'\t: view this\n"
! "signal~");
! post("outlet :: 1/0\t: signal turned to non-zero/zero\n");
}
***************
*** 97,110 ****
void sigzero_tilde_setup(void)
{
! sigzero_class = class_new(gensym("sigzero~"), (t_newmethod)sigzero_new, 0,
! sizeof(t_sigzero), 0, 0);
! class_addfloat(sigzero_class, sigzero_activate);
! class_addbang(sigzero_class, sigzero_banged);
! class_addmethod(sigzero_class, (t_method)sigzero_off, gensym("off"), 0);
! class_addmethod(sigzero_class, nullfn, gensym("signal"), 0);
! class_addmethod(sigzero_class, (t_method)sigzero_dsp, gensym("dsp"), 0);
! class_addmethod(sigzero_class, (t_method)sigzero_tilde_helper, gensym("help"), 0);
zexy_register("sigzero~");
}
--- 96,109 ----
void sigzero_tilde_setup(void)
{
! sigzero_class = class_new(gensym("sigzero~"), (t_newmethod)sigzero_new, 0,
! sizeof(t_sigzero), 0, 0);
! class_addfloat(sigzero_class, sigzero_activate);
! class_addbang(sigzero_class, sigzero_banged);
! class_addmethod(sigzero_class, (t_method)sigzero_off, gensym("off"), 0);
! class_addmethod(sigzero_class, nullfn, gensym("signal"), 0);
! class_addmethod(sigzero_class, (t_method)sigzero_dsp, gensym("dsp"), 0);
! class_addmethod(sigzero_class, (t_method)sigzero_tilde_helper, gensym("help"), 0);
zexy_register("sigzero~");
}
Index: envrms~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/envrms~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** envrms~.c 14 Mar 2007 09:08:56 -0000 1.5
--- envrms~.c 30 Oct 2007 09:21:52 -0000 1.6
***************
*** 28,41 ****
typedef struct sigenvrms
{
! t_object x_obj; /* header */
! void *x_outlet; /* a "float" outlet */
! void *x_clock; /* a "clock" object */
! float *x_buf; /* a Hanning window */
! int x_phase; /* number of points since last output */
! int x_period; /* requested period of output */
! int x_realperiod; /* period rounded up to vecsize multiple */
! int x_npoints; /* analysis window size in samples */
! float x_result; /* result to output */
! float x_sumbuf[MAXOVERLAP]; /* summing buffer */
} t_sigenvrms;
--- 28,41 ----
typedef struct sigenvrms
{
! t_object x_obj; /* header */
! void *x_outlet; /* a "float" outlet */
! void *x_clock; /* a "clock" object */
! t_sample *x_buf; /* a Hanning window */
! int x_phase; /* number of points since last output */
! int x_period; /* requested period of output */
! int x_realperiod; /* period rounded up to vecsize multiple */
! int x_npoints; /* analysis window size in samples */
! t_float x_result; /* result to output */
! t_sample x_sumbuf[MAXOVERLAP]; /* summing buffer */
} t_sigenvrms;
***************
*** 44,137 ****
static void *sigenvrms_new(t_floatarg fnpoints, t_floatarg fperiod)
{
! int npoints = fnpoints;
! int period = fperiod;
! t_sigenvrms *x;
! float *buf;
! int i;
! if (npoints < 1) npoints = 1024;
! if (period < 1) period = npoints/2;
! if (period < npoints / MAXOVERLAP + 1)
! period = npoints / MAXOVERLAP + 1;
! if (!(buf = getbytes(sizeof(float) * (npoints + MAXVSTAKEN))))
{
! error("env: couldn't allocate buffer");
! return (0);
}
! x = (t_sigenvrms *)pd_new(sigenvrms_class);
! x->x_buf = buf;
! x->x_npoints = npoints;
! x->x_phase = 0;
! x->x_period = period;
! for (i = 0; i < MAXOVERLAP; i++) x->x_sumbuf[i] = 0;
! for (i = 0; i < npoints; i++)
! buf[i] = (1. - cos((2 * 3.141592654 * i) / npoints))/npoints;
! for (; i < npoints+MAXVSTAKEN; i++) buf[i] = 0;
! x->x_clock = clock_new(x, (t_method)sigenvrms_tick);
! x->x_outlet = outlet_new(&x->x_obj, gensym("float"));
! return (x);
}
static t_int *sigenvrms_perform(t_int *w)
{
! t_sigenvrms *x = (t_sigenvrms *)(w[1]);
! t_float *in = (t_float *)(w[2]);
! int n = (int)(w[3]);
! int count;
! float *sump;
! in += n;
! for (count = x->x_phase, sump = x->x_sumbuf;
! count < x->x_npoints; count += x->x_realperiod, sump++)
{
! float *hp = x->x_buf + count;
! float *fp = in;
! float sum = *sump;
! int i;
! for (i = 0; i < n; i++)
{
! fp--;
! sum += *hp++ * (*fp * *fp);
}
! *sump = sum;
}
! sump[0] = 0;
! x->x_phase -= n;
! if (x->x_phase < 0)
{
! x->x_result = x->x_sumbuf[0];
! for (count = x->x_realperiod, sump = x->x_sumbuf;
! count < x->x_npoints; count += x->x_realperiod, sump++)
! sump[0] = sump[1];
! sump[0] = 0;
! x->x_phase = x->x_realperiod - n;
! clock_delay(x->x_clock, 0L);
}
! return (w+4);
}
static void sigenvrms_dsp(t_sigenvrms *x, t_signal **sp)
{
! if (x->x_period % sp[0]->s_n) x->x_realperiod =
! x->x_period + sp[0]->s_n - (x->x_period % sp[0]->s_n);
! else x->x_realperiod = x->x_period;
! dsp_add(sigenvrms_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
! if (sp[0]->s_n > MAXVSTAKEN) bug("sigenvrms_dsp");
}
static void sigenvrms_tick(t_sigenvrms *x) /* callback function for the clock */
{
! outlet_float(x->x_outlet, sqrtf(x->x_result));
}
static void sigenvrms_ff(t_sigenvrms *x) /* cleanup on free */
{
! clock_free(x->x_clock);
! freebytes(x->x_buf, (x->x_npoints + MAXVSTAKEN) * sizeof(float));
}
static void sigenvrms_help(void)
{
! post("envrms~\t:: envelope follower that does output rms instead of dB");
}
--- 44,137 ----
static void *sigenvrms_new(t_floatarg fnpoints, t_floatarg fperiod)
{
! int npoints = fnpoints;
! int period = fperiod;
! t_sigenvrms *x;
! t_sample *buf;
! int i;
! if (npoints < 1) npoints = 1024;
! if (period < 1) period = npoints/2;
! if (period < npoints / MAXOVERLAP + 1)
! period = npoints / MAXOVERLAP + 1;
! if (!(buf = getbytes(sizeof(*buf) * (npoints + MAXVSTAKEN))))
{
! error("env: couldn't allocate buffer");
! return (0);
}
! x = (t_sigenvrms *)pd_new(sigenvrms_class);
! x->x_buf = buf;
! x->x_npoints = npoints;
! x->x_phase = 0;
! x->x_period = period;
! for (i = 0; i < MAXOVERLAP; i++) x->x_sumbuf[i] = 0;
! for (i = 0; i < npoints; i++)
! buf[i] = (1. - cos((2 * 3.141592654 * i) / npoints))/npoints;
! for (; i < npoints+MAXVSTAKEN; i++) buf[i] = 0;
! x->x_clock = clock_new(x, (t_method)sigenvrms_tick);
! x->x_outlet = outlet_new(&x->x_obj, &s_float);
! return (x);
}
static t_int *sigenvrms_perform(t_int *w)
{
! t_sigenvrms *x = (t_sigenvrms *)(w[1]);
! t_sample *in = (t_sample *)(w[2]);
! int n = (int)(w[3]);
! int count;
! t_sample *sump;
! in += n;
! for (count = x->x_phase, sump = x->x_sumbuf;
! count < x->x_npoints; count += x->x_realperiod, sump++)
{
! t_sample *hp = x->x_buf + count;
! t_sample *fp = in;
! t_sample sum = *sump;
! int i;
! for (i = 0; i < n; i++)
{
! fp--;
! sum += *hp++ * (*fp * *fp);
}
! *sump = sum;
}
! sump[0] = 0;
! x->x_phase -= n;
! if (x->x_phase < 0)
{
! x->x_result = x->x_sumbuf[0];
! for (count = x->x_realperiod, sump = x->x_sumbuf;
! count < x->x_npoints; count += x->x_realperiod, sump++)
! sump[0] = sump[1];
! sump[0] = 0;
! x->x_phase = x->x_realperiod - n;
! clock_delay(x->x_clock, 0L);
}
! return (w+4);
}
static void sigenvrms_dsp(t_sigenvrms *x, t_signal **sp)
{
! if (x->x_period % sp[0]->s_n) x->x_realperiod =
! x->x_period + sp[0]->s_n - (x->x_period % sp[0]->s_n);
! else x->x_realperiod = x->x_period;
! dsp_add(sigenvrms_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
! if (sp[0]->s_n > MAXVSTAKEN) bug("sigenvrms_dsp");
}
static void sigenvrms_tick(t_sigenvrms *x) /* callback function for the clock */
{
! outlet_float(x->x_outlet, sqrtf(x->x_result));
}
static void sigenvrms_ff(t_sigenvrms *x) /* cleanup on free */
{
! clock_free(x->x_clock);
! freebytes(x->x_buf, (x->x_npoints + MAXVSTAKEN) * sizeof(*x->x_buf));
}
static void sigenvrms_help(void)
{
! post("envrms~\t:: envelope follower that does output rms instead of dB");
}
***************
*** 139,148 ****
void envrms_tilde_setup(void)
{
! sigenvrms_class = class_new(gensym("envrms~"), (t_newmethod)sigenvrms_new,
! (t_method)sigenvrms_ff, sizeof(t_sigenvrms), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
! class_addmethod(sigenvrms_class, nullfn, gensym("signal"), 0);
! class_addmethod(sigenvrms_class, (t_method)sigenvrms_dsp, gensym("dsp"), 0);
! class_addmethod(sigenvrms_class, (t_method)sigenvrms_help, gensym("help"), 0);
zexy_register("envrms~");
}
--- 139,148 ----
void envrms_tilde_setup(void)
{
! sigenvrms_class = class_new(gensym("envrms~"), (t_newmethod)sigenvrms_new,
! (t_method)sigenvrms_ff, sizeof(t_sigenvrms), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
! class_addmethod(sigenvrms_class, nullfn, gensym("signal"), 0);
! class_addmethod(sigenvrms_class, (t_method)sigenvrms_dsp, gensym("dsp"), 0);
! class_addmethod(sigenvrms_class, (t_method)sigenvrms_help, gensym("help"), 0);
zexy_register("envrms~");
}
Index: abs~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/abs~.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** abs~.c 14 Mar 2007 09:08:55 -0000 1.4
--- abs~.c 30 Oct 2007 09:21:51 -0000 1.5
***************
*** 26,30 ****
{
t_object x_obj;
! float x_f;
} t_abs;
--- 26,30 ----
{
t_object x_obj;
! t_float x_f;
} t_abs;
***************
*** 36,41 ****
static t_int *sigABS_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
! t_float *out = (t_float *)(w[2]);
int n = (int)(w[3]);
--- 36,41 ----
static t_int *sigABS_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3]);
***************
*** 72,76 ****
* but still about 4* as fast as the generic code
* i prefer using intrinsics as i don't have to learn how to
! * assemble
*/
asm(
--- 72,76 ----
* but still about 4* as fast as the generic code
* i prefer using intrinsics as i don't have to learn how to
! * assembler
*/
asm(
***************
*** 120,129 ****
static void sigABS_dsp(t_abs *x, t_signal **sp)
{
- ZEXY_USEVAR(x);
#ifdef __SSE__
if(
Z_SIMD_CHKBLOCKSIZE(sp[0]->s_n)&&
Z_SIMD_CHKALIGN(sp[0]->s_vec)&&
! Z_SIMD_CHKALIGN(sp[1]->s_vec))
{
dsp_add(sigABS_performSSE, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
--- 120,130 ----
static void sigABS_dsp(t_abs *x, t_signal **sp)
{
#ifdef __SSE__
if(
Z_SIMD_CHKBLOCKSIZE(sp[0]->s_n)&&
Z_SIMD_CHKALIGN(sp[0]->s_vec)&&
! Z_SIMD_CHKALIGN(sp[1]->s_vec)&&
! ZEXY_TYPE_EQUAL(t_sample, float)
! )
{
dsp_add(sigABS_performSSE, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
Index: blockshuffle~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/blockshuffle~.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** blockshuffle~.c 14 Mar 2007 09:08:55 -0000 1.3
--- blockshuffle~.c 30 Oct 2007 09:21:51 -0000 1.4
***************
*** 68,72 ****
}
x->shufflesize=argc;
! x->shuffle=getbytes(sizeof(t_float)*argc);
for(i=0; i<argc; i++){
--- 68,72 ----
}
x->shufflesize=argc;
! x->shuffle=getbytes(sizeof(*x->shuffle)*argc);
for(i=0; i<argc; i++){
***************
*** 87,97 ****
if(idx){
! for(i=0; i<n; i++){
! temp[i]=in[idx[i]];
! }
! temp=x->blockbuf;
! for(i=0; i<n; i++){
! *out++=*temp++;
! }
} else
while(n--)*out++=*in++;
--- 87,97 ----
if(idx){
! for(i=0; i<n; i++){
! temp[i]=in[idx[i]];
! }
! temp=x->blockbuf;
! for(i=0; i<n; i++){
! *out++=*temp++;
! }
} else
while(n--)*out++=*in++;
***************
*** 115,121 ****
}
static void blockshuffle_free(t_blockshuffle *x){
! if(x->indices) freebytes(x->indices, sizeof(t_int) *x->size);
! if(x->blockbuf)freebytes(x->blockbuf, sizeof(t_sample)*x->size);
! if(x->shuffle) freebytes(x->shuffle, sizeof(t_float) *x->shufflesize);
}
--- 115,121 ----
}
static void blockshuffle_free(t_blockshuffle *x){
! if(x->indices) freebytes(x->indices, sizeof(*x->indices) *x->size);
! if(x->blockbuf)freebytes(x->blockbuf, sizeof(*x->blockbuf)*x->size);
! if(x->shuffle) freebytes(x->shuffle, sizeof(*x->shuffle) *x->shufflesize);
}
Index: sgn~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/sgn~.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** sgn~.c 14 Mar 2007 09:08:56 -0000 1.7
--- sgn~.c 30 Oct 2007 09:21:52 -0000 1.8
***************
*** 35,42 ****
static t_int *sgnTilde_perform(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
! t_float *out = (t_float *)(w[2]);
int n = (int)(w[3]);
! t_float x;
while (n--) {
if ((x=*in++)>0.) *out++=1.;
--- 35,42 ----
static t_int *sgnTilde_perform(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3]);
! t_sample x;
while (n--) {
if ((x=*in++)>0.) *out++=1.;
***************
*** 49,71 ****
static t_int *sgnTilde_perform8(t_int *w)
{
! t_float *in = (t_float *)(w[1]);
! t_float *out = (t_float *)(w[2]);
int n = (int)(w[3])>>3;
! t_float x;
! while(n--){
! /* weirdly enough, the if/else/if/else is a lot faster than ()?:(()?:) */
! if ((x=in[0])>0.) out[0]=1.; else if(x<0.) out[0]=-1.; else out[0]=0.;
! if ((x=in[1])>0.) out[1]=1.; else if(x<0.) out[1]=-1.; else out[1]=0.;
! if ((x=in[2])>0.) out[2]=1.; else if(x<0.) out[2]=-1.; else out[2]=0.;
! if ((x=in[3])>0.) out[3]=1.; else if(x<0.) out[3]=-1.; else out[3]=0.;
! if ((x=in[4])>0.) out[4]=1.; else if(x<0.) out[4]=-1.; else out[4]=0.;
! if ((x=in[5])>0.) out[5]=1.; else if(x<0.) out[5]=-1.; else out[5]=0.;
! if ((x=in[6])>0.) out[6]=1.; else if(x<0.) out[6]=-1.; else out[6]=0.;
! if ((x=in[7])>0.) out[7]=1.; else if(x<0.) out[7]=-1.; else out[7]=0.;
! in+=8;
! out+=8;
! }
return (w+4);
--- 49,71 ----
static t_int *sgnTilde_perform8(t_int *w)
{
! t_sample *in = (t_sample *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3])>>3;
! t_sample x;
! while(n--){
! /* weirdly enough, the if/else/if/else is a lot faster than ()?:(()?:) */
! if ((x=in[0])>0.) out[0]=1.; else if(x<0.) out[0]=-1.; else out[0]=0.;
! if ((x=in[1])>0.) out[1]=1.; else if(x<0.) out[1]=-1.; else out[1]=0.;
! if ((x=in[2])>0.) out[2]=1.; else if(x<0.) out[2]=-1.; else out[2]=0.;
! if ((x=in[3])>0.) out[3]=1.; else if(x<0.) out[3]=-1.; else out[3]=0.;
! if ((x=in[4])>0.) out[4]=1.; else if(x<0.) out[4]=-1.; else out[4]=0.;
! if ((x=in[5])>0.) out[5]=1.; else if(x<0.) out[5]=-1.; else out[5]=0.;
! if ((x=in[6])>0.) out[6]=1.; else if(x<0.) out[6]=-1.; else out[6]=0.;
! if ((x=in[7])>0.) out[7]=1.; else if(x<0.) out[7]=-1.; else out[7]=0.;
! in+=8;
! out+=8;
! }
return (w+4);
***************
*** 112,121 ****
static void sgnTilde_dsp(t_sgnTilde *x, t_signal **sp)
{
- ZEXY_USEVAR(x);
#ifdef __SSE__
if(
Z_SIMD_CHKBLOCKSIZE(sp[0]->s_n)&&
Z_SIMD_CHKALIGN(sp[0]->s_vec)&&
! Z_SIMD_CHKALIGN(sp[1]->s_vec))
{
dsp_add(sgnTilde_performSSE, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
--- 112,122 ----
static void sgnTilde_dsp(t_sgnTilde *x, t_signal **sp)
{
#ifdef __SSE__
if(
Z_SIMD_CHKBLOCKSIZE(sp[0]->s_n)&&
Z_SIMD_CHKALIGN(sp[0]->s_vec)&&
! Z_SIMD_CHKALIGN(sp[1]->s_vec)&&
! ZEXY_TYPE_EQUAL(t_sample, float) // currently SSE2 code is only for float (not for double)
! )
{
dsp_add(sgnTilde_performSSE, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
***************
*** 146,150 ****
{
sgnTilde_class = class_new(gensym("sgn~"), (t_newmethod)sgnTilde_new, 0,
! sizeof(t_sgnTilde), 0, A_DEFFLOAT, 0);
class_addmethod(sgnTilde_class, nullfn, gensym("signal"), 0);
class_addmethod(sgnTilde_class, (t_method)sgnTilde_dsp, gensym("dsp"), 0);
--- 147,151 ----
{
sgnTilde_class = class_new(gensym("sgn~"), (t_newmethod)sgnTilde_new, 0,
! sizeof(t_sgnTilde), 0, A_DEFFLOAT, 0);
class_addmethod(sgnTilde_class, nullfn, gensym("signal"), 0);
class_addmethod(sgnTilde_class, (t_method)sgnTilde_dsp, gensym("dsp"), 0);
Index: step~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/step~.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** step~.c 14 Mar 2007 09:08:56 -0000 1.4
--- step~.c 30 Oct 2007 09:21:52 -0000 1.5
***************
*** 15,27 ****
/*
! step~ : will make a unity step at a desired point in the signal-vector; the second input specifies a
! length: after the so-specified time has elapsed, the step will toggle back to the previous
! value;
! the length can be passed as an argument when creating the object
! with length==1 you might do the dirac~ thing a little bit more complicated
! with length==0 the output just toggles between 0 and 1 every time you bang the object
! NOTE : the inlets do NOT specify any times but sample-NUMBERS; there are 64 samples in a signal-vector,
! each "lasting" for 1/44100 secs.
*/
--- 15,27 ----
/*
! step~ : will make a unity step at a desired point in the signal-vector; the second input specifies a
! length: after the so-specified time has elapsed, the step will toggle back to the previous
! value;
! the length can be passed as an argument when creating the object
! with length==1 you might do the dirac~ thing a little bit more complicated
! with length==0 the output just toggles between 0 and 1 every time you bang the object
! NOTE : the inlets do NOT specify any times but sample-NUMBERS; there are 64 samples in a signal-vector,
! each "lasting" for 1/44100 secs.
*/
***************
*** 34,63 ****
typedef struct _step
{
! t_object x_obj;
! int position;
! int length;
! int toggle;
! int wait4start;
! int wait4stop;
} t_step;
static void step_bang(t_step *x)
{
! x->wait4stop = x->length + (x->wait4start = x->position);
}
static void step_float(t_step *x, t_float where)
{
! x->wait4stop = x->length +
! (x->wait4start =
! (x->position = (where>0)*where)
! );
}
static void step_setlength(t_step *x, t_float arg)
{
! x->length = 1 + (arg>0)*arg;
}
--- 34,63 ----
typedef struct _step
{
! t_object x_obj;
! int position;
! int length;
! int toggle;
! int wait4start;
! int wait4stop;
} t_step;
static void step_bang(t_step *x)
{
! x->wait4stop = x->length + (x->wait4start = x->position);
}
static void step_float(t_step *x, t_float where)
{
! x->wait4stop = x->length +
! (x->wait4start =
! (x->position = (where>0)*where)
! );
}
static void step_setlength(t_step *x, t_float arg)
{
! x->length = 1 + (arg>0)*arg;
}
***************
*** 66,96 ****
static t_int *step_perform(t_int *w)
{
! t_step *x = (t_step *)(w[1]);
! t_float *out = (t_float *)(w[2]);
! int n = (int)(w[3]);
! int toggle = x->toggle;
! int wait4start = x->wait4start, wait4stop = x->wait4stop;
! while (n--)
! {
! wait4stop--;
! if (!wait4start--) toggle ^= 1;
! else if (!wait4stop) toggle ^= 1;
! *out++ = toggle;
! }
! x->wait4start = wait4start;
! x->wait4stop = wait4stop;
! x->toggle = toggle;
! return (w+4);
}
static void step_dsp(t_step *x, t_signal **sp)
{
! dsp_add(step_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
}
--- 66,96 ----
static t_int *step_perform(t_int *w)
{
! t_step *x = (t_step *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
! int n = (int)(w[3]);
! int toggle = x->toggle;
! int wait4start = x->wait4start, wait4stop = x->wait4stop;
! while (n--)
! {
! wait4stop--;
! if (!wait4start--) toggle ^= 1;
! else if (!wait4stop) toggle ^= 1;
! *out++ = toggle;
! }
! x->wait4start = wait4start;
! x->wait4stop = wait4stop;
! x->toggle = toggle;
! return (w+4);
}
static void step_dsp(t_step *x, t_signal **sp)
{
! dsp_add(step_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
}
***************
*** 98,109 ****
static void step_helper(void)
{
! post("%c step~-object :: generates a unity-step", HEARTSYMBOL);
! post("creation : \"dirac~ [<position> [<length>]]\" : create a rectangular window\n"
! "\t\t\tat specified position and with specified length (in samples)\n"
! "inlet1\t: <position>\t: create a rectangular window at new position\n"
! "\t 'bang'\t: create a rectangular window at specified position\n"
! "\t 'help'\t: view this\n"
! "inlet2\t: <length>\t: define new window length ('0' will make a unity-step)\n"
! "outlet\t: signal~");
}
--- 98,109 ----
static void step_helper(void)
{
! post("%c step~-object :: generates a unity-step", HEARTSYMBOL);
! post("creation : \"dirac~ [<position> [<length>]]\" : create a rectangular window\n"
! "\t\t\tat specified position and with specified length (in samples)\n"
! "inlet1\t: <position>\t: create a rectangular window at new position\n"
! "\t 'bang'\t: create a rectangular window at specified position\n"
! "\t 'help'\t: view this\n"
! "inlet2\t: <length>\t: define new window length ('0' will make a unity-step)\n"
! "outlet\t: signal~");
}
***************
*** 111,139 ****
static void *step_new(t_floatarg farg)
{
! t_step *x = (t_step *)pd_new(step_class);
! inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1"));
! outlet_new(&x->x_obj, gensym("signal"));
! x->position = 0;
! x->wait4start = x->wait4stop = 0;
! x->toggle = 1;
! step_setlength(x, farg);
! return (x);
}
void step_tilde_setup(void)
{
! step_class = class_new(gensym("step~"), (t_newmethod)step_new, 0,
! sizeof(t_step), 0, A_DEFFLOAT, 0);
! class_addfloat(step_class, step_float);
! class_addbang(step_class, step_bang);
! class_addmethod(step_class, (t_method)step_setlength, gensym("ft1"), A_FLOAT, 0);
! class_addmethod(step_class, (t_method)step_dsp, gensym("dsp"), 0);
! class_addmethod(step_class, (t_method)step_helper, gensym("help"), 0);
zexy_register("step~");
--- 111,139 ----
static void *step_new(t_floatarg farg)
{
! t_step *x = (t_step *)pd_new(step_class);
! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
! outlet_new(&x->x_obj, &s_signal);
! x->position = 0;
! x->wait4start = x->wait4stop = 0;
! x->toggle = 1;
! step_setlength(x, farg);
! return (x);
}
void step_tilde_setup(void)
{
! step_class = class_new(gensym("step~"), (t_newmethod)step_new, 0,
! sizeof(t_step), 0, A_DEFFLOAT, 0);
! class_addfloat(step_class, step_float);
! class_addbang(step_class, step_bang);
! class_addmethod(step_class, (t_method)step_setlength, gensym("ft1"), A_FLOAT, 0);
! class_addmethod(step_class, (t_method)step_dsp, gensym("dsp"), 0);
! class_addmethod(step_class, (t_method)step_helper, gensym("help"), 0);
zexy_register("step~");
Index: multiline~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/multiline~.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** multiline~.c 14 Mar 2007 09:08:56 -0000 1.6
--- multiline~.c 30 Oct 2007 09:21:52 -0000 1.7
***************
*** 47,57 ****
t_float msec2tick;
! t_float *value;
! t_float *target;
! t_float *increment; /* single precision is really a bad */
! t_float **sigIN;
! t_float **sigOUT;
! t_float *sigBUF;
int sigNUM;
--- 47,57 ----
t_float msec2tick;
! t_sample *value;
! t_sample *target;
! t_sample *increment; /* single precision is really a bad */
! t_sample **sigIN;
! t_sample **sigOUT;
! t_sample *sigBUF;
int sigNUM;
***************
*** 104,113 ****
int n = (int)(w[2]);
! t_float **out = x->sigOUT;
! t_float **in = x->sigIN;
! t_float *buf = x->sigBUF, *sigBUF = buf;
! t_float *inc = x->increment, *increment = inc;
! t_float *val = x->value, *value = val;
! t_float *tgt = x->target, *target = tgt;
int sigNUM = x->sigNUM;
--- 104,113 ----
int n = (int)(w[2]);
! t_sample **out = x->sigOUT;
! t_sample **in = x->sigIN;
! t_sample *buf = x->sigBUF, *sigBUF = buf;
! t_sample *inc = x->increment, *increment = inc;
! t_sample *val = x->value, *value = val;
! t_sample *tgt = x->target, *target = tgt;
int sigNUM = x->sigNUM;
***************
*** 124,128 ****
if (x->ticksleft) {
int N=n-1;
! t_float oneovernos = 1./(x->ticksleft*n);
int i=sigNUM;
--- 124,128 ----
if (x->ticksleft) {
int N=n-1;
! t_sample oneovernos = 1./(x->ticksleft*n);
int i=sigNUM;
***************
*** 170,174 ****
{
int i = x->sigNUM, n = 0;
! t_float **dummy = x->sigIN;
while(i--)*dummy++=sp[n++]->s_vec;
--- 170,174 ----
{
int i = x->sigNUM, n = 0;
! t_sample **dummy = x->sigIN;
while(i--)*dummy++=sp[n++]->s_vec;
***************
*** 198,249 ****
static void *mline_new(t_symbol *s, int argc, t_atom *argv)
{
! t_mline *x = (t_mline *)pd_new(mline_class);
! int i;
! ZEXY_USEVAR(s);
! if (!argc) {
! argc = 1;
! x->time = 0;
! } else {
! x->time = atom_getfloat(argv+argc-1);
! if (x->time < 0) x->time = 0;
! argc--;
! if (!argc) argc = 1;
! }
! x->sigNUM = argc;
! i = argc-1;
! outlet_new(&x->x_obj, &s_signal);
! while (i--) {
! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
! outlet_new(&x->x_obj, &s_signal);
! }
! inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
! floatinlet_new(&x->x_obj, &x->time);
! x->sigIN = (t_float **)getbytes(x->sigNUM * sizeof(t_float **));
! x->sigOUT = (t_float **)getbytes(x->sigNUM * sizeof(t_float **));
! x->sigBUF = (t_float *)getbytes(x->sigNUM * sizeof(t_float *));
! x->value = (t_float *)getbytes(x->sigNUM * sizeof(t_float *));
! x->target = (t_float *)getbytes(x->sigNUM * sizeof(t_float *));
! x->increment = (t_float *)getbytes(x->sigNUM * sizeof(t_float *));
! i = x->sigNUM;
! while (i--) {
! x->sigIN[i] = x->sigOUT[i] = 0;
! x->increment[i] = 0;
! x->value[x->sigNUM-i-1] = x->target[x->sigNUM-i-1] = atom_getfloat(argv+i);
! }
! x->msec2tick = x->ticksleft = x->retarget = 0;
! return (x);
}
--- 198,249 ----
static void *mline_new(t_symbol *s, int argc, t_atom *argv)
{
! t_mline *x = (t_mline *)pd_new(mline_class);
! int i;
! ZEXY_USEVAR(s);
! if (!argc) {
! argc = 1;
! x->time = 0;
! } else {
! x->time = atom_getfloat(argv+argc-1);
! if (x->time < 0) x->time = 0;
! argc--;
! if (!argc) argc = 1;
! }
! x->sigNUM = argc;
! i = argc-1;
! outlet_new(&x->x_obj, &s_signal);
! while (i--) {
! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
! outlet_new(&x->x_obj, &s_signal);
! }
! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym(""));
! floatinlet_new(&x->x_obj, &x->time);
! x->sigIN = (t_sample **)getbytes(x->sigNUM * sizeof(t_sample **));
! x->sigOUT = (t_sample **)getbytes(x->sigNUM * sizeof(t_sample **));
! x->sigBUF = (t_sample *)getbytes(x->sigNUM * sizeof(t_sample *));
! x->value = (t_sample *)getbytes(x->sigNUM * sizeof(t_sample *));
! x->target = (t_sample *)getbytes(x->sigNUM * sizeof(t_sample *));
! x->increment = (t_sample *)getbytes(x->sigNUM * sizeof(t_sample *));
! i = x->sigNUM;
! while (i--) {
! x->sigIN[i] = x->sigOUT[i] = 0;
! x->increment[i] = 0;
! x->value[x->sigNUM-i-1] = x->target[x->sigNUM-i-1] = atom_getfloat(argv+i);
! }
! x->msec2tick = x->ticksleft = x->retarget = 0;
! return (x);
}
Index: noish~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/noish~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** noish~.c 14 Mar 2007 09:08:56 -0000 1.5
--- noish~.c 30 Oct 2007 09:21:52 -0000 1.6
***************
*** 42,49 ****
t_object x_obj;
int val;
! t_float current;
! t_float decrement;
! t_float updater;
! t_float to_go;
} t_nois;
--- 42,49 ----
t_object x_obj;
int val;
! t_sample current;
! t_sample decrement;
! t_sample updater;
! t_sample to_go;
} t_nois;
***************
*** 60,63 ****
--- 60,68 ----
+ static void set_noisseed(t_nois *x, t_floatarg seed)
+ {
+ x->val = seed;
+ }
+
/* ------------------------ noish~ ----------------------------- */
***************
*** 67,79 ****
{
t_nois *x = (t_nois *)(w[1]);
! t_float *out = (t_float *)(w[2]);
int n = (int)(w[3]);
int *vp = (int *)(&x->val);
int i_value = *vp;
! t_float f_value = ((float)((i_value & 0x7fffffff) - 0x40000000)) *
! (float)(1.0 / 0x40000000);
! t_float all_to_go = x->updater;
! t_float still_to_go = x->to_go;
if (all_to_go == 1)
--- 72,84 ----
{
t_nois *x = (t_nois *)(w[1]);
! t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3]);
int *vp = (int *)(&x->val);
int i_value = *vp;
! t_sample f_value = ((t_sample)((i_value & 0x7fffffff) - 0x40000000)) *
! (t_sample)(1.0 / 0x40000000);
! t_sample all_to_go = x->updater;
! t_sample still_to_go = x->to_go;
if (all_to_go == 1)
***************
*** 83,87 ****
i_value *= 435898247;
i_value += 382842987;
! *out++ = ((float)((i_value & 0x7fffffff) - 0x40000000)) * (float)(1.0 / 0x40000000);
}
}
--- 88,92 ----
i_value *= 435898247;
i_value += 382842987;
! *out++ = ((t_sample)((i_value & 0x7fffffff) - 0x40000000)) * (t_sample)(1.0 / 0x40000000);
}
}
***************
*** 108,112 ****
i_value *= 435898247;
i_value += 382842987;
! f_value = ( (float)((i_value & 0x7fffffff) - 0x40000000) ) * (float)(1.0 / 0x40000000);
while (n--)
--- 113,117 ----
i_value *= 435898247;
i_value += 382842987;
! f_value = ( (t_sample)((i_value & 0x7fffffff) - 0x40000000) ) * (t_sample)(1.0 / 0x40000000);
while (n--)
***************
*** 127,131 ****
i_value += 382842987;
! f_value = ( (float)((i_value & 0x7fffffff) - 0x40000000) ) * (float)(1.0 / 0x40000000);
}
*out++ = f_value;
--- 132,136 ----
i_value += 382842987;
! f_value = ( (t_sample)((i_value & 0x7fffffff) - 0x40000000) ) * (t_sample)(1.0 / 0x40000000);
}
*out++ = f_value;
***************
*** 180,183 ****
--- 185,190 ----
class_addmethod(noish_class, (t_method)noish_dsp, gensym("dsp"), 0);
+ class_addmethod(noish_class, (t_method)set_noisseed, gensym("seed"), A_FLOAT, 0);
+
class_addmethod(noish_class, (t_method)noish_helper, gensym("help"), 0);
zexy_register("noish~");
- Previous message: [PD-cvs] externals/zexy/src zexy.h,1.26,1.27
- Next message: [PD-cvs] externals/zexy/src atoi.c, 1.5, 1.6 demultiplex.c, 1.6, 1.7 fifop.c, 1.15, 1.16 length.c, 1.8, 1.9 lifop.c, 1.13, 1.14 lpt.c, 1.14, 1.15 matchbox.c, 1.6, 1.7 mavg.c, 1.5, 1.6 minmax.c, 1.6, 1.7 multiplex.c, 1.8, 1.9 regex.c, 1.9, 1.10 repack.c, 1.5, 1.6 sort.c, 1.8, 1.9 sum.c, 1.5, 1.6 urn.c, 1.6, 1.7 wrap.c, 1.8, 1.9 z~.c, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list