Skip to content

Commit 6578bf4

Browse files
committed
fix zl.group/stream
1 parent 6eee98f commit 6578bf4

File tree

1 file changed

+17
-3
lines changed
  • cyclone_objects/binaries/control

1 file changed

+17
-3
lines changed

cyclone_objects/binaries/control/zl.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,12 @@ static int zl_equal(t_atom *ap1, t_atom *ap2){
255255
}
256256

257257
static void zl_sizecheck(t_zl *x, int size){
258-
if (x->x_modearg > size) x->x_modearg = size;
258+
if (x->x_modearg > size) {
259+
x->x_modearg = size;
260+
// Clear any existing data that might be beyond the new size
261+
if (x->x_outbuf1.d_natoms > size)
262+
x->x_outbuf1.d_natoms = size;
263+
}
259264
}
260265

261266
static void zl_swap(t_atom *av, int i, int j) {
@@ -1462,8 +1467,17 @@ static int zl_modeargfn(t_zl *x){
14621467
static void zl_setmodearg(t_zl *x, t_symbol *s, int ac, t_atom *av){
14631468
if(zl_intargfn[x->x_mode]){
14641469
int i;
1465-
if(zl_modesym[x->x_mode] == gensym("group") && !ac)
1466-
i = ZL_DEF_SIZE;
1470+
if(zl_modesym[x->x_mode] == gensym("group")
1471+
|| zl_modesym[x->x_mode] == gensym("stream")){
1472+
if(ac >= 1 && av->a_type == A_FLOAT){
1473+
int f = (int)av->a_w.w_float;
1474+
if f > x->x_outbuf1.d_max)
1475+
f = x->x_outbuf1.d_max;
1476+
i = f;
1477+
}
1478+
else
1479+
i = 0;
1480+
}
14671481
else
14681482
i = (!s && ac && av->a_type == A_FLOAT ?
14691483
(int)av->a_w.w_float : /* CHECKED silent truncation */

0 commit comments

Comments
 (0)