| lv2_ui.h | | lv2_ui.h | |
| /************************************************************************ | | /************************************************************************ | |
| * | | * | |
| * In-process UI extension for LV2 | | * In-process UI extension for LV2 | |
| * | | * | |
|
| * Copyright (C) 2006-2007 Lars Luthman <lars.luthman@gmail.com> | | * Copyright (C) 2006-2008 Lars Luthman <lars.luthman@gmail.com> | |
| * | | * | |
| * Based on lv2.h, which was | | * Based on lv2.h, which was | |
| * | | * | |
| * Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis, | | * Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis, | |
| * Stefan Westerfeld | | * Stefan Westerfeld | |
| * Copyright (C) 2006 Steve Harris, Dave Robillard. | | * Copyright (C) 2006 Steve Harris, Dave Robillard. | |
| * | | * | |
| * This header is free software; you can redistribute it and/or modify it | | * This header is free software; you can redistribute it and/or modify it | |
| * under the terms of the GNU Lesser General Public License as published | | * under the terms of the GNU Lesser General Public License as published | |
| * by the Free Software Foundation; either version 2.1 of the License, | | * by the Free Software Foundation; either version 2.1 of the License, | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| * USA. | | * USA. | |
| * | | * | |
| ***********************************************************************/ | | ***********************************************************************/ | |
| | | | |
| /** @file | | /** @file | |
| This extension defines an interface that can be used in LV2 plugins and | | This extension defines an interface that can be used in LV2 plugins and | |
| hosts to create UIs for plugins. The UIs are plugins that reside in | | hosts to create UIs for plugins. The UIs are plugins that reside in | |
| shared object files in an LV2 bundle and are referenced in the RDF data | | shared object files in an LV2 bundle and are referenced in the RDF data | |
| using the triples (Turtle shown) | | using the triples (Turtle shown) | |
| <pre> | | <pre> | |
|
| @@prefix uiext: <http://ll-plugins.nongnu.org/lv2/ext/ui#> . | | @@prefix uiext: <http://lv2plug.in/ns/extensions/ui#> . | |
| <http://my.plugin> uiext:ui <http://my.pluginui> . | | <http://my.plugin> uiext:ui <http://my.pluginui> . | |
| <http://my.plugin> a uiext:GtkUI . | | <http://my.plugin> a uiext:GtkUI . | |
| <http://my.pluginui> uiext:binary <myui.so> . | | <http://my.pluginui> uiext:binary <myui.so> . | |
| </pre> | | </pre> | |
| where <http://my.plugin> is the URI of the plugin, <http://my.pluginui>
is | | where <http://my.plugin> is the URI of the plugin, <http://my.pluginui>
is | |
| the URI of the plugin UI and <myui.so> is the relative URI to the share
d | | the URI of the plugin UI and <myui.so> is the relative URI to the share
d | |
| object file. While it is possible to have the plugin UI and the plugin
in | | object file. While it is possible to have the plugin UI and the plugin
in | |
| the same shared object file it is probably a good idea to keep them | | the same shared object file it is probably a good idea to keep them | |
| separate so that hosts that don't want UIs don't have to load the UI co
de. | | separate so that hosts that don't want UIs don't have to load the UI co
de. | |
|
| A UI MUST specify its class in the RDF data. In this case the class is | | A UI MUST specify its class in the RDF data, in this case uiext:GtkUI. | |
| uiext:GtkUI, which is the only class defined by this extension. | | The | |
| | | class defines what type the UI is, e.g. what graphics toolkit it uses. | |
| | | There are no UI classes defined in this extension, those are specified | |
| | | separately (and anyone can define their own). | |
| | | | |
| (Note: the prefix above is used throughout this file for the same URI) | | (Note: the prefix above is used throughout this file for the same URI) | |
| | | | |
| It's entirely possible to have multiple UIs for the same plugin, or to
have | | It's entirely possible to have multiple UIs for the same plugin, or to
have | |
| the UI for a plugin in a different bundle from the actual plugin - this | | the UI for a plugin in a different bundle from the actual plugin - this | |
| way people other than the plugin author can write plugin UIs independen
tly | | way people other than the plugin author can write plugin UIs independen
tly | |
| without editing the original plugin bundle. | | without editing the original plugin bundle. | |
| | | | |
| Note that the process that loads the shared object file containing the
UI | | Note that the process that loads the shared object file containing the
UI | |
| code and the process that loads the shared object file containing the | | code and the process that loads the shared object file containing the | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 82 | |
| "features" that you declare in the RDF data for the UI as | | "features" that you declare in the RDF data for the UI as | |
| <pre> | | <pre> | |
| <http://my.pluginui> uiext:requiredFeature <http://my.feature> . | | <http://my.pluginui> uiext:requiredFeature <http://my.feature> . | |
| <http://my.pluginui> uiext:optionalFeature <http://my.feature> . | | <http://my.pluginui> uiext:optionalFeature <http://my.feature> . | |
| </pre> | | </pre> | |
| These predicates have the same semantics as lv2:requiredFeature and | | These predicates have the same semantics as lv2:requiredFeature and | |
| lv2:optionalFeature - if a UI is declaring a feature as required, the | | lv2:optionalFeature - if a UI is declaring a feature as required, the | |
| host is NOT allowed to load it unless it supports that feature, and if
it | | host is NOT allowed to load it unless it supports that feature, and if
it | |
| does support a feature (required or optional) it MUST pass that feature
's | | does support a feature (required or optional) it MUST pass that feature
's | |
| URI and any additional data (specified by the meta-extension that defin
es | | URI and any additional data (specified by the meta-extension that defin
es | |
|
| the feature) to the UI's instantiate() function. | | the feature) in a LV2_Feature struct (as defined in lv2.h) to the UI's | |
| | | instantiate() function. | |
| | | | |
| These features may be used to specify how to pass data between the UI | | These features may be used to specify how to pass data between the UI | |
| and the plugin port buffers - see LV2UI_Write_Function for details. | | and the plugin port buffers - see LV2UI_Write_Function for details. | |
| | | | |
|
| | | There are four features defined in this extension that hosts may want t | |
| | | o | |
| | | implement: | |
| | | | |
| | | <pre> | |
| | | uiext:makeResident | |
| | | </pre> | |
| | | If this feature is required by a UI the host MUST NEVER unload the shar | |
| | | ed | |
| | | library containing the UI implementation during the lifetime of the hos | |
| | | t | |
| | | process (e.g. never calling dlclose() on Linux). This feature may be | |
| | | needed by e.g. a Gtk UI that registers its own Glib types using | |
| | | g_type_register_static() - if it gets unloaded and then loaded again th | |
| | | e | |
| | | type registration will break, since there is no way to unregister the | |
| | | types when the library is unloaded. The data pointer in the LV2_Feature | |
| | | for this feature should always be set to NULL. | |
| | | | |
| | | <pre> | |
| | | uiext:makeSONameResident | |
| | | </pre> | |
| | | This feature is ELF specific - it should only be used by UIs that | |
| | | use the ELF file format for the UI shared object files (e.g. on Linux). | |
| | | If it is required by an UI the UI should also list a number of SO names | |
| | | (shared object names) for libraries that the UI shared object | |
| | | depends on and that may not be unloaded during the lifetime of the host | |
| | | process, using the predicate @c uiext:residentSONames, like this: | |
| | | <pre> | |
| | | <http://my.pluginui> uiext:residentSONames "libgtkmm-2.4.so.1", "libfoo | |
| | | .so.0" | |
| | | </pre> | |
| | | The host MUST then make sure that the shared libraries with the given E | |
| | | LF | |
| | | SO names are not unloaded when the plugin UI is, but stay loaded during | |
| | | the entire lifetime of the host process. On Linux this can be accomplis | |
| | | hed | |
| | | by calling dlopen() on the shared library file with that SO name and ne | |
| | | ver | |
| | | calling a matching dlclose(). However, if a plugin UI requires the | |
| | | @c uiext:makeSONameResident feature, it MUST ALWAYS be safe for the hos | |
| | | t to | |
| | | just never unload the shared object containing the UI implementation, i | |
| | | .e. | |
| | | act as if the UI required the @c uiext:makeResident feature instead. Th | |
| | | us | |
| | | the host only needs to find the shared library files corresponding to t | |
| | | he | |
| | | given SO names if it wants to save RAM by unloading the UI shared objec | |
| | | t | |
| | | file when it is no longer needed. The data pointer for the LV2_Feature | |
| | | for | |
| | | this feature should always be set to NULL. | |
| | | | |
| | | <pre> | |
| | | uiext:noUserResize | |
| | | </pre> | |
| | | If an UI requires this feature it indicates that it does not make sense | |
| | | to let the user resize the main widget, and the host should prevent tha | |
| | | t. | |
| | | This feature may not make sense for all UI types. The data pointer for | |
| | | the | |
| | | LV2_Feature for this feature should always be set to NULL. | |
| | | | |
| | | <pre> | |
| | | uiext:fixedSize | |
| | | </pre> | |
| | | If an UI requires this feature it indicates the same thing as | |
| | | uiext:noUserResize, and additionally it means that the UI will not resi | |
| | | ze | |
| | | the main widget on its own - it will always remain the same size (e.g. | |
| | | a | |
| | | pixmap based GUI). This feature may not make sense for all UI types. | |
| | | The data pointer for the LV2_Feature for this feature should always be | |
| | | set | |
| | | to NULL. | |
| | | | |
| UIs written to this specification do not need to be threadsafe - the | | UIs written to this specification do not need to be threadsafe - the | |
| functions defined below may only be called in the same thread as the UI | | functions defined below may only be called in the same thread as the UI | |
| main loop is running in. | | main loop is running in. | |
| | | | |
| Note that this UI extension is NOT a lv2:Feature. There is no way for a | | Note that this UI extension is NOT a lv2:Feature. There is no way for a | |
| plugin to know whether the host that loads it supports UIs or not, and | | plugin to know whether the host that loads it supports UIs or not, and | |
| the plugin must ALWAYS work without the UI (although it may be rather | | the plugin must ALWAYS work without the UI (although it may be rather | |
| useless unless it has been configured using the UI in a previous sessio
n). | | useless unless it has been configured using the UI in a previous sessio
n). | |
| | | | |
| A UI does not have to be a graphical widget, it could just as well be a | | A UI does not have to be a graphical widget, it could just as well be a | |
| server listening for OSC input or an interface to some sort of hardware | | server listening for OSC input or an interface to some sort of hardware | |
| device, depending on the RDF class of the UI. | | device, depending on the RDF class of the UI. | |
| */ | | */ | |
| | | | |
|
| #ifndef LV2_IPUI_H | | #ifndef LV2_UI_H | |
| #define LV2_IPUI_H | | #define LV2_UI_H | |
| | | | |
|
| #include "lv2.h" | | #include <lv2.h> | |
| | | | |
| | | #define LV2_UI_URI "http://lv2plug.in/ns/extensions/ui" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /** A pointer to some widget or other type of UI handle. | | /** A pointer to some widget or other type of UI handle. | |
|
| The actual type is defined by the type URI of the UI, e.g. if | | The actual type is defined by the type URI of the UI. | |
| "<http://example.org/someui> a uiext:GtkUI", this is a pointer | | All the functionality provided by this extension is toolkit | |
| to a GtkWidget compatible with GTK+ 2.0 and the UI can expect the GTK+ | | | |
| main loop to be running during the entire lifetime of all instances of | | | |
| that | | | |
| UI. All the functionality provided by this extension is toolkit | | | |
| independent, the host only needs to pass the necessary callbacks and | | independent, the host only needs to pass the necessary callbacks and | |
| display the widget, if possible. Plugins may have several UIs, in vario
us | | display the widget, if possible. Plugins may have several UIs, in vario
us | |
|
| toolkits, but uiext:GtkUI is the only type that is defined in this | | toolkits. */ | |
| extension. */ | | | |
| typedef void* LV2UI_Widget; | | typedef void* LV2UI_Widget; | |
| | | | |
|
| /** A pointer to some host data required to instantiate a UI. | | | |
| Like the type of the widget, the actual type of this pointer is defined | | | |
| by | | | |
| the type URI of the UI. Hosts can use this to pass toolkit specific da | | | |
| ta | | | |
| to a UI it needs to instantiate (type map, drawing context, etc). For t | | | |
| he | | | |
| uiext:GtkUI type this should be NULL. */ | | | |
| typedef void* LV2UI_Host_Data; | | | |
| | | | |
| /** This handle indicates a particular instance of a UI. | | /** This handle indicates a particular instance of a UI. | |
| It is valid to compare this to NULL (0 for C++) but otherwise the | | It is valid to compare this to NULL (0 for C++) but otherwise the | |
| host MUST not attempt to interpret it. The UI plugin may use it to | | host MUST not attempt to interpret it. The UI plugin may use it to | |
| reference internal instance data. */ | | reference internal instance data. */ | |
| typedef void* LV2UI_Handle; | | typedef void* LV2UI_Handle; | |
| | | | |
| /** This handle indicates a particular plugin instance, provided by the hos
t. | | /** This handle indicates a particular plugin instance, provided by the hos
t. | |
| It is valid to compare this to NULL (0 for C++) but otherwise the | | It is valid to compare this to NULL (0 for C++) but otherwise the | |
| UI plugin MUST not attempt to interpret it. The host may use it to | | UI plugin MUST not attempt to interpret it. The host may use it to | |
| reference internal plugin instance data. */ | | reference internal plugin instance data. */ | |
| typedef void* LV2UI_Controller; | | typedef void* LV2UI_Controller; | |
| | | | |
| /** This is the type of the host-provided function that the UI can use to | | /** This is the type of the host-provided function that the UI can use to | |
| send data to a plugin's input ports. The @c buffer parameter must point | | send data to a plugin's input ports. The @c buffer parameter must point | |
| to a block of data, @c buffer_size bytes large. The contents of this bu
ffer | | to a block of data, @c buffer_size bytes large. The contents of this bu
ffer | |
|
| will depend on the class of the port it's being sent to, and the transf | | and what the host should do with it depends on the value of the @c form | |
| er | | at | |
| mechanism specified for that port class. | | parameter. | |
| | | | |
|
| Transfer mechanisms are Features and may be defined in meta-extensions. | | The @c format parameter should either be 0 or a numeric ID for a "Trans | |
| They specify how to translate the data buffers passed to this function | | fer | |
| to input data for the plugin ports. If a UI wishes to write data to an | | mechanism". Transfer mechanisms are Features and may be defined in | |
| input port, it must list a transfer mechanism Feature for that port's | | meta-extensions. They specify how to translate the data buffers passed | |
| class as an optional or required feature (depending on whether the UI | | to this function to input data for the plugin ports. If a UI wishes to | |
| will work without being able to write to that port or not). The only | | write data to an input port, it must list a transfer mechanism Feature | |
| exception is ports of the class lv2:ControlPort, for which @c buffer_si | | for that port's class as an optional or required feature (depending on | |
| ze | | whether the UI will work without being able to write to that port or no | |
| should always be 4 and the buffer should always contain a single IEEE-7 | | t). | |
| 54 | | The only exception is when the UI wants to write single float values to | |
| float. | | input ports of the class lv2:ControlPort, in which case @c buffer_size | |
| | | should always be 4, the buffer should always contain a single IEEE-754 | |
| | | float, and @c format should be 0. | |
| | | | |
| | | The numeric IDs for the transfer mechanisms are provided by a | |
| | | URI-to-integer mapping function provided by the host, using the URI Map | |
| | | feature <http://lv2plug.in/ns/ext/uri-map> with the map URI | |
| | | "http://lv2plug.in/ns/extensions/ui". Thus a UI that requires transfer | |
| | | mechanism features also requires the URI Map feature, but this is | |
| | | implicit - the UI does not have to list the URI map feature as a requir | |
| | | ed | |
| | | or optional feature in it's RDF data. | |
| | | | |
| | | An UI MUST NOT pass a @c format parameter value (except 0) that has not | |
| | | been returned by the host-provided URI mapping function for a | |
| | | host-supported transfer mechanism feature URI. | |
| | | | |
| The UI MUST NOT try to write to a port for which there is no specified | | The UI MUST NOT try to write to a port for which there is no specified | |
| transfer mechanism, or to an output port. The UI is responsible for | | transfer mechanism, or to an output port. The UI is responsible for | |
|
| allocating the buffer and deallocating it after the call. A function | | allocating the buffer and deallocating it after the call. | |
| pointer of this type will be provided to the UI by the host in the | | */ | |
| instantiate() function. */ | | | |
| typedef void (*LV2UI_Write_Function)(LV2UI_Controller controller, | | typedef void (*LV2UI_Write_Function)(LV2UI_Controller controller, | |
| uint32_t port_index, | | uint32_t port_index, | |
| uint32_t buffer_size, | | uint32_t buffer_size, | |
|
| | | uint32_t format, | |
| const void* buffer); | | const void* buffer); | |
| | | | |
|
| /** */ | | /** This struct contains the implementation of an UI. A pointer to an | |
| | | object of this type is returned by the lv2ui_descriptor() function. | |
| | | */ | |
| typedef struct _LV2UI_Descriptor { | | typedef struct _LV2UI_Descriptor { | |
| | | | |
| /** The URI for this UI (not for the plugin it controls). */ | | /** The URI for this UI (not for the plugin it controls). */ | |
| const char* URI; | | const char* URI; | |
| | | | |
| /** Create a new UI object and return a handle to it. This function works | | /** Create a new UI object and return a handle to it. This function works | |
| similarly to the instantiate() member in LV2_Descriptor. | | similarly to the instantiate() member in LV2_Descriptor. | |
| | | | |
| @param descriptor The descriptor for the UI that you want to instanti
ate. | | @param descriptor The descriptor for the UI that you want to instanti
ate. | |
| @param plugin_uri The URI of the plugin that this UI will control. | | @param plugin_uri The URI of the plugin that this UI will control. | |
| @param bundle_path The path to the bundle containing the RDF data fil
e | | @param bundle_path The path to the bundle containing the RDF data fil
e | |
| that references this shared object file, including
the | | that references this shared object file, including
the | |
| trailing '/'. | | trailing '/'. | |
| @param write_function A function provided by the host that the UI can | | @param write_function A function provided by the host that the UI can | |
| use to send data to the plugin's input ports. | | use to send data to the plugin's input ports. | |
| @param controller A handle for the plugin instance that should be pas
sed | | @param controller A handle for the plugin instance that should be pas
sed | |
| as the first parameter of @c write_function. | | as the first parameter of @c write_function. | |
|
| @param host_data Data required from the host for instantiation. | | | |
| The type of this depends on the RDF class of the UI | | | |
| . | | | |
| If the UI type does not specify anything to be passe | | | |
| d | | | |
| here, the host should pass NULL. | | | |
| @param widget A pointer to an LV2UI_Widget. The UI will write a | | @param widget A pointer to an LV2UI_Widget. The UI will write a | |
| widget pointer to this location (what type of widge
t | | widget pointer to this location (what type of widge
t | |
| depends on the RDF class of the UI) that will be th
e | | depends on the RDF class of the UI) that will be th
e | |
| main UI widget. | | main UI widget. | |
| @param features An array of LV2_Feature pointers. The host must pas
s | | @param features An array of LV2_Feature pointers. The host must pas
s | |
|
| all feature URIs that it and the plugin supports an
d any | | all feature URIs that it and the UI supports and an
y | |
| additional data, just like in the LV2 plugin | | additional data, just like in the LV2 plugin | |
|
| instantiate() function. | | instantiate() function. Note that UI features and p | |
| | | lugin | |
| | | features are NOT necessarily the same, they just sha | |
| | | re | |
| | | the same data structure - this will probably not be | |
| | | the | |
| | | same array as the one the plugin host passes to a | |
| | | plugin. | |
| */ | | */ | |
| LV2UI_Handle (*instantiate)(const struct _LV2UI_Descriptor* descriptor, | | LV2UI_Handle (*instantiate)(const struct _LV2UI_Descriptor* descriptor, | |
| const char* plugin_uri, | | const char* plugin_uri, | |
| const char* bundle_path, | | const char* bundle_path, | |
| LV2UI_Write_Function write_functio
n, | | LV2UI_Write_Function write_functio
n, | |
| LV2UI_Controller controller, | | LV2UI_Controller controller, | |
|
| LV2UI_Host_Data host_data, | | | |
| LV2UI_Widget* widget, | | LV2UI_Widget* widget, | |
| const LV2_Feature* const* features); | | const LV2_Feature* const* features); | |
| | | | |
| /** Destroy the UI object and the associated widget. The host must not tr
y | | /** Destroy the UI object and the associated widget. The host must not tr
y | |
| to access the widget after calling this function. | | to access the widget after calling this function. | |
| */ | | */ | |
| void (*cleanup)(LV2UI_Handle ui); | | void (*cleanup)(LV2UI_Handle ui); | |
| | | | |
| /** Tell the UI that something interesting has happened at a plugin port. | | /** Tell the UI that something interesting has happened at a plugin port. | |
| What is interesting and how it is written to the buffer passed to thi
s | | What is interesting and how it is written to the buffer passed to thi
s | |
|
| function is defined by the specified transfer mechanism for that port | | function is defined by the @c format parameter, which has the same | |
| class (see LV2UI_Write_Function). The only exception is ports of the | | meaning as in LV2UI_Write_Function. The only exception is ports of th | |
| | | e | |
| class lv2:ControlPort, for which this function should be called | | class lv2:ControlPort, for which this function should be called | |
|
| when the port value changes (it must not be called for every single | | when the port value changes (it does not have to be called for every | |
| change if the host's UI thread has problems keeping up with the threa | | single change if the host's UI thread has problems keeping up with | |
| d | | the thread the plugin is running in), @c buffer_size should be 4 and | |
| the plugin is running in), @c buffer_size should be 4 and the buffer | | the | |
| should contain a single IEEE-754 float. | | buffer should contain a single IEEE-754 float. In this case the @c fo | |
| | | rmat | |
| | | parameter should be 0. | |
| | | | |
| By default, the host should only call this function for input ports o
f | | By default, the host should only call this function for input ports o
f | |
| the lv2:ControlPort class. However, the default setting can be modifi
ed | | the lv2:ControlPort class. However, the default setting can be modifi
ed | |
| by using the following URIs in the UI's RDF data: | | by using the following URIs in the UI's RDF data: | |
| <pre> | | <pre> | |
| uiext:portNotification | | uiext:portNotification | |
| uiext:noPortNotification | | uiext:noPortNotification | |
| uiext:plugin | | uiext:plugin | |
| uiext:portIndex | | uiext:portIndex | |
| </pre> | | </pre> | |
| | | | |
| skipping to change at line 240 | | skipping to change at line 308 | |
| <code><http://my.pluginui></code> for the plugin with URI | | <code><http://my.pluginui></code> for the plugin with URI | |
| <code><http://my.plugin></code> to get notified when the value of the | | <code><http://my.plugin></code> to get notified when the value of the | |
| output control port with index 4 changes, you would use the following | | output control port with index 4 changes, you would use the following | |
| in the RDF for your UI: | | in the RDF for your UI: | |
| <pre> | | <pre> | |
| <http://my.pluginui> uiext:portNotification [ uiext:plugin <http://my
.plugin> ; | | <http://my.pluginui> uiext:portNotification [ uiext:plugin <http://my
.plugin> ; | |
| uiext:portIndex 4 ] . | | uiext:portIndex 4 ] . | |
| </pre> | | </pre> | |
| and similarly with <code>uiext:noPortNotification</code> if you wante
d | | and similarly with <code>uiext:noPortNotification</code> if you wante
d | |
| to prevent notifications for a port for which it would be on by defau
lt | | to prevent notifications for a port for which it would be on by defau
lt | |
|
| otherwise. The UI is not allowed to request notifications for ports | | otherwise. The UI is not allowed to request notifications for ports o | |
| for which no transfer mechanism is specified, if it does it should be | | f | |
| considered broken and the host should not load it. | | types for which no transfer mechanism is specified, if it does it sho | |
| | | uld | |
| | | be considered broken and the host should not load it. | |
| | | | |
| The @c buffer is only valid during the time of this function call, so
if | | The @c buffer is only valid during the time of this function call, so
if | |
| the UI wants to keep it for later use it has to copy the contents to
an | | the UI wants to keep it for later use it has to copy the contents to
an | |
| internal buffer. | | internal buffer. | |
| | | | |
| This member may be set to NULL if the UI is not interested in any | | This member may be set to NULL if the UI is not interested in any | |
| port events. | | port events. | |
| */ | | */ | |
| void (*port_event)(LV2UI_Handle ui, | | void (*port_event)(LV2UI_Handle ui, | |
|
| uint32_t port, | | uint32_t port_index, | |
| uint32_t buffer_size, | | uint32_t buffer_size, | |
|
| | | uint32_t format, | |
| const void* buffer); | | const void* buffer); | |
| | | | |
| /** Returns a data structure associated with an extension URI, for exampl
e | | /** Returns a data structure associated with an extension URI, for exampl
e | |
| a struct containing additional function pointers. Avoid returning | | a struct containing additional function pointers. Avoid returning | |
| function pointers directly since standard C++ has no valid way of | | function pointers directly since standard C++ has no valid way of | |
| casting a void* to a function pointer. This member may be set to NULL | | casting a void* to a function pointer. This member may be set to NULL | |
| if the UI is not interested in supporting any extensions. This is sim
ilar | | if the UI is not interested in supporting any extensions. This is sim
ilar | |
| to the extension_data() member in LV2_Descriptor. | | to the extension_data() member in LV2_Descriptor. | |
| */ | | */ | |
| const void* (*extension_data)(const char* uri); | | const void* (*extension_data)(const char* uri); | |
| | | | |
| skipping to change at line 278 | | skipping to change at line 347 | |
| with the following function prototype within the shared object | | with the following function prototype within the shared object | |
| file. This function will have C-style linkage (if you are using | | 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 | | C++ this is taken care of by the 'extern "C"' clause at the top of | |
| the file). This function will be accessed by the UI host using the | | the file). This function will be accessed by the UI host using the | |
| @c dlsym() function and called to get a LV2UI_UIDescriptor for the | | @c dlsym() function and called to get a LV2UI_UIDescriptor for the | |
| wanted plugin. | | wanted plugin. | |
| | | | |
| Just like lv2_descriptor(), this function takes an index parameter. The | | 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 num
ber - | | index should only be used for enumeration and not as any sort of ID num
ber - | |
| the host should just iterate from 0 and upwards until the function retu
rns | | the host should just iterate from 0 and upwards until the function retu
rns | |
|
| NULL, or a descriptor with an URI matching the one the host is looking | | NULL or a descriptor with an URI matching the one the host is looking f | |
| for | | or. | |
| is returned. | | | |
| */ | | */ | |
| const LV2UI_Descriptor* lv2ui_descriptor(uint32_t index); | | const LV2UI_Descriptor* lv2ui_descriptor(uint32_t index); | |
| | | | |
| /** This is the type of the lv2ui_descriptor() function. */ | | /** This is the type of the lv2ui_descriptor() function. */ | |
| typedef const LV2UI_Descriptor* (*LV2UI_DescriptorFunction)(uint32_t index)
; | | typedef const LV2UI_Descriptor* (*LV2UI_DescriptorFunction)(uint32_t index)
; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| | | | |
End of changes. 25 change blocks. |
| 67 lines changed or deleted | | 157 lines changed or added | |
|
| port.h | | port.h | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| | | | |
| /** \addtogroup slv2_data | | /** \addtogroup slv2_data | |
| * @{ | | * @{ | |
| */ | | */ | |
| | | | |
| /** Port analog of slv2_plugin_get_value. | | /** Port analog of slv2_plugin_get_value. | |
| * | | * | |
| * Time = Query | | * Time = Query | |
| */ | | */ | |
| SLV2Values | | SLV2Values | |
|
| slv2_port_get_value(SLV2Plugin plugin, | | slv2_port_get_value_by_qname(SLV2Plugin plugin, | |
| SLV2Port port, | | SLV2Port port, | |
| const char* property); | | const char* property_uri); | |
| | | | |
| /** Return the LV2 port properties of a port. | | /** Return the LV2 port properties of a port. | |
| * | | * | |
| * Time = Query | | * Time = Query | |
| */ | | */ | |
| SLV2Values | | SLV2Values | |
| slv2_port_get_properties(SLV2Plugin plugin, | | slv2_port_get_properties(SLV2Plugin plugin, | |
| SLV2Port port); | | SLV2Port port); | |
| | | | |
| /** Return whether a port has a certain property. | | /** Return whether a port has a certain property. | |
| * | | * | |
| * Time = Query | | * Time = Query | |
| */ | | */ | |
| bool | | bool | |
|
| slv2_port_has_property(SLV2Plugin p, | | slv2_port_has_property(SLV2Plugin p, | |
| SLV2Port port, | | SLV2Port port, | |
| const char* property_uri); | | SLV2Value property_uri); | |
| | | | |
|
| /** Get the symbol of a port given the index. | | /** Return whether a port is an event port and supports a certain event typ
e. | |
| * | | * | |
|
| * The 'symbol' is a short string, a valid C identifier. | | * Time = Query | |
| * Returned string must be free()'d by caller. | | */ | |
| | | bool | |
| | | slv2_port_supports_event(SLV2Plugin p, | |
| | | SLV2Port port, | |
| | | SLV2Value event_uri); | |
| | | | |
| | | /** Get the symbol of a port. | |
| * | | * | |
|
| * \return NULL when index is out of range | | * The 'symbol' is a short string, a valid C identifier. | |
| | | * Returned value is owned by \a port and must not be freed. | |
| * | | * | |
| * Time = Query | | * Time = Query | |
| */ | | */ | |
|
| char* | | SLV2Value | |
| slv2_port_get_symbol(SLV2Plugin plugin, | | slv2_port_get_symbol(SLV2Plugin plugin, | |
| SLV2Port port); | | SLV2Port port); | |
| | | | |
| /** Get the name of a port. | | /** Get the name of a port. | |
| * | | * | |
| * This is guaranteed to return the untranslated name (the doap:name in the | | * This is guaranteed to return the untranslated name (the doap:name in the | |
| * data file without a language tag). Returned value must be free()'d by | | * data file without a language tag). Returned value must be free()'d by | |
| * the caller. | | * the caller. | |
| * | | * | |
| * Time = Query | | * Time = Query | |
| */ | | */ | |
|
| char* | | SLV2Value | |
| slv2_port_get_name(SLV2Plugin plugin, | | slv2_port_get_name(SLV2Plugin plugin, | |
| SLV2Port port); | | SLV2Port port); | |
| | | | |
|
| /** Get the direction (input, output) of a port. | | /** Get all the classes of a port. | |
| * | | * | |
|
| * Time = Query | | * This can be used to determine if a port is an input, output, audio, | |
| */ | | * control, midi, etc, etc, though it's simpler to use slv2_port_is_a. | |
| SLV2PortDirection | | * The returned list does not include lv2:Port, which is implied. | |
| slv2_port_get_direction(SLV2Plugin plugin, | | | |
| SLV2Port port); | | | |
| | | | |
| /** Get the data type of a port. | | | |
| * | | * | |
|
| * Time = Query | | * Returned value is shared and must not be destroyed by caller. | |
| | | * | |
| | | * Time = O(1) | |
| */ | | */ | |
|
| SLV2PortDataType | | SLV2Values | |
| slv2_port_get_data_type(SLV2Plugin plugin, | | slv2_port_get_classes(SLV2Plugin plugin, | |
| SLV2Port port); | | SLV2Port port); | |
| | | | |
|
| /** Get the default value of a port. | | /** Determine if a port is of a given class (input, output, audio, etc). | |
| * | | * | |
|
| * Only valid for ports with a data type of lv2:float. | | * For convenience/performance/extensibility reasons, hosts are expected to | |
| | | * create an SLV2Value for each port class they "care about". Well-known t | |
| | | ype | |
| | | * URI strings are defined (e.g. SLV2_PORT_CLASS_INPUT) for convenience, bu | |
| | | t | |
| | | * this function is designed so that SLV2 is usable with any port types | |
| | | * without requiring explicit support in SLV2. | |
| * | | * | |
|
| * Time = Query | | * Time = O(n) (n pointer comparisons where n is the number of classes of | |
| | | * this port, so this method is suitable for realtime use on any sane port) | |
| | | . | |
| */ | | */ | |
|
| float | | bool | |
| slv2_port_get_default_value(SLV2Plugin plugin, | | slv2_port_is_a(SLV2Plugin plugin, | |
| SLV2Port port); | | SLV2Port port, | |
| | | SLV2Value port_class); | |
| | | | |
|
| /** Get the minimum value of a port. | | /** Get the default, minimum, and maximum values of a port. | |
| * | | * | |
|
| * Only valid for ports with a data type of lv2:float. | | * @a def, @a min, and @a max are outputs, pass pointers to uninitialized | |
| | | * (i.e. NOT created with slv2_value_new) SLV2Value variables. These will | |
| | | * be set to point at new values (which must be freed by the caller using | |
| | | * slv2_value_free), or NULL if the value does not exist. | |
| * | | * | |
| * Time = Query | | * Time = Query | |
| */ | | */ | |
|
| float | | void | |
| slv2_port_get_minimum_value(SLV2Plugin plugin, | | slv2_port_get_range(SLV2Plugin plugin, | |
| SLV2Port port); | | SLV2Port port, | |
| | | SLV2Value* def, | |
| | | SLV2Value* min, | |
| | | SLV2Value* max); | |
| | | | |
|
| /** Get the maximum value of a port. | | /** Get the scale points (enumeration values) of a port. | |
| * | | * | |
|
| * Only valid for ports with a data type of lv2:float. | | * This returns a collection of 'interesting' named values of a port | |
| | | * (e.g. appropriate entries for a UI selector associated with this port). | |
| * | | * | |
|
| * Time = Query | | * Returned value may be NULL if @a port has no scale points, otherwise it | |
| | | * must be freed by caller with slv2_scale_points_free. | |
| */ | | */ | |
|
| float | | SLV2ScalePoints | |
| slv2_port_get_maximum_value(SLV2Plugin plugin, | | slv2_port_get_scale_points(SLV2Plugin plugin, | |
| SLV2Port port); | | SLV2Port port); | |
| | | | |
| /** @} */ | | /** @} */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* __SLV2_PORT_H__ */ | | #endif /* __SLV2_PORT_H__ */ | |
| | | | |
End of changes. 22 change blocks. |
| 41 lines changed or deleted | | 63 lines changed or added | |
|