multislider like UI

Jan 20, 2011 at 4:48pm

multislider like UI

hello there,
first i want to thank everybody who helped me with my basic questions building my first GUI. i could not make it without this forum.
it seems to be ready and can be found here:

http://ppooll.klingt.org/index.php/max_externals

however here is my next Q:

i want to add list-abiltity to that UI and i am not sure which data-type is
best to make it going (lists of floats).
basically it should do the same as multislider (including pattr communication).
t_linklist seems to be the choice, right ?
what is used in multislider?

best
klaus

#54493
Jan 20, 2011 at 5:17pm

Hello Klaus Filip,

i’m not sure t_linklist is the best ; it depends of what kind of stuff (algorithm / operations) you want to do with your list ; you can use a t_atomarray, an array of atoms, an array of floats/doubles ; can you explain what your external will do … maybe a more “authorized” developper have a suggestion too ;-)

#196270
Jan 21, 2011 at 3:55pm

basically the external should do the same as a multislider.
(having the multislider.c as an example would save me a lot of time of course)
but it will have a few additions (as in ll_number),
like displaying the value as number,
allowing the arrow- and number keys for input
write labels in the slider. etc

#196271
Jan 21, 2011 at 5:11pm

multislider stores the values into an array of t_atom or double.

#196272
Jan 21, 2011 at 5:13pm

Hello,

IMHO : a t_atomarray if the size can be changed ; or an array of atoms if not.

Of course : a dev noob opinion ;-)

EDit : oops (marché sur les pieds d’EJ) …

#196273
Mar 25, 2011 at 9:02pm

hello again,
finally got some time left to resume on this project.

but i am still stuck on how to deal with lists.
namely how to put the correct pattr-comunication…
the following try is very close i guess, but crashes.

t_max_err MY_getvalueof(t_MY *x, long *ac, t_atom **av)
{
        short i;
	if (ac && av) {
		if (*ac && *av) {
			//memory passed in use it
		} else {
			*av = (t_atom *)getbytes(sizeof(t_atom)*x->listlen);
		}
		*ac = x->listlen;
		for (i=0; i < *ac; i++, av++) {
			atom_setfloat(*av,x->myval[i]);
		}
	}
	return MAX_ERR_NONE;
}

any advices??
thanks
klaus

#196274
Mar 25, 2011 at 9:18pm

Hi Klaus,

there are functions in the Max/MSP API that make this sort of thing a lot easier and less error prone…
I would do:

t_max_err MY_getvalueof(t_MY *x, long *ac, t_atom **av)
{
    if (ac && av) {
        char alloc;
        if (atom_alloc_array(x->listlen, ac, av, &alloc)) {
            return MAX_ERR_OUT_OF_MEM;
        }
        atom_setfloat_array(*ac, *av, x->listlen, x->myval);
    }
    return MAX_ERR_NONE;
}

Let me know if it works for you.

Cheers.

- Luigi

#196275
Mar 26, 2011 at 12:29am

yes worked,
thanks luigi.

i can tumble forward.
klaus

#196276

You must be logged in to reply to this topic.