[LV2] LV2 Question

David Robillard d at drobilla.net
Thu Nov 21 21:04:46 PST 2013

On Thu, 2013-11-21 at 16:18 +0000, Harry van Haaren wrote:
> I agree that static variables are undesirable (although they served a
> > purpose in the pre C++ days). I just thought it might be weird to give the
> > host application access to the Multiverb object.
> >
> The host doesn't actually have access to the Multiverb object: it knows the
> plugin handle*, but nothing particular about it. The host won't interact
> with the plugin instance except for the LV2 specified callback functions.

This is the key.  The handle is an opaque pointer, you can make it
whatever you want.  It doesn't have to be a C struct with ports in it,
that's just what the examples do because they are simple C examples.

If you have a plugin implemented as a C++ class, a natural thing to do
would be to just stick everything in there, and the handle would be a
pointer to a new'd instance of your plugin class.  The handle is passed
as the first parameter to all the methods, so you can think of this as
OO without an implicit "this", sort of like how Python does it with
"self" as the first parameter (though you will need to cast, of course).


More information about the Devel mailing list