comparison vamp-sdk/hostext/PluginLoader.h @ 75:0f8524203677

* doc updates
author cannam
date Thu, 07 Jun 2007 13:56:26 +0000
parents 6d16c376fd2f
children 6683f99107cf
comparison
equal deleted inserted replaced
74:64d45f526afc 75:0f8524203677
57 * of becoming a Vamp plugin host for any C++ application. 57 * of becoming a Vamp plugin host for any C++ application.
58 * 58 *
59 * Hosts are not required by the Vamp specification to use the same 59 * Hosts are not required by the Vamp specification to use the same
60 * plugin search path and naming conventions as implemented by this 60 * plugin search path and naming conventions as implemented by this
61 * class, and are certainly not required to use this actual class. 61 * class, and are certainly not required to use this actual class.
62 * But it's recommended, for sound practical reasons. 62 * But we do strongly recommend it.
63 *
64 * \note This class was introduced version 1.1 of the Vamp plugin SDK.
63 */ 65 */
64 66
65 class PluginLoader 67 class PluginLoader
66 { 68 {
67 public: 69 public:
68 /** 70 /**
69 * PluginLoader is a singleton class. This function returns a 71 * Obtain a pointer to the singleton instance of PluginLoader.
70 * pointer to the single instance of it. Use this to obtain your 72 * Use this to obtain your loader object.
71 * loader object.
72 */ 73 */
73 static PluginLoader *getInstance(); 74 static PluginLoader *getInstance();
74 75
75 /** 76 /**
76 * PluginKey is a string type that is used to identify a plugin 77 * PluginKey is a string type that is used to identify a plugin
78 * of the lower-cased base name of the plugin library, a colon 79 * of the lower-cased base name of the plugin library, a colon
79 * separator, and the identifier string for the plugin. It is 80 * separator, and the identifier string for the plugin. It is
80 * only meaningful in the context of a given plugin path (the one 81 * only meaningful in the context of a given plugin path (the one
81 * returned by PluginHostAdapter::getPluginPath()). 82 * returned by PluginHostAdapter::getPluginPath()).
82 * 83 *
83 * Use composePluginKey to construct a plugin key from a known 84 * Use composePluginKey() to construct a plugin key from a known
84 * plugin library name and identifier. 85 * plugin library name and identifier.
85 * 86 *
86 * Note: the fact that the library component of the key is 87 * Note: the fact that the library component of the key is
87 * lower-cased implies that library names are matched 88 * lower-cased implies that library names are matched
88 * case-insensitively by the PluginLoader class, regardless of the 89 * case-insensitively by the PluginLoader class, regardless of the
89 * case sensitivity of the underlying filesystem. (Plugin 90 * case sensitivity of the underlying filesystem. (Plugin
90 * identifiers _are_ case sensitive, however.) Also, it is not 91 * identifiers _are_ case sensitive, however.) Also, it is not
91 * possible to portably extract a working library name from a 92 * possible to portably extract a working library name from a
92 * plugin key, as the result may fail on case-sensitive 93 * plugin key, as the result may fail on case-sensitive
93 * filesystems. Use getLibraryPathForPlugin instead. 94 * filesystems. Use getLibraryPathForPlugin() instead.
94 */ 95 */
95 typedef std::string PluginKey; 96 typedef std::string PluginKey;
96 97
97 /** 98 /**
98 * PluginKeyList is a sequence of plugin keys, such as returned by 99 * PluginKeyList is a sequence of plugin keys, such as returned by
99 * a plugin lookup function. 100 * listPlugins().
100 */ 101 */
101 typedef std::vector<PluginKey> PluginKeyList; 102 typedef std::vector<PluginKey> PluginKeyList;
102 103
103 /** 104 /**
104 * PluginCategoryHierarchy is a sequence of general->specific 105 * PluginCategoryHierarchy is a sequence of general->specific
105 * category names, as may be associated with a single plugin. 106 * category names, as may be associated with a single plugin.
106 * This sequence describes the location of a plugin within a 107 * This sequence describes the location of a plugin within a
107 * category forest, containing the human-readable names of the 108 * category forest, containing the human-readable names of the
108 * plugin's category tree root, followed by each of the nodes down 109 * plugin's category tree root, followed by each of the nodes down
109 * to the leaf containing the plugin. 110 * to the leaf containing the plugin.
111 *
112 * \see getPluginCategory()
110 */ 113 */
111 typedef std::vector<std::string> PluginCategoryHierarchy; 114 typedef std::vector<std::string> PluginCategoryHierarchy;
112 115
113 /** 116 /**
114 * Search for all available Vamp plugins, and return a list of 117 * Search for all available Vamp plugins, and return a list of
134 * to handle any mismatch between the number of channels of audio 137 * to handle any mismatch between the number of channels of audio
135 * the plugin can handle and the number available in the host. 138 * the plugin can handle and the number available in the host.
136 * This enables a host to use plugins that may require the input 139 * This enables a host to use plugins that may require the input
137 * to be mixed down to mono, etc., without having to worry about 140 * to be mixed down to mono, etc., without having to worry about
138 * doing that itself. 141 * doing that itself.
142 *
143 * ADAPT_ALL - Perform all available adaptations, where meaningful.
139 * 144 *
140 * See PluginInputDomainAdapter and PluginChannelAdapter for more 145 * See PluginInputDomainAdapter and PluginChannelAdapter for more
141 * details of the classes that the loader may use if these flags 146 * details of the classes that the loader may use if these flags
142 * are set. 147 * are set.
143 */ 148 */
149 154
150 /** 155 /**
151 * Load a Vamp plugin, given its identifying key. If the plugin 156 * Load a Vamp plugin, given its identifying key. If the plugin
152 * could not be loaded, returns 0. 157 * could not be loaded, returns 0.
153 * 158 *
154 * adapterFlags is a bitwise OR of the values in the AdapterFlags
155 * enum, indicating under which circumstances an adapter should be
156 * used to wrap the original plugin. See AdapterFlags for more
157 * details. If adapterFlags is 0, no optional adapters will be
158 * used.
159 *
160 * The returned plugin should be deleted (using the standard C++ 159 * The returned plugin should be deleted (using the standard C++
161 * delete) after use. 160 * delete keyword) after use.
161 *
162 * \param adapterFlags a bitwise OR of the values in the AdapterFlags
163 * enumeration, indicating under which circumstances an adapter should be
164 * used to wrap the original plugin. If adapterFlags is 0, no
165 * optional adapters will be used. Otherwise, the returned plugin
166 * may be of an adapter class type which will behave identically
167 * to the original plugin, apart from any particular features
168 * implemented by the adapter itself.
169 *
170 * \see AdapterFlags, PluginInputDomainAdapter, PluginChannelAdapter
162 */ 171 */
163 Plugin *loadPlugin(PluginKey key, 172 Plugin *loadPlugin(PluginKey key,
164 float inputSampleRate, 173 float inputSampleRate,
165 int adapterFlags = 0); 174 int adapterFlags = 0);
166 175
167 /** 176 /**
168 * Given a Vamp plugin library name and plugin identifier, return 177 * Given a Vamp plugin library name and plugin identifier, return
169 * the corresponding plugin key in a form suitable for passing in to 178 * the corresponding plugin key in a form suitable for passing in to
170 * loadPlugin. 179 * loadPlugin().
171 */ 180 */
172 PluginKey composePluginKey(std::string libraryName, 181 PluginKey composePluginKey(std::string libraryName,
173 std::string identifier); 182 std::string identifier);
174 183
175 /** 184 /**
176 * Return the category hierarchy for a Vamp plugin, given its 185 * Return the category hierarchy for a Vamp plugin, given its
177 * identifying key. See PluginCategoryHierarchy documentation for 186 * identifying key.
178 * more details.
179 * 187 *
180 * If the plugin has no category information, return an empty 188 * If the plugin has no category information, return an empty
181 * hierarchy. 189 * hierarchy.
190 *
191 * \see PluginCategoryHierarchy
182 */ 192 */
183 PluginCategoryHierarchy getPluginCategory(PluginKey plugin); 193 PluginCategoryHierarchy getPluginCategory(PluginKey plugin);
184 194
185 /** 195 /**
186 * Return the file path of the dynamic library from which the 196 * Return the file path of the dynamic library from which the