This is a template base class for LV2 plugins. It has default implementations for all functions, so you only have to implement the functions that you need (for example run()). All subclasses must have a constructor whose signature matches the one in the example code below, otherwise it will not work with the register_class() function. The host will use this double parameter to pass the sample rate that the plugin should run at when it creates a new instance of the plugin.

This is a template so that simulated dynamic binding can be used for the callbacks. This is not all that useful for simple plugins but it may come in handy when using mixins and it doesn't add any additional vtable lookup and function call costs, like real dynamic binding would.

If the above code is compiled and linked with -llv2_plugin into a shared module, it could form the shared object part of a fully functional (but not very useful) LV2 plugin with one audio input port and one audio output port that just copies the input to the output.

You can extend your plugin classes, for example adding support for LV2 extensions, by passing mixin classes as template parameters to Plugin (second template parameter and onwards).

If you want to write a synth plugin you should probably inherit the Synth class instead of this one.

This constructor is needed to initialise the port vector with the correct number of ports, and to check if all the required features are provided. This must be called as the first item in the initialiser list for your plugin class.

Use this function to register your plugin class so that the host can find it. You need to do this when the shared library is loaded by the host. One portable way of doing that is to put the function call in the initialiser for a global variable, like this:

Sets the OK state of the plugin. If it's true (which is the default) the plugin has been instantiated OK, if false it has not and the host will discard it. You can call this in the constructor for your plugin class if you need to check some condition that isn't taken care of by a mixin.

Parameters:

ok

True if the plugin instance is OK and can be used, false if it should be discarded.

The documentation for this class was generated from the following file: