multislider like UI


    Jan 20 2011 | 4:48 pm
    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:
    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

    • Jan 21 2011 | 3:55 pm
      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
    • Jan 21 2011 | 5:11 pm
      multislider stores the values into an array of t_atom or double.
    • Mar 25 2011 | 9:02 pm
      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
    • Mar 25 2011 | 9:18 pm
      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
    • Mar 26 2011 | 12:29 am
      yes worked,
      thanks luigi.
      i can tumble forward.
      klaus