Yep... thanks. Fixed in git - may take some time for me to get out a new compiled version (other stuff to fix too :)
M
On Fri, Sep 04, 2015 at 05:51:15PM -0400, Matt Barber wrote:
Hi list,
I've been playing around with the new(ish) [array] object suite in vanilla 0.46.6. Forgive me if this is already a known issue, but it looks like the min and max arguments aren't working properly.
The second inlet (setting the number of points to search) works as expected. The first inlet doesn't update: it seems to be set to 0 no matter what (although the index outlet is updated, but not as expected).
I think I see the problem in x_array.c
The max object is defined line 723:
typedef struct _array_max { t_array_rangeop x_rangeop; t_outlet *x_out1; /* value */ t_outlet *x_out2; /* index */ int x_onset; /* search onset */ } t_array_max;
And the bang and float methods starting 740:
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
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list