static void array_max_bang(t_array_max *x)
{
char *itemp, *firstitem;
int stride, nitem, i, besti;
t_float bestf;
if (!array_rangeop_getrange(&x->x_rangeop, &firstitem, &nitem, &stride))
return;
for (i = 0, besti = 0, bestf= -1e30, itemp = firstitem;
i < nitem; i++, itemp += stride)
if (*(t_float *)itemp > bestf)
bestf = *(t_float *)itemp, besti = i;
outlet_float(x->x_out2, besti+x->x_onset);
outlet_float(x->x_out1, bestf);
}
static void array_max_float(t_array_max *x, t_floatarg f)
{
x->x_onset = f;
array_max_bang(x);
}
In the float method it looks like the onset is never actually assigned in the x_rangeop member of the t_array_max struct, so array_rangeop_getrange can't set the firstitem pointer to anything but its init value.
Thanks,
Matt