Re: [LAD] [RFC] LADSPA 1.2

From: Stefano D'Angelo <zanga.mail@email-addr-hidden>
Date: Thu Jun 18 2009 - 20:55:21 EEST

2009/6/18 Fons Adriaensen <fons@email-addr-hidden>:
> 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@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Fri Jun 19 00:15:02 2009

This archive was generated by hypermail 2.1.8 : Fri Jun 19 2009 - 00:15:02 EEST