Mercurial > hg > vamp-plugin-sdk
comparison vamp-hostsdk/RequestResponse.h @ 460:b409560a805b
Merge from branch vampipe
author | Chris Cannam |
---|---|
date | Mon, 10 Oct 2016 15:48:35 +0100 |
parents | 8dea61e4a7be |
children | d6262c77e5a5 |
comparison
equal
deleted
inserted
replaced
442:4101e3f80aa0 | 460:b409560a805b |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Vamp | |
5 | |
6 An API for audio analysis and feature extraction plugins. | |
7 | |
8 Centre for Digital Music, Queen Mary, University of London. | |
9 Copyright 2006-2016 Chris Cannam and QMUL. | |
10 | |
11 Permission is hereby granted, free of charge, to any person | |
12 obtaining a copy of this software and associated documentation | |
13 files (the "Software"), to deal in the Software without | |
14 restriction, including without limitation the rights to use, copy, | |
15 modify, merge, publish, distribute, sublicense, and/or sell copies | |
16 of the Software, and to permit persons to whom the Software is | |
17 furnished to do so, subject to the following conditions: | |
18 | |
19 The above copyright notice and this permission notice shall be | |
20 included in all copies or substantial portions of the Software. | |
21 | |
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR | |
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
29 | |
30 Except as contained in this notice, the names of the Centre for | |
31 Digital Music; Queen Mary, University of London; and Chris Cannam | |
32 shall not be used in advertising or otherwise to promote the sale, | |
33 use or other dealings in this Software without prior written | |
34 authorization. | |
35 */ | |
36 | |
37 #ifndef VAMP_REQUEST_RESPONSE_H | |
38 #define VAMP_REQUEST_RESPONSE_H | |
39 | |
40 #include "PluginStaticData.h" | |
41 #include "PluginConfiguration.h" | |
42 | |
43 #include "hostguard.h" | |
44 | |
45 #include <map> | |
46 #include <string> | |
47 | |
48 _VAMP_SDK_HOSTSPACE_BEGIN(RequestResponse.h) | |
49 | |
50 namespace Vamp { | |
51 | |
52 class Plugin; | |
53 | |
54 namespace HostExt { | |
55 | |
56 /** | |
57 * \class LoadRequest RequestResponse.h <vamp-hostsdk/RequestResponse.h> | |
58 * | |
59 * Vamp::HostExt::LoadRequest is a structure containing the | |
60 * information necessary to load a plugin. When a request is made to | |
61 * load a plugin using a LoadRequest, the response is typically | |
62 * returned in a LoadResponse structure. | |
63 * | |
64 * \see LoadResponse | |
65 * | |
66 * \note This class was introduced in version 2.7 of the Vamp plugin | |
67 * SDK, along with the PluginLoader method that accepts this structure | |
68 * rather than accepting its elements individually. | |
69 */ | |
70 struct LoadRequest | |
71 { | |
72 LoadRequest() : // invalid request by default | |
73 inputSampleRate(0.f), | |
74 adapterFlags(0) { } | |
75 | |
76 /** | |
77 * PluginKey is a string type that is used to identify a plugin | |
78 * uniquely within the scope of "the current system". For further | |
79 * details \see PluginLoader::PluginKey. | |
80 */ | |
81 typedef std::string PluginKey; | |
82 | |
83 /** | |
84 * The identifying key for the plugin to be loaded. | |
85 */ | |
86 PluginKey pluginKey; | |
87 | |
88 /** | |
89 * Sample rate to be passed to the plugin's constructor. | |
90 */ | |
91 float inputSampleRate; | |
92 | |
93 /** | |
94 * A bitwise OR of the values in the PluginLoader::AdapterFlags | |
95 * enumeration, indicating under which circumstances an adapter | |
96 * should be used to wrap the original plugin. If adapterFlags is | |
97 * 0, no optional adapters will be used. | |
98 * | |
99 * \see PluginLoader::AdapterFlags, PluginLoader::loadPlugin | |
100 */ | |
101 int adapterFlags; | |
102 }; | |
103 | |
104 /** | |
105 * \class LoadResponse RequestResponse.h <vamp-hostsdk/RequestResponse.h> | |
106 * | |
107 * Vamp::HostExt::LoadResponse is a structure containing the | |
108 * information returned by PluginLoader when asked to load a plugin | |
109 * using a LoadRequest. | |
110 * | |
111 * If the plugin could not be loaded, the plugin field will be 0. | |
112 * | |
113 * The caller takes ownership of the plugin contained here, which | |
114 * should be deleted (using the standard C++ delete keyword) after | |
115 * use. | |
116 * | |
117 * \see LoadRequest | |
118 * | |
119 * \note This class was introduced in version 2.7 of the Vamp plugin | |
120 * SDK, along with the PluginLoader method that returns this structure. | |
121 */ | |
122 struct LoadResponse | |
123 { | |
124 LoadResponse() : // invalid (failed) response by default | |
125 plugin(0) { } | |
126 | |
127 /** | |
128 * A pointer to the loaded plugin, or 0 if loading failed. Caller | |
129 * takes ownership of the plugin and must delete it after use. | |
130 */ | |
131 Plugin *plugin; | |
132 | |
133 /** | |
134 * The static data associated with the loaded plugin, that is, all | |
135 * information about it that does not depend on its configuration | |
136 * (parameters, programs, initialisation parameters). The contents | |
137 * of this structure are only valid if plugin is non-0. | |
138 * | |
139 * Much of the data in here is duplicated with the plugin itself. | |
140 */ | |
141 PluginStaticData staticData; | |
142 | |
143 /** | |
144 * The default configuration for this plugin, that is, default | |
145 * values for parameters etc. The contents of this structure are | |
146 * only valid if plugin is non-0. | |
147 */ | |
148 PluginConfiguration defaultConfiguration; | |
149 }; | |
150 | |
151 /** | |
152 * \class ConfigurationRequest RequestResponse.h <vamp-hostsdk/RequestResponse.h> | |
153 * | |
154 * A wrapper for a plugin pointer and PluginConfiguration, bundling up | |
155 * the data needed to configure a plugin after it has been loaded. | |
156 * | |
157 * \see PluginConfiguration, ConfigurationResponse, LoadRequest, LoadResponse | |
158 * | |
159 * \note This class was introduced in version 2.7 of the Vamp plugin | |
160 * SDK, along with the PluginLoader method that returns this structure. | |
161 */ | |
162 struct ConfigurationRequest | |
163 { | |
164 public: | |
165 ConfigurationRequest() : // invalid request by default | |
166 plugin(0) { } | |
167 | |
168 Plugin *plugin; | |
169 PluginConfiguration configuration; | |
170 }; | |
171 | |
172 /** | |
173 * \class ConfigurationResponse RequestResponse.h <vamp-hostsdk/RequestResponse.h> | |
174 * | |
175 * The return value from a configuration request (i.e. setting the | |
176 * parameters and initialising the plugin). If the configuration was | |
177 * successful, the output list will contain the final | |
178 * post-initialisation output descriptors. If configuration failed, | |
179 * the output list will be empty. | |
180 * | |
181 * \see PluginConfiguration, ConfigurationRequest, LoadRequest, LoadResponse | |
182 * | |
183 * \note This class was introduced in version 2.7 of the Vamp plugin | |
184 * SDK, along with the PluginLoader method that returns this structure. | |
185 */ | |
186 struct ConfigurationResponse | |
187 { | |
188 public: | |
189 ConfigurationResponse() // failed by default | |
190 { } | |
191 | |
192 Plugin::OutputList outputs; | |
193 }; | |
194 | |
195 /** | |
196 * \class ProcessRequest RequestResponse.h <vamp-hostsdk/RequestResponse.h> | |
197 * | |
198 * A structure that bundles the necessary data for making a process | |
199 * call: plugin, input buffers, and timestamp. Caller retains | |
200 * ownership of the plugin, but the buffers are passed "by value" to | |
201 * avoid ownership concerns. | |
202 * | |
203 * \see Plugin::process() | |
204 * | |
205 * \note This class was introduced in version 2.7 of the Vamp plugin | |
206 * SDK, but it is not currently used by the SDK. It is supplied as a | |
207 * convenience for code using the SDK, and for symmetry with the load | |
208 * and configuration request structs. | |
209 */ | |
210 struct ProcessRequest | |
211 { | |
212 public: | |
213 ProcessRequest() : // invalid by default | |
214 plugin(0) { } | |
215 | |
216 Plugin *plugin; | |
217 std::vector<std::vector<float> > inputBuffers; | |
218 RealTime timestamp; | |
219 }; | |
220 | |
221 /** | |
222 * \class ProcessResponse RequestResponse.h <vamp-hostsdk/RequestResponse.h> | |
223 * | |
224 * A structure that bundles the data returned by a process call and by | |
225 * Plugin::getRemainingFeatures(). This is simply a FeatureSet | |
226 * wrapper, named for symmetry with the other request-response pairs. | |
227 * | |
228 * \see Plugin::process(), Plugin::getRemainingFeatures() | |
229 * | |
230 * \note This class was introduced in version 2.7 of the Vamp plugin | |
231 * SDK, but it is not currently used by the SDK. It is supplied as a | |
232 * convenience for code using the SDK, and for symmetry with the load | |
233 * and configuration request structs. | |
234 */ | |
235 struct ProcessResponse | |
236 { | |
237 public: | |
238 ProcessResponse() // empty by default | |
239 { } | |
240 | |
241 Plugin::FeatureSet features; | |
242 }; | |
243 | |
244 } | |
245 | |
246 } | |
247 | |
248 _VAMP_SDK_HOSTSPACE_END(RequestResponse.h) | |
249 | |
250 #endif |