[LV2] --SPAM--::Re: [Devel] lv2_descriptor() considered harmful

David Robillard d at drobilla.net
Mon Feb 27 15:36:58 PST 2012

On Mon, 2012-02-27 at 11:21 +0100, Stefan Kersten wrote:
> On 27.02.12 01:01, David Robillard wrote:
> [...]
> >> the idea is to keep instance creation overhead as low as possible; "placement"
> >> instantiation saves one call to the allocator and is possible for many plugins
> >> (in my case most of them generated by faust). an allocator feature still makes
> >> sense though, for plugins that don't know their memory requirements at compile time.
> > 
> > Fair enough (though it's just one function call). 
> it might be a relatively costly function call and a compact memory layout should
> also improve locality of reference.

Well, for former is the host's choice either way, really, but fair
enough.  No argument against the latter, flat blobs of data are
superior.  The problem is that this interface *only* works for plugins
where the entire instance is one flat blob of data.

Maybe that's not a problem since it's a good thing if you can achieve
it.  I'm not sure.  Just thinking out loud.

> > What do you need dynamic alignment for?
> it's probably not really needed (and not really dynamic), but since the instance
> is constructed within a larger block of memory along with some state and
> audio/control buffers, the `instance_alignment' function is supposed to return
> the required alignment of the structure in order to place it correctly into memory.

Difficult to realize portably.  Since it's not really dynamic and I'd
bet that you really just need a specific alignment (e.g. 64-bits for
SSE) I'd probably just make this a static rule.  Things being aligned to
64-bits is already established in LV2 land (events).

Some platforms, e.g. OSX, guarantee this for any malloc, so you don't
need to implement special alighment.

> >> yes. i've been rolling my own plugin API when i realized that LV2 does almost
> >> everything i need and is extensible enough to make it do virtually anything.
> >> good work!
> > 
> > Best to get along with others if at all possible :)
> yeah well, at the moment i am abusing LV2 as an internal plugin format for a
> specific host, but with the intention to be able to load "standard" LV2 plugins
> at some point ;)

Sure.  Ideally you should seek to eventually have it work the other way
around too, i.e. standardize the extensions so the plugins work in other
hosts as well.  If they are meaningful at all in other hosts, anyway.

I might have some personal self-interest in doing so (Ingen); what kind
of plugins are you making here?



More information about the Devel mailing list