#include <lv2.h>
#include <gtk/gtkwidget.h>
Go to the source code of this file.
Data Structures | |
struct | _LV2UI_Descriptor |
Typedefs | |
typedef void * | LV2UI_Handle |
This handle indicates a particular instance of a GUI. | |
typedef void * | LV2UI_Controller |
This handle indicates a particular plugin instance, provided by the host. | |
typedef void(*) | LV2UI_Set_Control_Function (LV2UI_Controller controller, uint32_t port, float value) |
This is the type of the host-provided function that changes the value of a control rate float input port in a plugin instance. | |
typedef _LV2UI_Descriptor | LV2UI_Descriptor |
typedef const LV2UI_Descriptor *(*) | LV2UI_DescriptorFunction (uint32_t index) |
This is the type of the lv2ui_descriptor() function. | |
Functions | |
const LV2UI_Descriptor * | lv2ui_descriptor (uint32_t index) |
Accessing a plugin GUI. |
The GUIs will be plugins that will reside in shared object files in a LV2 bundle and be referenced in the RDF file using the triples
<http://my.plugin> <http://ll-plugins.nongnu.org/lv2/ext/gtk2gui#gui> <http://my.plugingui> <http://my.plugingui> <http://ll-plugins.nongnu.org/lv2/ext/gtk2gui#binary> <mygui.so>where <http://my.plugin> is the URI of the plugin, <http://my.plugingui> is the URI of the plugin GUI and <mygui.so> is the relative URI to the shared object file. While it is possible to have the plugin GUI and the plugin in the same shared object file it is probably a good idea to keep them separate so that hosts that don't want GUIs don't have to load the GUI code.
It's entirely possible to have multiple GUIs for the same plugin, or to have the GUI for a plugin in a different bundle from the actual plugin - this way people other than the plugin author can write plugin GUIs independently without editing the original plugin bundle. If a GUI is in a separate bundle the first triple above should be in that bundle's manifest.ttl file so that hosts can find the GUI when scanning the manifests.
Note that the process that loads the shared object file containing the GUI code and the process that loads the shared object file containing the actual plugin implementation does not have to be the same. There are many valid reasons for having the plugin and the GUI in different processes, or even on different machines. This means that you can _not_ use singletons and global variables and expect them to refer to the same objects in the GUI and the actual plugin. The function callback interface defined in this header is all you can expect to work.
Since the LV2 specification itself allows for extensions that may add new types of data and configuration parameters that plugin authors may want to control with a GUI, this extension allows for meta-extensions that can extend the interface between the GUI and the host. See the instantiate() and extension_data() callback pointers for more details.
Note that this extension is NOT a Host Feature. There is no way for a plugin to know whether the host that loads it supports GUIs or not, and the plugin must ALWAYS work without the GUI (although it may be rather useless unless it has been configured using the GUI in a previous session).
GUIs written to this specification do not need to be threadsafe - the functions defined below may only be called in the same thread as the GTK main loop is running in.
typedef void* LV2UI_Controller |
This handle indicates a particular plugin instance, provided by the host.
It is valid to compare this to NULL (0 for C++) but otherwise the GUI plugin MUST not attempt to interpret it. The host may use it to reference internal instance data.
typedef struct _LV2UI_Descriptor LV2UI_Descriptor |
typedef const LV2UI_Descriptor*(*) LV2UI_DescriptorFunction(uint32_t index) |
This is the type of the lv2ui_descriptor() function.
typedef void* LV2UI_Handle |
This handle indicates a particular instance of a GUI.
It is valid to compare this to NULL (0 for C++) but otherwise the host MUST not attempt to interpret it. The GUI plugin may use it to reference internal instance data.
typedef void(*) LV2UI_Set_Control_Function(LV2UI_Controller controller, uint32_t port, float value) |
This is the type of the host-provided function that changes the value of a control rate float input port in a plugin instance.
A function pointer of this type will be provided to the GUI bu the host in the instantiate() function.
const LV2UI_Descriptor* lv2ui_descriptor | ( | uint32_t | index | ) |
Accessing a plugin GUI.
A plugin programmer must include a function called "lv2ui_descriptor" with the following function prototype within the shared object file. This function will have C-style linkage (if you are using C++ this is taken care of by the 'extern "C"' clause at the top of the file). This function will be accessed by the GUI host using the dlsym()
function and called to get a LV2UI_UIDescriptor for the wanted plugin.
Just like lv2_descriptor(), this function takes an index parameter. The index should only be used for enumeration and not as any sort of ID number - the host should just iterate from 0 and upwards until the function returns NULL, or a descriptor with an URI matching the one the host is looking for is returned.