<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Thanks.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I meant to say that there was the same problem in [array min], but you probably caught it in your fix.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Best,</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Matt</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 4, 2015 at 7:19 PM, Miller Puckette <span dir="ltr"><<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yep... thanks.  Fixed in git - may take some time for me to get out a new<br>
compiled version (other stuff to fix too :)<br>
<br>
M<br>
<div><div class="h5"><br>
<br>
On Fri, Sep 04, 2015 at 05:51:15PM -0400, Matt Barber wrote:<br>
> Hi list,<br>
><br>
> I've been playing around with the new(ish) [array] object suite in vanilla<br>
> 0.46.6. Forgive me if this is already a known issue, but it looks like the<br>
> min and max arguments aren't working properly.<br>
><br>
> The second inlet (setting the number of points to search) works as<br>
> expected. The first inlet doesn't update: it seems to be set to 0 no matter<br>
> what (although the index outlet is updated, but not as expected).<br>
><br>
> I think I see the problem in x_array.c<br>
><br>
> The max object is defined line 723:<br>
><br>
> typedef struct _array_max<br>
> {<br>
>     t_array_rangeop x_rangeop;<br>
>     t_outlet *x_out1;       /* value */<br>
>     t_outlet *x_out2;       /* index */<br>
>     int x_onset;            /* search onset */<br>
> } t_array_max;<br>
><br>
><br>
> And the bang and float methods starting 740:<br>
><br>
> static void array_max_bang(t_array_max *x)<br>
> {<br>
>     char *itemp, *firstitem;<br>
>     int stride, nitem, i, besti;<br>
>     t_float bestf;<br>
>     if (!array_rangeop_getrange(&x->x_rangeop, &firstitem, &nitem, &stride))<br>
>         return;<br>
>     for (i = 0, besti = 0, bestf= -1e30, itemp = firstitem;<br>
>         i < nitem; i++, itemp += stride)<br>
>             if (*(t_float *)itemp > bestf)<br>
>                 bestf = *(t_float *)itemp, besti = i;<br>
>     outlet_float(x->x_out2, besti+x->x_onset);<br>
>     outlet_float(x->x_out1, bestf);<br>
> }<br>
><br>
> static void array_max_float(t_array_max *x, t_floatarg f)<br>
> {<br>
>     x->x_onset = f;<br>
>     array_max_bang(x);<br>
> }<br>
><br>
><br>
> In the float method it looks like the onset is never actually assigned in<br>
> the x_rangeop member of the t_array_max struct, so array_rangeop_getrange<br>
> can't set the firstitem pointer to anything but its init value.<br>
><br>
><br>
> Thanks,<br>
><br>
> Matt<br>
<br>
</div></div>> _______________________________________________<br>
> <a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
> UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
<br>
</blockquote></div><br></div>