2009/6/18 Fons Adriaensen <f...@kokkinizita.net>: > On Thu, Jun 18, 2009 at 06:28:32PM +0200, Jörn Nettingsmeier wrote: > >> 2. addition of a port range hint flag LADSPA_HINT_ENUMERATED to inform >> hosts that an integer-type port (as denoted by LADSPA_HINT_INTEGER) >> should be annotated with a set of labels rather than numbers. >> >> LADSPA_HINT_ENUMERATED mandates the following: >> LADSPA_HINT_INTEGER is set. >> LADSPA_HINT_BOUNDED_BELOW and LADSPA_HINT_BOUNDED_ABOVE must be set. >> in LADSPA_PortRangeHint, LowerBound must be 0, UpperBound must be >0. >> the number of labels provided must be equal to (UpperBound - 1). > > ??? This should be (UpperBound + 1) AFAICS > > Example: legal values = 0,1,2,3,4 > > Upperbound = 4, number of labels = 5 > > >> some of these mandatory settings are redundant and could be handled >> as being implicit. >> however, for the sake of backwards compatibility and to to allow >> older hosts to display a meaningful UI even if they don't implement >> the new flag yet, all these items MUST be set. >> >> as to the location of the actual enum of labels: fons adriaensen >> suggests adding them to the end of the PortNames array. >> this implies that for multiple enum-labelled controls, the labels >> would have to be concatenated and the host would have to tell them >> apart by keeping track of the corresponding UpperBound offsets, which >> might become a little messy. your comments are welcome. > > This makes is backwards compatible, as no new field is required > in the descriptor struct. > > Host will need to use the value (UpperBound + 1) no matter > where these strings get stored. A host looping over the port > data should just initialise a pointer: > > const char **enum_labels = descriptor->PortNames + descriptor->PortCount; > > for (i = 0; i < descriptor->PortCount; i++) > { > // ... > if (enum_hint_is_set) > { > int nlabels = upperbound + 1; > // Copy 'nlabels' and 'enum_labels' to where you want > // them, normally something representing the widget. > // Copy the strings to the widget if necessary. > enum_labels += nlabels; > } > // ... > } > > And that's all. The loop and everything in it, the 'if', > the 'nlabels' and the commented parts will be needed anyway, > the only 'typical' code are the two lines initialising and > incrementing 'enum_labels'. I don't think it could be any > simpler.
Ahem... this is not so simple on both plugin and host side IMO, and would make the API less usable for people who don't make a living out of C programming.... another possible (and better IMO) solution is already available: LRDF. We already have enumerated port values for LADSPA there. Stefano _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev