aboutsummaryrefslogtreecommitdiff
path: root/pd/src/d_array.c
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2004-11-11 04:58:21 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2004-11-11 04:58:21 +0000
commit6e17759e69d5d51bafebc4e5e44e1ee5dbaf58fe (patch)
treeae58db56873db98e0255a0a33c431bb14b51192b /pd/src/d_array.c
parent7ca685c4bc0b2881555f317db6408ae488fe05aa (diff)
More bug fixes... version 0.38 test10.
svn path=/trunk/; revision=2259
Diffstat (limited to 'pd/src/d_array.c')
-rw-r--r--pd/src/d_array.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/pd/src/d_array.c b/pd/src/d_array.c
index 38beff5d..d9f9d280 100644
--- a/pd/src/d_array.c
+++ b/pd/src/d_array.c
@@ -792,6 +792,7 @@ typedef struct _tabreceive
{
t_object x_obj;
float *x_vec;
+ int x_vecsize;
t_symbol *x_arrayname;
} t_tabreceive;
@@ -801,7 +802,15 @@ static t_int *tabreceive_perform(t_int *w)
t_float *out = (t_float *)(w[2]);
int n = w[3];
t_float *from = x->x_vec;
- if (from) while (n--) *out++ = *from++;
+ if (from)
+ {
+ int vecsize = x->x_vecsize;
+ while (vecsize--)
+ *out++ = *from++;
+ vecsize = n - x->x_vecsize;
+ while (vecsize--)
+ *out++ = 0;
+ }
else while (n--) *out++ = 0;
return (w+4);
}
@@ -809,21 +818,19 @@ static t_int *tabreceive_perform(t_int *w)
static void tabreceive_dsp(t_tabreceive *x, t_signal **sp)
{
t_garray *a;
- int vecsize;
-
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
{
if (*x->x_arrayname->s_name)
pd_error(x, "tabsend~: %s: no such array", x->x_arrayname->s_name);
}
- else if (!garray_getfloatarray(a, &vecsize, &x->x_vec))
+ else if (!garray_getfloatarray(a, &x->x_vecsize, &x->x_vec))
pd_error(x, "%s: bad template for tabreceive~", x->x_arrayname->s_name);
else
{
- int n = sp[0]->s_n;
- if (n < vecsize) vecsize = n;
+ if (x->x_vecsize > sp[0]->s_n)
+ x->x_vecsize = sp[0]->s_n;
garray_usedindsp(a);
- dsp_add(tabreceive_perform, 3, x, sp[0]->s_vec, vecsize);
+ dsp_add(tabreceive_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
}
}