lv2.h | lv2.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
#include <stdint.h> | #include <stdint.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* ************************************************************************ * */ | /* ************************************************************************ * */ | |||
/** @file lv2.h | /** @file lv2.h | |||
* | * | |||
* Revision: 1.0beta3 | * Revision: 1.0beta4 | |||
* | * | |||
* == Overview == | * == Overview == | |||
* | * | |||
* There are a large number of open source and free software synthesis | * There are a large number of open source and free software synthesis | |||
* packages in use or development at this time. This API ('LV2') | * packages in use or development at this time. This API ('LV2') | |||
* attempts to give programmers the ability to write simple 'plugin' | * attempts to give programmers the ability to write simple 'plugin' | |||
* audio processors in C/C++ and link them dynamically ('plug') into | * audio processors in C/C++ and link them dynamically ('plug') into | |||
* a range of these packages ('hosts'). It should be possible for any | * a range of these packages ('hosts'). It should be possible for any | |||
* host and any plugin to communicate completely through this interface. | * host and any plugin to communicate completely through this interface. | |||
* | * | |||
skipping to change at line 154 | skipping to change at line 154 | |||
} LV2_Host_Feature; | } LV2_Host_Feature; | |||
/* ************************************************************************ * */ | /* ************************************************************************ * */ | |||
/** Descriptor for a Type of Plugin. | /** Descriptor for a Type of Plugin. | |||
* | * | |||
* This structure is used to describe a plugin type. It provides a number | * This structure is used to describe a plugin type. It provides a number | |||
* of functions to instantiate it, link it to buffers and run it. */ | * of functions to instantiate it, link it to buffers and run it. */ | |||
typedef struct _LV2_Descriptor { | typedef struct _LV2_Descriptor { | |||
/** A globally unique, case-sensitive identifier for this plugin type. | /** A globally unique, case-sensitive identifier for this plugin typ | |||
* | e. | |||
* All plugins with the same URI MUST be compatible in terms of 'port | * | |||
* signature', meaning they have the same number of ports, same port | * All plugins with the same URI MUST be compatible in terms of 'por | |||
* shortnames, and roughly the same functionality. URIs should | t | |||
* probably contain a version number (or similar) for this reason. | * signature', meaning they have the same number of ports, same port | |||
* | * shortnames, and roughly the same functionality. URIs should | |||
* Rationale: When serializing session/patch/etc files, hosts MUST | * probably contain a version number (or similar) for this reason. | |||
* refer to a loaded plugin by the plugin URI only. In the future | * | |||
* loading a plugin with this URI MUST yield a plugin with the | * Rationale: When serializing session/patch/etc files, hosts MUST | |||
* same ports (etc) which is 100% compatible. */ | * refer to a loaded plugin by the plugin URI only. In the future | |||
const char * URI; | * loading a plugin with this URI MUST yield a plugin with the | |||
* same ports (etc) which is 100% compatible. */ | ||||
const char * URI; | ||||
/** Function pointer that instantiates a plugin. | /** Function pointer that instantiates a plugin. | |||
* | * | |||
* A handle is returned indicating the new plugin instance. The | * A handle is returned indicating the new plugin instance. The | |||
* instantiation function accepts a sample rate as a parameter as well | * instantiation function accepts a sample rate as a parameter as we | |||
* as the plugin descriptor from which this instantiate function was | ll | |||
* found. This function must return NULL if instantiation fails. | * as the plugin descriptor from which this instantiate function was | |||
* | * found. This function must return NULL if instantiation fails. | |||
* BundlePath is a string of the path to the LV2 bundle which contains | * | |||
* this plugin binary. It MUST include the trailing directory separator | * BundlePath is a string of the path to the LV2 bundle which contai | |||
* (e.g. '/') so that BundlePath + filename gives the path to a file | ns | |||
* in the bundle. | * this plugin binary. It MUST include the trailing directory separ | |||
* | ator | |||
* HostFeatures is a NULL terminated array of the URIs of the LV2 | * (e.g. '/') so that BundlePath + filename gives the path to a file | |||
* features that the host supports. Plugins may refuse to instantiate | * in the bundle. | |||
* if required features are not found here (however hosts SHOULD NOT use | * | |||
* this as a discovery mechanism, instead reading the data file before | * HostFeatures is a NULL terminated array of the URIs of the LV2 | |||
* attempting to instantiate the plugin). This array must always exist; | * features that the host supports. Plugins may refuse to instantiat | |||
* if a host has no features, it MUST pass a single element array | e | |||
* containing NULL (to simplify plugins). | * if required features are not found here (however hosts SHOULD NOT | |||
* | use | |||
* Note that instance initialisation should generally occur in | * this as a discovery mechanism, instead reading the data file befo | |||
* activate() rather than here. If a host calls instantiate, it MUST | re | |||
* call cleanup() at some point in the future. */ | * attempting to instantiate the plugin). This array must always ex | |||
LV2_Handle (*instantiate)(const struct _LV2_Descriptor * Descriptor, | ist; | |||
uint32_t SampleRate, | * if a host has no features, it MUST pass a single element array | |||
const char * BundlePath, | * containing NULL (to simplify plugins). | |||
const LV2_Host_Feature *const * HostFeatures); | * | |||
* Note that instance initialisation should generally occur in | ||||
* activate() rather than here. If a host calls instantiate, it MUS | ||||
T | ||||
* call cleanup() at some point in the future. */ | ||||
LV2_Handle (*instantiate)(const struct _LV2_Descriptor * Descriptor | ||||
, | ||||
double SampleRate | ||||
, | ||||
const char * BundlePath | ||||
, | ||||
const LV2_Host_Feature *const * HostFeatur | ||||
es); | ||||
/** Function pointer that connects a port on a plugin instance to a memor | /** Function pointer that connects a port on a plugin instance to a | |||
y | memory | |||
* location where the block of data for the port will be read/written. | * location where the block of data for the port will be read/writte | |||
* | n. | |||
* The data location is expected to be of the type defined in the | * | |||
* plugin's data file (e.g. an array of float for an lv2:AudioPort). | * The data location is expected to be of the type defined in the | |||
* Memory issues are managed by the host. The plugin must read/write | * plugin's data file (e.g. an array of float for an lv2:AudioPort). | |||
* the data at these locations every time run() is called, data | * Memory issues are managed by the host. The plugin must read/write | |||
* present at the time of this connection call MUST NOT be | * the data at these locations every time run() is called, data | |||
* considered meaningful. | * present at the time of this connection call MUST NOT be | |||
* | * considered meaningful. | |||
* connect_port() may be called more than once for a plugin instance | * | |||
* to allow the host to change the buffers that the plugin is reading | * connect_port() may be called more than once for a plugin instance | |||
* or writing. These calls may be made before or after activate() | * to allow the host to change the buffers that the plugin is readin | |||
* or deactivate() calls. Note that there may be realtime constraints | g | |||
* on connect_port (see lv2:hardRTCapable in lv2.ttl). | * or writing. These calls may be made before or after activate() | |||
* | * or deactivate() calls. Note that there may be realtime constrain | |||
* connect_port() MUST be called at least once for each port before | ts | |||
* run() is called. The plugin must pay careful attention to the block | * on connect_port (see lv2:hardRTCapable in lv2.ttl). | |||
* size passed to the run function as the block allocated may only just | * | |||
* be large enough to contain the block of data (typically samples), and | * connect_port() MUST be called at least once for each port before | |||
* is not guaranteed to be constant. | * run() is called. The plugin must pay careful attention to the bl | |||
* | ock | |||
* Plugin writers should be aware that the host may elect to use the | * size passed to the run function as the block allocated may only j | |||
* same buffer for more than one port and even use the same buffer for | ust | |||
* both input and output (see lv2:inPlaceBroken in lv2.ttl). | * be large enough to contain the block of data (typically samples), | |||
* However, overlapped buffers or use of a single buffer for both | and | |||
* audio and control data may result in unexpected behaviour. | * is not guaranteed to be constant. | |||
* | * | |||
* If the plugin has the property lv2:hardRTCapable then there are | * Plugin writers should be aware that the host may elect to use the | |||
* various things that the plugin MUST NOT do within the connect_port() | * same buffer for more than one port and even use the same buffer f | |||
* function (see lv2.ttl). */ | or | |||
void (*connect_port)(LV2_Handle Instance, | * both input and output (see lv2:inPlaceBroken in lv2.ttl). | |||
uint32_t Port, | * However, overlapped buffers or use of a single buffer for both | |||
void * DataLocation); | * audio and control data may result in unexpected behaviour. | |||
* | ||||
* If the plugin has the property lv2:hardRTCapable then there are | ||||
* various things that the plugin MUST NOT do within the connect_por | ||||
t() | ||||
* function (see lv2.ttl). */ | ||||
void (*connect_port)(LV2_Handle Instance, | ||||
uint32_t Port, | ||||
void * DataLocation); | ||||
/** Function pointer that initialises a plugin instance and activates | /** Function pointer that initialises a plugin instance and activate | |||
* it for use. | s | |||
* | * it for use. | |||
* This is separated from instantiate() to aid real-time support and so | * | |||
* that hosts can reinitialise a plugin instance by calling deactivate() | * This is separated from instantiate() to aid real-time support and | |||
* and then activate(). In this case the plugin instance must reset all | so | |||
* state information dependent on the history of the plugin instance | * that hosts can reinitialise a plugin instance by calling deactiva | |||
* except for any data locations provided by connect_port(). If there | te() | |||
* is nothing for activate() to do then the plugin writer may provide | * and then activate(). In this case the plugin instance must reset | |||
* a NULL rather than an empty function. | all | |||
* | * state information dependent on the history of the plugin instance | |||
* When present, hosts MUST call this function once before run() | * except for any data locations provided by connect_port(). If ther | |||
* is called for the first time. This call SHOULD be made as close | e | |||
* to the run() call as possible and indicates to real-time plugins | * is nothing for activate() to do then the plugin writer may provid | |||
* that they are now live, however plugins MUST NOT rely on a prompt | e | |||
* call to run() after activate(). activate() may not be called again | * a NULL rather than an empty function. | |||
* unless deactivate() is called first (after which activate() may be | * | |||
* called again, followed by deactivate, etc. etc.). If a host calls | * When present, hosts MUST call this function once before run() | |||
* activate, it MUST call deactivate at some point in the future. | * is called for the first time. This call SHOULD be made as close | |||
* | * to the run() call as possible and indicates to real-time plugins | |||
* Note that connect_port() may be called before or after a call to | * that they are now live, however plugins MUST NOT rely on a prompt | |||
* activate(). */ | * call to run() after activate(). activate() may not be called aga | |||
void (*activate)(LV2_Handle Instance); | in | |||
* unless deactivate() is called first (after which activate() may b | ||||
e | ||||
* called again, followed by deactivate, etc. etc.). If a host call | ||||
s | ||||
* activate, it MUST call deactivate at some point in the future. | ||||
* | ||||
* Note that connect_port() may be called before or after a call to | ||||
* activate(). */ | ||||
void (*activate)(LV2_Handle Instance); | ||||
/** Function pointer that runs a plugin instance for a block. | /** Function pointer that runs a plugin instance for a block. | |||
* | * | |||
* Two parameters are required: the first is a handle to the particular | * Two parameters are required: the first is a handle to the particu | |||
* instance to be run and the second indicates the block size (in | lar | |||
* samples) for which the plugin instance may run. | * instance to be run and the second indicates the block size (in | |||
* | * samples) for which the plugin instance may run. | |||
* Note that if an activate() function exists then it must be called | * | |||
* before run(). If deactivate() is called for a plugin instance then | * Note that if an activate() function exists then it must be called | |||
* the plugin instance may not be reused until activate() has been | * before run(). If deactivate() is called for a plugin instance the | |||
* called again. | n | |||
* | * the plugin instance may not be reused until activate() has been | |||
* If the plugin has the property lv2:hardRTCapable then there are | * called again. | |||
* various things that the plugin MUST NOT do within the run() | * | |||
* function (see lv2.ttl). */ | * If the plugin has the property lv2:hardRTCapable then there are | |||
void (*run)(LV2_Handle Instance, | * various things that the plugin MUST NOT do within the run() | |||
uint32_t SampleCount); | * function (see lv2.ttl). */ | |||
void (*run)(LV2_Handle Instance, | ||||
uint32_t SampleCount); | ||||
/** This is the counterpart to activate() (see above). If there is | /** This is the counterpart to activate() (see above). If there is | |||
* nothing for deactivate() to do then the plugin writer may provide | * nothing for deactivate() to do then the plugin writer may provide | |||
* a NULL rather than an empty function. | * a NULL rather than an empty function. | |||
* | * | |||
* Hosts must deactivate all activated units after they have been run() | * Hosts must deactivate all activated units after they have been ru | |||
* for the last time. This call SHOULD be made as close to the last | n() | |||
* run() call as possible and indicates to real-time plugins that | * for the last time. This call SHOULD be made as close to the last | |||
* they are no longer live, however plugins MUST NOT rely on prompt | * run() call as possible and indicates to real-time plugins that | |||
* deactivation. Note that connect_port() may be called before or | * they are no longer live, however plugins MUST NOT rely on prompt | |||
* after a call to deactivate(). | * deactivation. Note that connect_port() may be called before or | |||
* | * after a call to deactivate(). | |||
* Note that deactivation is not similar to pausing as the plugin | * | |||
* instance will be reinitialised when activate() is called to reuse it. | * Note that deactivation is not similar to pausing as the plugin | |||
* Hosts MUST NOT call deactivate() unless activate() was previously | * instance will be reinitialised when activate() is called to reuse | |||
* called. */ | it. | |||
void (*deactivate)(LV2_Handle Instance); | * Hosts MUST NOT call deactivate() unless activate() was previously | |||
* called. */ | ||||
void (*deactivate)(LV2_Handle Instance); | ||||
/** This is the counterpart to instantiate() (see above). Once an instan | /** This is the counterpart to instantiate() (see above). Once an i | |||
ce | nstance | |||
* of a plugin has been finished with it can be deleted using this | * of a plugin has been finished with it can be deleted using this | |||
* function. The instance handle passed ceases to be valid after | * function. The instance handle passed ceases to be valid after | |||
* this call. | * this call. | |||
* | * | |||
* If activate() was called for a plugin instance then a corresponding | * If activate() was called for a plugin instance then a correspondi | |||
* call to deactivate() MUST be made before cleanup() is called. | ng | |||
* Hosts MUST NOT call cleanup() unless instantiate() was previously | * call to deactivate() MUST be made before cleanup() is called. | |||
* called. */ | * Hosts MUST NOT call cleanup() unless instantiate() was previously | |||
void (*cleanup)(LV2_Handle Instance); | * called. */ | |||
void (*cleanup)(LV2_Handle Instance); | ||||
/** Function pointer that can be used to return additional instance data | /** Function pointer that can be used to return additional instance | |||
for | data for | |||
* a plugin defined by some extenion (e.g. a struct containing additional | * a plugin defined by some extenion (e.g. a struct containing addit | |||
* function pointers). | ional | |||
* | * function pointers). | |||
* The actual type and meaning of the returned object MUST be specified | * | |||
* precisely by the extension if it defines any extra data. If a particu | * The actual type and meaning of the returned object MUST be specif | |||
lar | ied | |||
* extension does not define extra instance data, this function MUST retu | * precisely by the extension if it defines any extra data. If a pa | |||
rn | rticular | |||
* NULL for that extension's URI. If a plugin does not support any | * extension does not define extra instance data, this function MUST | |||
* extensions that define extra instance data, this function pointer may | return | |||
be | * NULL for that extension's URI. If a plugin does not support any | |||
* set to NULL rather than providing an empty function. | * extensions that define extra instance data, this function pointer | |||
* | may be | |||
* The only parameter is the URI of the extension. The plugin MUST return | * set to NULL rather than providing an empty function. | |||
* NULL if it does not support the extension, but hosts SHOULD NOT use th | * | |||
is | * The only parameter is the URI of the extension. The plugin MUST r | |||
* as a discovery method (e.g. hosts should only call this function for | eturn | |||
* extensions known to be supported by the plugin from the data file). | * NULL if it does not support the extension, but hosts SHOULD NOT u | |||
* | se this | |||
* NOTE: It is highly recommended that this function returns a struct, an | * as a discovery method (e.g. hosts should only call this function | |||
d | for | |||
* NOT a direct function pointer. Standard C++ (for real reasons) does n | * extensions known to be supported by the plugin from the data file | |||
ot | ). | |||
* allow type casts from void* to a function pointer type. To provide | * | |||
* additional functions a struct should be returned containing the extra | * NOTE: It is highly recommended that this function returns a struc | |||
* function pointers (which is valid standard C++, and a much better idea | t, and | |||
* for extensibility anyway). | * NOT a direct function pointer. Standard C++ (for real reasons) d | |||
*/ | oes not | |||
void* (*extension_data)(const char * URI); | * allow type casts from void* to a function pointer type. To provi | |||
de | ||||
* additional functions a struct should be returned containing the e | ||||
xtra | ||||
* function pointers (which is valid standard C++, and a much better | ||||
idea | ||||
* for extensibility anyway). | ||||
*/ | ||||
void* (*extension_data)(const char * URI); | ||||
} LV2_Descriptor; | } LV2_Descriptor; | |||
/* ****************************************************************** */ | /* ****************************************************************** */ | |||
/** Accessing Plugin Types. | /** Accessing Plugin Types. | |||
* | * | |||
* The exact mechanism by which plugins are loaded is host-dependent, | * The exact mechanism by which plugins are loaded is host-dependent, | |||
* however all most hosts will need to know is the URI of the plugin they | * however all most hosts will need to know is the URI of the plugin they | |||
* wish to load. The environment variable LV2_PATH, if present, should | * wish to load. The environment variable LV2_PATH, if present, should | |||
End of changes. 9 change blocks. | ||||
172 lines changed or deleted | 216 lines changed or added | |||
plugin.h | plugin.h | |||
---|---|---|---|---|
skipping to change at line 80 | skipping to change at line 80 | |||
* is upgraded in an incompatible way (eg if it has different ports), it | * is upgraded in an incompatible way (eg if it has different ports), it | |||
* MUST have a different URI than it's predecessor. | * MUST have a different URI than it's predecessor. | |||
* | * | |||
* \return a shared string which must not be modified or free()'d. | * \return a shared string which must not be modified or free()'d. | |||
* | * | |||
* Time = O(1) | * Time = O(1) | |||
*/ | */ | |||
const char* | const char* | |||
slv2_plugin_get_uri(SLV2Plugin plugin); | slv2_plugin_get_uri(SLV2Plugin plugin); | |||
/** Get the (resolvable) URI of the plugins "main" bundle. | ||||
* | ||||
* This returns the URI of the bundle where the plugin itself was found. | ||||
* Note that the data for a plugin may be spread over many bundles, that is | ||||
, | ||||
* slv2_plugin_get_data_uris may returns URIs which are not below this one. | ||||
* | ||||
* Typical hosts should not need to use this function. | ||||
* | ||||
* Note this always returns a fully qualified URI. If you want a local | ||||
* filesystem path, use slv2_uri_to_path. | ||||
* | ||||
* \return a shared string which must not be modified or freed. | ||||
* | ||||
* Time = O(1) | ||||
*/ | ||||
const char* | ||||
slv2_plugin_get_bundle_uri(SLV2Plugin plugin); | ||||
/** Get the (resolvable) URIs of the RDF data files that define a plugin. | /** Get the (resolvable) URIs of the RDF data files that define a plugin. | |||
* | * | |||
* Typical hosts should not need to use this function. | ||||
* | ||||
* Note this always returns fully qualified URIs. If you want local | * Note this always returns fully qualified URIs. If you want local | |||
* filesystem paths, use slv2_uri_to_path. | * filesystem paths, use slv2_uri_to_path. | |||
* | * | |||
* \return a list of complete URLs eg. "file:///foo/ABundle.lv2/aplug.ttl", | * \return a list of complete URLs eg. "file:///foo/ABundle.lv2/aplug.ttl", | |||
* which is shared and must not be modified or freed. | * which is shared and must not be modified or freed. | |||
* | * | |||
* Time = O(1) | * Time = O(1) | |||
*/ | */ | |||
SLV2Values | SLV2Values | |||
slv2_plugin_get_data_uris(SLV2Plugin plugin); | slv2_plugin_get_data_uris(SLV2Plugin plugin); | |||
skipping to change at line 302 | skipping to change at line 322 | |||
* | * | |||
* To perform multiple calls on a port, the returned value should | * To perform multiple calls on a port, the returned value should | |||
* be cached and used repeatedly. | * be cached and used repeatedly. | |||
* | * | |||
* Time = O(n) | * Time = O(n) | |||
*/ | */ | |||
SLV2Port | SLV2Port | |||
slv2_plugin_get_port_by_symbol(SLV2Plugin plugin, | slv2_plugin_get_port_by_symbol(SLV2Plugin plugin, | |||
const char* symbol); | const char* symbol); | |||
/** Get a list of all GUIs available for this plugin. | ||||
* | ||||
* Note this returns the URI of the GUI, and not the path/URI to its shared | ||||
* library, use slv2_plugin_gui_get_library_uri with the values returned | ||||
* here for that. | ||||
* | ||||
* \param plugin The plugin to get the GUIs for. | ||||
* | ||||
* Time = Query | ||||
*/ | ||||
SLV2Values | ||||
slv2_plugin_get_guis(SLV2Plugin plugin); | ||||
/** Get the URI for a GUI library. | ||||
* | ||||
* \param plugin The plugin that the GUI is for. | ||||
* \param gui A GUI identifier as returned by slv2_plugin_get_guis() (wi | ||||
th type SLV2_VALUE_GUI). | ||||
* | ||||
* Time = Query | ||||
*/ | ||||
SLV2Value | ||||
slv2_plugin_get_gui_library_uri(SLV2Plugin plugin, | ||||
SLV2Value gui); | ||||
/** @} */ | /** @} */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* __SLV2_PLUGIN_H__ */ | #endif /* __SLV2_PLUGIN_H__ */ | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 46 lines changed or added | |||
plugininstance.h | plugininstance.h | |||
---|---|---|---|---|
skipping to change at line 72 | skipping to change at line 72 | |||
* (instances store only a copy of the plugin's URI). | * (instances store only a copy of the plugin's URI). | |||
* | * | |||
* \a host_features NULL-terminated array of features the host supports. | * \a host_features NULL-terminated array of features the host supports. | |||
* NULL may be passed if the host supports no additional features (unlike | * NULL may be passed if the host supports no additional features (unlike | |||
* the LV2 specification - SLV2 takes care of it). | * the LV2 specification - SLV2 takes care of it). | |||
* | * | |||
* \return NULL if instantiation failed. | * \return NULL if instantiation failed. | |||
*/ | */ | |||
SLV2Instance | SLV2Instance | |||
slv2_plugin_instantiate(SLV2Plugin plugin, | slv2_plugin_instantiate(SLV2Plugin plugin, | |||
uint32_t sample_rate, | double sample_rate, | |||
const LV2_Host_Feature** host_features); | const LV2_Host_Feature** host_features); | |||
/** Free a plugin instance. | /** Free a plugin instance. | |||
* | * | |||
* \a instance is invalid after this call. | * \a instance is invalid after this call. | |||
*/ | */ | |||
void | void | |||
slv2_instance_free(SLV2Instance instance); | slv2_instance_free(SLV2Instance instance); | |||
#ifndef LIBSLV2_SOURCE | #ifndef LIBSLV2_SOURCE | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
port.h | port.h | |||
---|---|---|---|---|
skipping to change at line 60 | skipping to change at line 60 | |||
SLV2Port port); | SLV2Port port); | |||
/** Port equivalent to slv2_plugin_get_hints. | /** Port equivalent to slv2_plugin_get_hints. | |||
* | * | |||
* Time = Query | * Time = Query | |||
*/ | */ | |||
SLV2Values | SLV2Values | |||
slv2_port_get_hints(SLV2Plugin plugin, | slv2_port_get_hints(SLV2Plugin plugin, | |||
SLV2Port port); | SLV2Port port); | |||
#if 0 | ||||
/** Return whether a port has a certain hint. | ||||
* | ||||
* Time = Query | ||||
*/ | ||||
bool | ||||
slv2_port_has_hint(SLV2Plugin p, | ||||
SLV2Port port, | ||||
SLV2Value hint) | ||||
#endif | ||||
/** Get the symbol of a port given the index. | /** Get the symbol of a port given the index. | |||
* | * | |||
* The 'symbol' is a short string, a valid C identifier. | * The 'symbol' is a short string, a valid C identifier. | |||
* Returned string must be free()'d by caller. | * Returned string must be free()'d by caller. | |||
* | * | |||
* \return NULL when index is out of range | * \return NULL when index is out of range | |||
* | * | |||
* Time = Query | * Time = Query | |||
*/ | */ | |||
char* | char* | |||
skipping to change at line 85 | skipping to change at line 96 | |||
* 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* | char* | |||
slv2_port_get_name(SLV2Plugin plugin, | slv2_port_get_name(SLV2Plugin plugin, | |||
SLV2Port port); | SLV2Port port); | |||
/** Get the class (input/output, data type, rate...) of a port. | /** Get the direction (input, output) of a port. | |||
* | * | |||
* Time = Query | * Time = Query | |||
*/ | */ | |||
SLV2PortClass | SLV2PortDirection | |||
slv2_port_get_class(SLV2Plugin plugin, | slv2_port_get_direction(SLV2Plugin plugin, | |||
SLV2Port port); | SLV2Port port); | |||
/** Get the data type of a port. | ||||
* | ||||
* Time = Query | ||||
*/ | ||||
SLV2PortDataType | ||||
slv2_port_get_data_type(SLV2Plugin plugin, | ||||
SLV2Port port); | ||||
/** Get the default value of a port. | /** Get the default value of a port. | |||
* | * | |||
* Only valid for ports with a data type of lv2:float. | * Only valid for ports with a data type of lv2:float. | |||
* | * | |||
* Time = Query | * Time = Query | |||
*/ | */ | |||
float | float | |||
slv2_port_get_default_value(SLV2Plugin plugin, | slv2_port_get_default_value(SLV2Plugin plugin, | |||
SLV2Port port); | SLV2Port port); | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 23 lines changed or added | |||
slv2.h | slv2.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
*/ | */ | |||
#ifndef __SLV2_H__ | #ifndef __SLV2_H__ | |||
#define __SLV2_H__ | #define __SLV2_H__ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#include <slv2/types.h> | #include <slv2/types.h> | |||
#include <slv2/gui.h> | ||||
#include <slv2/world.h> | #include <slv2/world.h> | |||
#include <slv2/pluginclass.h> | #include <slv2/pluginclass.h> | |||
#include <slv2/plugin.h> | #include <slv2/plugin.h> | |||
#include <slv2/port.h> | #include <slv2/port.h> | |||
#include <slv2/plugins.h> | #include <slv2/plugins.h> | |||
#include <slv2/pluginguiinstance.h> | ||||
#include <slv2/plugininstance.h> | #include <slv2/plugininstance.h> | |||
#include <slv2/value.h> | #include <slv2/value.h> | |||
#include <slv2/values.h> | #include <slv2/values.h> | |||
#include <slv2/util.h> | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* __SLV2_H__ */ | #endif /* __SLV2_H__ */ | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
types.h | types.h | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
#ifndef __SLV2_TYPES_H__ | #ifndef __SLV2_TYPES_H__ | |||
#define __SLV2_TYPES_H__ | #define __SLV2_TYPES_H__ | |||
#include <stdbool.h> | #include <stdbool.h> | |||
#include <stdint.h> | #include <stdint.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** Class (direction and type) of a port | /** (Data) Type of a port | |||
* | * | |||
* Note that ports may be of other classes not listed here, this is just | * SLV2_UNKNOWN_PORT_TYPE means the Port is not of any type SLV2 understand | |||
* to make the most common case simple. Use slv2_port_get_value(p, "rdf:ty | s | |||
pe") | * (currently Control, Audio, MIDI, and OSC). | |||
* if you need further class information. | * | |||
* Further class information can be using slv2_port_get_value(p, "rdf:type" | ||||
) | ||||
* or a custom query. | ||||
*/ | */ | |||
typedef enum _SLV2PortClass { | typedef enum _SLV2PortDataType { | |||
SLV2_UNKNOWN_PORT_CLASS, | SLV2_PORT_TYPE_UNKNOWN, | |||
SLV2_CONTROL_INPUT, /**< One input float per block */ | SLV2_PORT_TYPE_CONTROL, /**< One float per block */ | |||
SLV2_CONTROL_OUTPUT, /**< One output float per block */ | SLV2_PORT_TYPE_AUDIO, /**< One float per frame */ | |||
SLV2_AUDIO_INPUT, /**< One input float per frame */ | SLV2_PORT_TYPE_MIDI, /**< A buffer of MIDI data (LL extension) */ | |||
SLV2_AUDIO_OUTPUT, /**< One output float per frame */ | SLV2_PORT_TYPE_OSC, /**< A buffer of OSC data (DR extension) */ | |||
SLV2_MIDI_INPUT, /**< MIDI input (LL extension) */ | } SLV2PortDataType; | |||
SLV2_MIDI_OUTPUT /**< MIDI output (LL extension) */ | ||||
} SLV2PortClass; | /** Direction (input or output) of a port | |||
* | ||||
* SLV2_UNKNOWN_PORT_DIRECTION means the Port is only of type lv2:Port | ||||
* (neither lv2:Input or lv2:Output) as far as SLV2 understands. | ||||
* | ||||
* Further class information can be using slv2_port_get_value(p, "rdf:type" | ||||
) | ||||
* or a custom query. | ||||
*/ | ||||
typedef enum _SLV2PortDirection { | ||||
SLV2_PORT_DIRECTION_UNKNOWN, /**< Neither input or output */ | ||||
SLV2_PORT_DIRECTION_INPUT, /**< Plugin reads from port when run */ | ||||
SLV2_PORT_DIRECTION_OUTPUT, /**< Plugin writes to port when run */ | ||||
} SLV2PortDirection; | ||||
/** The format of a URI string. | /** The format of a URI string. | |||
* | * | |||
* Full URI: http://example.org/foo | * Full URI: http://example.org/foo | |||
* QName: lv2:Plugin | * QName: lv2:Plugin | |||
*/ | */ | |||
typedef enum _SLV2URIType { | typedef enum _SLV2URIType { | |||
SLV2_URI, | SLV2_URI, | |||
SLV2_QNAME | SLV2_QNAME | |||
} SLV2URIType; | } SLV2URIType; | |||
/** A type of plugin GUI (corresponding to some LV2 GUI extension). | ||||
*/ | ||||
typedef enum _SLV2GUIType { | ||||
SLV2_GUI_TYPE_GTK2 ///< http://ll-plugins.nongnu.org/lv2/ext/gtk2gui | ||||
} SLV2GUIType; | ||||
/** A port on a plugin. Opaque, but valid to compare to NULL. */ | /** A port on a plugin. Opaque, but valid to compare to NULL. */ | |||
typedef struct _SLV2Port* SLV2Port; | typedef struct _SLV2Port* SLV2Port; | |||
/** A plugin. Opaque, but valid to compare to NULL. */ | /** A plugin. Opaque, but valid to compare to NULL. */ | |||
typedef struct _SLV2Plugin* SLV2Plugin; | typedef struct _SLV2Plugin* SLV2Plugin; | |||
/** A collection of plugins. Opaque, but valid to compare to NULL. */ | /** A collection of plugins. Opaque, but valid to compare to NULL. */ | |||
typedef void* SLV2Plugins; | typedef void* SLV2Plugins; | |||
/** The world. Opaque, but valid to compare to NULL. */ | /** The world. Opaque, but valid to compare to NULL. */ | |||
skipping to change at line 79 | skipping to change at line 99 | |||
/** A collection of plugin classes. Opaque, but valid to compare to NULL. */ | /** A collection of plugin classes. Opaque, but valid to compare to NULL. */ | |||
typedef void* SLV2PluginClasses; | typedef void* SLV2PluginClasses; | |||
/** A typed value */ | /** A typed value */ | |||
typedef struct _SLV2Value* SLV2Value; | typedef struct _SLV2Value* SLV2Value; | |||
/** A collection of typed values. */ | /** A collection of typed values. */ | |||
typedef void* SLV2Values; | typedef void* SLV2Values; | |||
/** A plugin GUI */ | ||||
typedef void* SLV2GUI; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* __SLV2_TYPES_H__ */ | #endif /* __SLV2_TYPES_H__ */ | |||
End of changes. 5 change blocks. | ||||
14 lines changed or deleted | 39 lines changed or added | |||
value.h | value.h | |||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
/** \addtogroup data | /** \addtogroup data | |||
* @{ | * @{ | |||
*/ | */ | |||
/** Free an SLV2Value. | /** Free an SLV2Value. | |||
*/ | */ | |||
void | void | |||
slv2_value_free(SLV2Value val); | slv2_value_free(SLV2Value val); | |||
/** Duplicate an SLV2Value. | ||||
*/ | ||||
SLV2Value | ||||
slv2_value_duplicate(SLV2Value val); | ||||
/** Return whether two values are equivalent. | /** Return whether two values are equivalent. | |||
*/ | */ | |||
bool | bool | |||
slv2_value_equals(SLV2Value value, SLV2Value other); | slv2_value_equals(SLV2Value value, SLV2Value other); | |||
/** Return this value as a Turtle/SPARQL token. | /** Return this value as a Turtle/SPARQL token. | |||
* Examples: | * Examples: | |||
* <http://example.org/foo> | * <http://example.org/foo> | |||
* doap:name | * doap:name | |||
* "this is a string" | * "this is a string" | |||
* 1.0 | * 1.0 | |||
* 1 | * 1 | |||
* | * | |||
* Returned string is newly allocation and must be freed by caller. | * Returned string is newly allocation and must be freed by caller. | |||
*/ | */ | |||
char* | char* | |||
slv2_value_get_turtle_token(SLV2Value value); | slv2_value_get_turtle_token(SLV2Value value); | |||
/** Return whether the value is a URI (resource). | /** Return whether the value is a URI (resource). | |||
* | * | |||
* Time = O(1) | * Time = O(1) | |||
*/ | */ | |||
bool | bool | |||
slv2_value_is_uri(SLV2Value value); | slv2_value_is_uri(SLV2Value value); | |||
/** Return this value as a URI string, e.g. "http://example.org/foo". | /** Return this value as a URI string, e.g. "http://example.org/foo". | |||
* | * | |||
* Valid to call only if slv2_value_is_uri(\a value) or | * Valid to call only if slv2_value_is_uri(\a value) or | |||
* slv2_value_is_qname(\a value) returns true. | * slv2_value_is_gui(\a value) returns true. | |||
* Returned value is owned by \a value and must not be freed by caller. | * Returned value is owned by \a value and must not be freed by caller. | |||
* | * | |||
* Time = O(1) | * Time = O(1) | |||
*/ | */ | |||
const char* | const char* | |||
slv2_value_as_uri(SLV2Value value); | slv2_value_as_uri(SLV2Value value); | |||
#if 0 | #if 0 | |||
/** Return whether the value is a QName ("qualified name", a prefixed URI). | /** Return whether the value is a QName ("qualified name", a prefixed URI). | |||
* | * | |||
skipping to change at line 154 | skipping to change at line 159 | |||
/** Return \a value as an integer. | /** Return \a value as an integer. | |||
* | * | |||
* Valid to call only if slv2_value_is_int(\a value) returns true. | * Valid to call only if slv2_value_is_int(\a value) returns true. | |||
* | * | |||
* Time = O(1) | * Time = O(1) | |||
*/ | */ | |||
int | int | |||
slv2_value_as_int(SLV2Value value); | slv2_value_as_int(SLV2Value value); | |||
/** Return whether this value is a GUI (URI and type). | ||||
* | ||||
* If this returns true, slv2_value_as_uri will return the URI of the GUI, | ||||
* and slv2_value_as_gui_type will return the SLV2GUIType (which can be | ||||
* used to find the URI of the corresponding GUI spec itself, with | ||||
* slv2_gui_type_get_uri). | ||||
* | ||||
* Time = O(1) | ||||
*/ | ||||
bool | ||||
slv2_value_is_gui(SLV2Value value); | ||||
/** Return \a value as an SLV2GUIType. | ||||
* | ||||
* Valid to call only if slv2_value_is_gui(\a value) returns true. | ||||
* | ||||
* Time = O(1) | ||||
*/ | ||||
SLV2GUIType | ||||
slv2_value_as_gui_type(SLV2Value value); | ||||
/** @} */ | /** @} */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* __SLV2_VALUE_H__ */ | #endif /* __SLV2_VALUE_H__ */ | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 28 lines changed or added | |||
world.h | world.h | |||
---|---|---|---|---|
skipping to change at line 50 | skipping to change at line 50 | |||
* | * | |||
* Normal hosts should NOT have to refer to bundles directly under normal | * Normal hosts should NOT have to refer to bundles directly under normal | |||
* circumstances. However, functions are provided to load individual bundl es | * circumstances. However, functions are provided to load individual bundl es | |||
* explicitly, intended for hosts which depend on a specific bundle | * explicitly, intended for hosts which depend on a specific bundle | |||
* (which is shipped with the application). | * (which is shipped with the application). | |||
* | * | |||
* @{ | * @{ | |||
*/ | */ | |||
/** Initialize a new, empty world. | /** Initialize a new, empty world. | |||
* | ||||
* If initialization fails, NULL is returned. | ||||
*/ | */ | |||
SLV2World | SLV2World | |||
slv2_world_new(); | slv2_world_new(); | |||
/** Initialize a new, empty world, using an existing Redland context. | /** Initialize a new, empty world, using an existing Redland context. | |||
*/ | */ | |||
SLV2World | SLV2World | |||
slv2_world_new_using_rdf_world(librdf_world* world); | slv2_world_new_using_rdf_world(librdf_world* world); | |||
/** Destroy the world, mwahaha. | /** Destroy the world, mwahaha. | |||
* | * | |||
* NB: Destroying the world will leave dangling references in any plugin li sts, | * NB: Destroying the world will leave dangling references in any plugin li sts, | |||
* plugins, etc. Do not destroy the world until you are finished with all | * plugins, etc. Do not destroy the world until you are finished with all | |||
* objects that came from it. | * objects that came from it. | |||
*/ | */ | |||
void | void | |||
slv2_world_free(SLV2World world); | slv2_world_free(SLV2World world); | |||
#if 0 | ||||
/** Set the RDF lock function. | ||||
* | ||||
* If set, this function will be called before any calls to librdf function | ||||
s. | ||||
* This can be used to make SLV2 thread-safe. | ||||
* | ||||
* \a lock will be called with \a data as a parameter, whenever SLV2 is goi | ||||
ng | ||||
* to perform an RDF operation. | ||||
*/ | ||||
void | ||||
slv2_world_set_rdf_lock_function(SLV2World world, void (*lock)(void*), void | ||||
* data); | ||||
/** Set the unlock function. | ||||
* | ||||
* This is the counterpart to the RDF lock function set with | ||||
* slv2_world_set_rdf_lock_function. Be sure to call this after locking, | ||||
* or a deadlock will occur. | ||||
* | ||||
* \a unlock will be called with the same data pointer set with | ||||
* slv2_world_set_rdf_lock_function. | ||||
*/ | ||||
void | ||||
slv2_world_set_rdf_unlock_function(SLV2World world, void (*unlock)(void*)); | ||||
#endif | ||||
/** Load all installed LV2 bundles on the system. | /** Load all installed LV2 bundles on the system. | |||
* | * | |||
* This is the recommended way for hosts to load LV2 data. It does the mos t | * This is the recommended way for hosts to load LV2 data. It does the mos t | |||
* reasonable thing to find all installed plugins, extensions, etc. on the | * reasonable thing to find all installed plugins, extensions, etc. on the | |||
* system. The environment variable LV2_PATH may be used to set the | * system. The environment variable LV2_PATH may be used to set the | |||
* directories inside which this function will look for bundles. Otherwise | * directories inside which this function will look for bundles. Otherwise | |||
* a sensible, standard default will be used. | * a sensible, standard default will be used. | |||
* | * | |||
* Use of other functions for loading bundles is \em highly discouraged | * Use of other functions for loading bundles is \em highly discouraged | |||
* without a special reason to do so - use this one. | * without a special reason to do so - use this one. | |||
skipping to change at line 177 | skipping to change at line 204 | |||
/** Get plugins filtered by a user-defined SPARQL query. | /** Get plugins filtered by a user-defined SPARQL query. | |||
* | * | |||
* This is much faster than using slv2_world_get_plugins_by_filter with a | * This is much faster than using slv2_world_get_plugins_by_filter with a | |||
* filter function which calls the various slv2_plugin_* functions. | * filter function which calls the various slv2_plugin_* functions. | |||
* | * | |||
* \param query A valid SPARQL query which SELECTs a single variable, which | * \param query A valid SPARQL query which SELECTs a single variable, which | |||
* should match the URI of plugins to be loaded. | * should match the URI of plugins to be loaded. | |||
* | * | |||
* \b Example: Get all plugins with at least 1 audio input and output: | * \b Example: Get all plugins with at least 1 audio input and output: | |||
<tt> \verbatim | <tt> \verbatim | |||
PREFIX : <http://lv2plug.in/ontology#> | PREFIX : <http://lv2plug.in/ns/lv2core#> | |||
SELECT DISTINCT ?plugin WHERE { | SELECT DISTINCT ?plugin WHERE { | |||
?plugin :port [ a :AudioPort; a :InputPort ] ; | ?plugin :port [ a :AudioPort; a :InputPort ] ; | |||
:port [ a :AudioPort; a :OutputPort ] . | :port [ a :AudioPort; a :OutputPort ] . | |||
} | } | |||
\endverbatim </tt> | \endverbatim </tt> | |||
* | * | |||
* Returned plugins contain a reference to this world, world must not be | * Returned plugins contain a reference to this world, world must not be | |||
* destroyed until plugins are finished with. | * destroyed until plugins are finished with. | |||
*/ | */ | |||
SLV2Plugins | SLV2Plugins | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 31 lines changed or added | |||