diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tabdump.c | 2 | ||||
-rw-r--r-- | src/tabminmax.c | 26 | ||||
-rw-r--r-- | src/tabset.c | 22 |
3 files changed, 32 insertions, 18 deletions
diff --git a/src/tabdump.c b/src/tabdump.c index 64207b6..824f483 100644 --- a/src/tabdump.c +++ b/src/tabdump.c @@ -54,7 +54,7 @@ static void tabdump_bang(t_tabdump *x) npoints=stop-start; atombuf = (t_atom *)getbytes(sizeof(t_atom)*npoints); - for (n = 0; n < npoints; n++) SETFLOAT(&atombuf[n], vec[start+n]); + for (n = 0; n < npoints; n++) SETFLOAT(&atombuf[n], zarray_getfloat(vec, start+n)); outlet_list(x->x_obj.ob_outlet, &s_list, npoints, atombuf); freebytes(atombuf,sizeof(t_atom)*npoints); } diff --git a/src/tabminmax.c b/src/tabminmax.c index 3e5dbf7..a7e622d 100644 --- a/src/tabminmax.c +++ b/src/tabminmax.c @@ -54,28 +54,28 @@ static void tabminmax_bang(t_tabminmax *x) if(stop<start||stop>npoints)stop=npoints; npoints=stop-start; - min=vec[start]; - max=vec[start]; + min=zarray_getfloat(vec, start); + max=min; mindex=start; maxdex=start; for (n = 1; n < npoints; n++){ - t_float val=vec[start+n]; - if(val<min){ - mindex=start+n; - min=val; - } - if(val>max){ - maxdex=start+n; - max=val; - } + t_float val=zarray_getfloat(vec, start+n); + if(val<min){ + mindex=start+n; + min=val; + } + if(val>max){ + maxdex=start+n; + max=val; + } } - + SETFLOAT(atombuf, max); SETFLOAT(atombuf+1, maxdex); outlet_list(x->max_out, &s_list, 2, atombuf); - + SETFLOAT(atombuf, min); SETFLOAT(atombuf+1, mindex); outlet_list(x->min_out, &s_list, 2, atombuf); diff --git a/src/tabset.c b/src/tabset.c index 5cd7844..c9a4687 100644 --- a/src/tabset.c +++ b/src/tabset.c @@ -40,7 +40,10 @@ static void tabset_float(t_tabset *x, t_floatarg f) else if (!zarray_getarray(A, &npoints, &vec)) error("%s: bad template for tabset", x->x_arrayname->s_name); else { - while(npoints--)*vec++=f; + while(npoints--){ + zarray_setfloat(vec, 0, f); + vec++; + } garray_redraw(A); } } @@ -58,11 +61,22 @@ static void tabset_list(t_tabset *x, t_symbol *s, int argc, t_atom* argv) error("%s: bad template for tabset", x->x_arrayname->s_name); else { if (argc>=npoints) - while(npoints--)*vec++=atom_getfloat(argv++); + while(npoints--){ + t_float f= atom_getfloat(argv++); + zarray_setfloat(vec, 0, f); + vec++; + } else { npoints-=argc; - while (argc--)*vec++=atom_getfloat(argv++); - while (npoints--)*vec++=0; + while (argc--){ + t_float f= atom_getfloat(argv++); + zarray_setfloat(vec, 0, f); + vec++; + } + while (npoints--){ + zarray_setfloat(vec, 0, 0); + vec++; + } } garray_redraw(A); } |