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
??? 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
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.
--
FA
Io lo dico sempre: l'Italia è troppo stretta e lunga.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
LINUX® is a registered trademark of Linus Torvalds in the USA and other countries.
Linuxaudio.org logo copyright Thorsten Wilms © 2006.
Hosting provided by the Virginia Tech Department of Music and DISIS.