[LAD] "enhanced event port" LV2 extension proposal

Lars Luthman lars.luthman at gmail.com
Wed Dec 5 13:27:35 UTC 2007

On Wed, 2007-12-05 at 09:45 +0000, Krzysztof Foltman wrote:
> Lars Luthman wrote:
> > I don't like having something this complicated in an extension that is
> > going to be required if you just want to write a simple synth with a
> > MIDI input.
> Hey, it's simpler than it looks like. Especially when you're writing a
> plugin. All you need to do is do this during activation (C++ code):
> // assume you have the void* for the "registries feature" already
> IURIRegistries *registries = (IURIRegistries *)feature_value;
> IURIRegistry *registry =
> registries->get_registry("http://example.com/event_types_registry");
> if (registry) {
>   midi_event_id =
> registry->uri_to_id("http://example.com/midi_event_type", true);
> }

And with an array you'd have

const char* const* uris = feature_data;
for (uint16_t i = 0; uris[i]; ++i) {
  if (!strcmp(uris[i], midi_type_uri)) {
    midi_event_id = i;

The difference is not in the number of lines but in how many new
functions and types are used. The fewer the better. Sure, in practice
this will probably be done with a single function call to some plugin
support library, but the actual spec should still be as simple as

> > Is there really any need for adding and removing mappings dynamically?
> I think it is (especially adding). For inter-plugin communication - even
> when host doesn't support a specific plugin type, two connected plugins may.

If a plugin supports an event type (I assume that's what you meant) it
can list it in its RDF file, and then the host can map it and that
plugin will get an ID for that event type URI, regardless of whether the
host or any other loaded plugin supports that event type or not. Though
I don't think it's such a great idea to load plugins that need event
types that the host doesn't know anything about, for the reasons you
list below. If you want some sort of generic event where the host
doesn't need to bother with the actual content you could define a single
event type for that - maybe something like the refcounted objects you
talked about earlier.

> > Just passing an array in the LV2_Feature data would be enough for me.
> But then, how would you search the array if it had, say, 1000 items?
> Linear search with strcmp on each item?

Sure. It's just on instantiation. If you wanted to be smart you could
have the host sort the array and pass the size as well and let the
plugin do binary searches.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20071205/7625b929/attachment.pgp>

More information about the Linux-audio-dev mailing list