[LV2] --SPAM--::Re: [Devel] lv2_descriptor() considered harmful
Stefan Kersten
sk at k-hornz.de
Sun Feb 26 05:28:13 PST 2012
On 25.02.12 22:12, David Robillard wrote:
> On Sat, 2012-02-25 at 13:09 -0600, Gabriel M. Beddingfield wrote:
>> On 02/24/2012 05:58 PM, Martin wrote:
>>> apart from getting the bundle path it would also be useful to get the
>>> requested URI directly from the host (if possible).
>>>
>>> typedef int (*LV2_Init_Function)(const char* bundle_path,
>>> const char* plugin_URI,
>>> const LV2_Feature *const * features);
>>
>> This looks totally wrong. The intent for LV2_Init_Function is to
>> provide a /library/ constructor... to be executed after dlopen() opens
>> the so-file. It has nothing to do with any specific plugin URI... and
>> if it does, then that's a mistake. An individual plugin already has an
>> explicit init/deinit.
>>
>> For example... suppose that all your plugins use a Singleton logger or
>> some kind. You want it to be init'd on library load and destructed on
>> library close. ATM, the only way to do this is to make your plugin in
>> C++[1] or use compiler extensions.[2]
>
> Right, having the plugin URI as a parameter here makes no sense. I
> still prefer the original proposal that made a descriptor for the
> library which contains all the functions. Much nicer than relying on
> magical hidden data, IMO.
are you referring to the proposal in [1]? looks very good to me.
my use case is an extension that allows realtime-safe instantiation (and
destruction) of plugins. currently the interface to be provided by the plugin
via extension_data looks like this:
typedef struct
{
void (*initialize)(LV2_Descriptor * descriptor,
const char * bundle_path,
const LV2_Feature *const * features);
void (*release)(LV2_Descriptor * descriptor);
uint32_t (*instance_size)(const LV2_Descriptor * descriptor);
uint32_t (*instance_alignment)(const LV2_Descriptor * descriptor);
LV2_Handle (*instantiate)(const LV2_Descriptor * descriptor,
void * location,
double sample_rate);
} LV2_RT_Instantiate_Interface;
the main point here is that the host's feature set is required during library
(or descriptor) initialization, because potentially non-realtime-safe calls
(e.g. to the urid extension) cannot be made from within instantiate and their
results need to be cached beforehand.
<sk>
[1] http://lists.lv2plug.in/htdig.cgi/devel-lv2plug.in/2011-October/000059.html
More information about the Devel
mailing list