summaryrefslogtreecommitdiff
path: root/libs/ardour/lv2
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-11-23 06:39:45 +0000
committerDavid Robillard <d@drobilla.net>2011-11-23 06:39:45 +0000
commitfd47b579b50dde747ae71ff94d34625dae3cb477 (patch)
treee364e6c646b22e2476cc0a1ca88c0837bedb6824 /libs/ardour/lv2
parentfbc147d929a495cb007f4de52d40e68132555320 (diff)
Implement latest LV2 state extension (0.4).
Corresponding patch to LinuxSampler available here: http://drobilla.net/files/linuxsampler_lv2_state_0_4.diff git-svn-id: svn://localhost/ardour2/branches/3.0@10788 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/lv2')
-rw-r--r--libs/ardour/lv2/lv2plug.in/ns/ext/files/files.h140
-rw-r--r--libs/ardour/lv2/lv2plug.in/ns/ext/state/state.h96
2 files changed, 96 insertions, 140 deletions
diff --git a/libs/ardour/lv2/lv2plug.in/ns/ext/files/files.h b/libs/ardour/lv2/lv2plug.in/ns/ext/files/files.h
deleted file mode 100644
index f996e2ed16..0000000000
--- a/libs/ardour/lv2/lv2plug.in/ns/ext/files/files.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- Copyright 2010-2011 David Robillard <d@drobilla.net>
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/**
- @file files.h
- C API for the LV2 Files extension <http://lv2plug.in/ns/ext/files>.
-*/
-
-#ifndef LV2_FILES_H
-#define LV2_FILES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LV2_FILES_URI "http://lv2plug.in/ns/ext/files"
-#define LV2_FILES_PATH_SUPPORT_URI LV2_FILES_URI "#pathSupport"
-#define LV2_FILES_NEW_FILE_SUPPORT_URI LV2_FILES_URI "#newFileSupport"
-
-typedef void* LV2_Files_Host_Data;
-
-/**
- files:pathSupport feature struct.
-
- To support this feature, the host MUST pass an LV2_Feature struct with @a
- URI @ref LV2_FILES_PATH_SUPPORT_URI and @a data pointed to an instance of
- this struct.
-*/
-typedef struct {
-
- /**
- Opaque host data.
- */
- LV2_Files_Host_Data host_data;
-
- /**
- Map an absolute path to an abstract path for use in plugin state.
- @param host_data MUST be the @a host_data member of this struct.
- @param absolute_path The absolute path of a file.
- @return An abstract path suitable for use in plugin state.
-
- The plugin MUST use this function to map any paths that will be stored
- in plugin state. The returned value is an abstract path which MAY not
- be an actual file system path; @ref absolute_path MUST be used to map it
- to an actual path in order to use the file.
-
- Hosts MAY map paths in any way (e.g. by creating symbolic links within
- the plugin's state directory or storing a list of referenced files for
- later export). Plugins MUST NOT make any assumptions about abstract
- paths except that they can be mapped to an absolute path using @ref
- absolute_path. Particularly when restoring from state, this absolute
- path MAY not be the same as the original absolute path, but the host
- MUST guarantee it refers to a file with contents equivalent to the
- original.
-
- This function may only be called within the context of
- LV2_Persist.save() or LV2_Persist.restore(). The caller is responsible
- for freeing the returned value.
- */
- char* (*abstract_path)(LV2_Files_Host_Data host_data,
- const char* absolute_path);
-
- /**
- Map an abstract path from plugin state to an absolute path.
- @param host_data MUST be the @a host_data member of this struct.
- @param abstract_path An abstract path (e.g. a path from plugin state).
- @return An absolute file system path.
-
- Since abstract paths are not necessarily actual file paths (or at least
- not necessarily absolute paths), this function MUST be used in order to
- actually open or otherwise use the file referred to by an abstract path.
-
- This function may only be called within the context of
- LV2_Persist.save() or LV2_Persist.restore(). The caller is responsible
- for freeing the returned value.
- */
- char* (*absolute_path)(LV2_Files_Host_Data host_data,
- const char* abstract_path);
-
-} LV2_Files_Path_Support;
-
-/**
- files:newFileSupport feature struct.
-
- To support this feature, the host MUST pass an LV2_Feature struct with @a
- URI @ref LV2_FILES_NEW_FILE_SUPPORT_URI and @a data pointed to an instance
- of this struct.
-*/
-typedef struct {
-
- /**
- Opaque host data.
- */
- LV2_Files_Host_Data host_data;
-
- /**
- Return an absolute path the plugin may use to create a new file.
- @param host_data MUST be the @a host_data member of this struct.
- @param relative_path The relative path of the file.
- @return The absolute path to use for the new file.
-
- The plugin can assume @a relative_path is relative to a namespace
- dedicated to that plugin instance; hosts MUST ensure this, e.g. by
- giving each plugin instance its own state directory. The returned path
- is absolute and thus suitable for creating and using a file, but NOT
- suitable for storing in plugin state (it MUST be mapped to an abstract
- path using @ref LV2_Files_Path_Support::abstract_path to do so).
-
- This function may be called from any non-realtime context. The caller
- is responsible for freeing the returned value.
- */
- char* (*new_file_path)(LV2_Files_Host_Data host_data,
- const char* relative_path);
-
-} LV2_Files_New_File_Support;
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* LV2_FILES_H */
diff --git a/libs/ardour/lv2/lv2plug.in/ns/ext/state/state.h b/libs/ardour/lv2/lv2plug.in/ns/ext/state/state.h
index 4e1c28a3b8..3d390120d7 100644
--- a/libs/ardour/lv2/lv2plug.in/ns/ext/state/state.h
+++ b/libs/ardour/lv2/lv2plug.in/ns/ext/state/state.h
@@ -36,8 +36,13 @@ extern "C" {
#define LV2_STATE_URI "http://lv2plug.in/ns/ext/state"
#define LV2_STATE_INTERFACE_URI LV2_STATE_URI "#Interface"
+#define LV2_STATE_PATH_URI LV2_STATE_URI "#Path"
+#define LV2_STATE_MAP_PATH_URI LV2_STATE_URI "#pathMap"
+#define LV2_STATE_MAKE_PATH_URI LV2_STATE_URI "#newPath"
typedef void* LV2_State_Handle;
+typedef void* LV2_State_Map_Path_Handle;
+typedef void* LV2_State_Make_Path_Handle;
/**
Flags describing value characteristics.
@@ -251,6 +256,97 @@ typedef struct _LV2_State_Interface {
} LV2_State_Interface;
+/**
+ Feature data for state:pathMap (LV2_STATE_MAP_PATH_URI).
+*/
+typedef struct {
+
+ /**
+ Opaque host data.
+ */
+ LV2_State_Map_Path_Handle handle;
+
+ /**
+ Map an absolute path to an abstract path for use in plugin state.
+ @param handle MUST be the @a handle member of this struct.
+ @param absolute_path The absolute path of a file.
+ @return An abstract path suitable for use in plugin state.
+
+ The plugin MUST use this function to map any paths that will be stored
+ in files in plugin state. The returned value is an abstract path which
+ MAY not be an actual file system path; @ref absolute_path MUST be used
+ to map it to an actual path in order to use the file.
+
+ Hosts MAY map paths in any way (e.g. by creating symbolic links within
+ the plugin's state directory or storing a list of referenced files
+ elsewhere). Plugins MUST NOT make any assumptions about abstract paths
+ except that they can be mapped back to an absolute path using @ref
+ absolute_path.
+
+ This function may only be called within the context of
+ LV2_State_Interface.save() or LV2_State_Interface.restore(). The caller
+ is responsible for freeing the returned value.
+ */
+ char* (*abstract_path)(LV2_State_Map_Path_Handle handle,
+ const char* absolute_path);
+
+ /**
+ Map an abstract path from plugin state to an absolute path.
+ @param handle MUST be the @a handle member of this struct.
+ @param abstract_path An abstract path (e.g. a path from plugin state).
+ @return An absolute file system path.
+
+ Since abstract paths are not necessarily actual file paths (or at least
+ not necessarily absolute paths), this function MUST be used in order to
+ actually open or otherwise use the file referred to by an abstract path.
+
+ This function may only be called within the context of
+ LV2_State_Interface.save() or LV2_State_Interface.restore(). The caller
+ is responsible for freeing the returned value.
+ */
+ char* (*absolute_path)(LV2_State_Map_Path_Handle handle,
+ const char* abstract_path);
+
+} LV2_State_Map_Path;
+
+/**
+ Feature data for state:makePath (@ref LV2_STATE_MAKE_PATH_URI).
+*/
+typedef struct {
+
+ /**
+ Opaque host data.
+ */
+ LV2_State_Make_Path_Handle handle;
+
+ /**
+ Return a path the plugin may use to create a new file.
+ @param handle MUST be the @a handle member of this struct.
+ @param path The path of the new file relative to a namespace unique
+ to this plugin instance.
+ @return The absolute path to use for the new file.
+
+ This function can be used by plugins to create files and directories,
+ either at state saving time (if this feature is passed to
+ LV2_State_Interface.save()) or any time (if this feature is passed to
+ LV2_Descriptor.instantiate()).
+
+ The host must do whatever is necessary for the plugin to be able to
+ create a file at the returned path (e.g. using fopen), including
+ creating any leading directories.
+
+ If this function is passed to LV2_Descriptor.instantiate(), it may be
+ called from any non-realtime context. If it is passed to
+ LV2_State_Interface.save(), it may only be called within the dynamic
+ scope of that function call.
+
+ The caller is responsible for freeing the returned value with free().
+ */
+ char* (*path)(LV2_State_Make_Path_Handle handle,
+ const char* path);
+
+} LV2_State_Make_Path;
+
#ifdef __cplusplus
} /* extern "C" */
#endif