Re: [linux-audio-dev] LV2 library API

From: Dave Robillard <drobilla@email-addr-hidden>
Date: Thu Jun 01 2006 - 23:10:49 EEST

On Thu, 2006-06-01 at 09:42 +0100, Steve Harris wrote:
> On Tue, May 30, 2006 at 03:09:33 -0400, Dave Robillard wrote:
> > I'm a bit unhappy that it makes code longer and more messy though. The
> > primary design goal here is to make host code as terse and simple as
> > possible. strcmp'ing a string and then freeing it is quite a bit uglier
> > than just testing an enum val :/
>
> This is maybe a PITA, but what about a runtime provided enum list, like:
>
> foo_enum = { { FOO_FLOAT, LV2_FLOAT_URI },
> { FOO_MIDI, "http://example.org/datatypes/midi" },
> { 0, NULL } };
> lv2_set_urilist(foo_enum);
>
> the library can contain an builtin enum list that is set implictly, ie. it
> does lv2_set_urilist(lv2_internal_enum); when it starts.
>
> that way simple hosts can just use it as is, and more complex ones can
> specify the types they support, and everyone gets to use ints.

Hmm.. that's not a bad idea. The current API could remain unaffected
but still allow extension. OTOH, it's not really all that much better
from just returning a string, but I would like to avoid the strcmp and
free thing..

>From an (internal) code standpoint it will definitely be nicer that a
big if/else chain with the known URIs hardcoded in.

When I do more work on the static 'library state' stuff (eg
lv2_set_urilist, lv2_add_prefix, etc) I'll give it a shot and see how it
works out.

-DR-
Received on Fri Jun 2 00:15:03 2006

This archive was generated by hypermail 2.1.8 : Fri Jun 02 2006 - 00:15:03 EEST