Chris@423: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@423: Chris@423: /* Chris@423: Vamp Chris@423: Chris@423: An API for audio analysis and feature extraction plugins. Chris@423: Chris@423: Centre for Digital Music, Queen Mary, University of London. Chris@423: Copyright 2006-2016 Chris Cannam and QMUL. Chris@423: Chris@423: Permission is hereby granted, free of charge, to any person Chris@423: obtaining a copy of this software and associated documentation Chris@423: files (the "Software"), to deal in the Software without Chris@423: restriction, including without limitation the rights to use, copy, Chris@423: modify, merge, publish, distribute, sublicense, and/or sell copies Chris@423: of the Software, and to permit persons to whom the Software is Chris@423: furnished to do so, subject to the following conditions: Chris@423: Chris@423: The above copyright notice and this permission notice shall be Chris@423: included in all copies or substantial portions of the Software. Chris@423: Chris@423: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Chris@423: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Chris@423: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND Chris@423: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR Chris@423: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF Chris@423: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION Chris@423: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Chris@423: Chris@423: Except as contained in this notice, the names of the Centre for Chris@423: Digital Music; Queen Mary, University of London; and Chris Cannam Chris@423: shall not be used in advertising or otherwise to promote the sale, Chris@423: use or other dealings in this Software without prior written Chris@423: authorization. Chris@423: */ Chris@423: Chris@430: #ifndef VAMP_REQUEST_RESPONSE_H Chris@430: #define VAMP_REQUEST_RESPONSE_H Chris@423: Chris@423: #include "PluginStaticData.h" Chris@423: #include "PluginConfiguration.h" Chris@423: Chris@423: #include "hostguard.h" Chris@423: Chris@423: #include Chris@423: #include Chris@423: Chris@429: _VAMP_SDK_HOSTSPACE_BEGIN(RequestResponse.h) Chris@423: Chris@423: namespace Vamp { Chris@423: Chris@423: class Plugin; Chris@423: Chris@423: namespace HostExt { Chris@423: Chris@423: /** Chris@456: * \class ListResponse RequestResponse.h Chris@456: * Chris@456: * Vamp::HostExt::ListResponse is a structure containing the Chris@456: * information returned by PluginLoader when asked to list static Chris@456: * information about the available plugins. Chris@456: * Chris@456: * \see PluginLoader::listPluginData, PluginStaticData Chris@456: * Chris@456: * \note This class was introduced in version 2.7 of the Vamp plugin Chris@456: * SDK, along with the PluginLoader method that returns this structure. Chris@456: */ Chris@456: struct ListResponse Chris@456: { Chris@456: ListResponse() { } // empty by default Chris@456: Chris@456: std::vector pluginData; Chris@456: }; Chris@456: Chris@456: /** Chris@429: * \class LoadRequest RequestResponse.h Chris@423: * Chris@423: * Vamp::HostExt::LoadRequest is a structure containing the Chris@423: * information necessary to load a plugin. When a request is made to Chris@423: * load a plugin using a LoadRequest, the response is typically Chris@423: * returned in a LoadResponse structure. Chris@423: * Chris@423: * \see LoadResponse Chris@423: * Chris@423: * \note This class was introduced in version 2.7 of the Vamp plugin Chris@423: * SDK, along with the PluginLoader method that accepts this structure Chris@423: * rather than accepting its elements individually. Chris@423: */ Chris@423: struct LoadRequest Chris@423: { Chris@423: LoadRequest() : // invalid request by default Chris@423: inputSampleRate(0.f), Chris@423: adapterFlags(0) { } Chris@425: Chris@425: /** Chris@425: * PluginKey is a string type that is used to identify a plugin Chris@425: * uniquely within the scope of "the current system". For further Chris@425: * details \see PluginLoader::PluginKey. Chris@425: */ Chris@425: typedef std::string PluginKey; Chris@425: Chris@425: /** Chris@425: * The identifying key for the plugin to be loaded. Chris@425: */ Chris@425: PluginKey pluginKey; Chris@425: Chris@425: /** Chris@425: * Sample rate to be passed to the plugin's constructor. Chris@425: */ Chris@423: float inputSampleRate; Chris@425: Chris@425: /** Chris@425: * A bitwise OR of the values in the PluginLoader::AdapterFlags Chris@425: * enumeration, indicating under which circumstances an adapter Chris@425: * should be used to wrap the original plugin. If adapterFlags is Chris@425: * 0, no optional adapters will be used. Chris@425: * Chris@425: * \see PluginLoader::AdapterFlags, PluginLoader::loadPlugin Chris@425: */ Chris@425: int adapterFlags; Chris@423: }; Chris@423: Chris@423: /** Chris@429: * \class LoadResponse RequestResponse.h Chris@423: * Chris@423: * Vamp::HostExt::LoadResponse is a structure containing the Chris@423: * information returned by PluginLoader when asked to load a plugin Chris@423: * using a LoadRequest. Chris@423: * Chris@423: * If the plugin could not be loaded, the plugin field will be 0. Chris@423: * Chris@423: * The caller takes ownership of the plugin contained here, which Chris@423: * should be deleted (using the standard C++ delete keyword) after Chris@423: * use. Chris@423: * Chris@423: * \see LoadRequest Chris@423: * Chris@423: * \note This class was introduced in version 2.7 of the Vamp plugin Chris@423: * SDK, along with the PluginLoader method that returns this structure. Chris@423: */ Chris@423: struct LoadResponse Chris@423: { Chris@423: LoadResponse() : // invalid (failed) response by default Chris@423: plugin(0) { } Chris@425: Chris@425: /** Chris@425: * A pointer to the loaded plugin, or 0 if loading failed. Caller Chris@425: * takes ownership of the plugin and must delete it after use. Chris@425: */ Chris@423: Plugin *plugin; Chris@425: Chris@425: /** Chris@425: * The static data associated with the loaded plugin, that is, all Chris@425: * information about it that does not depend on its configuration Chris@425: * (parameters, programs, initialisation parameters). The contents Chris@425: * of this structure are only valid if plugin is non-0. Chris@426: * Chris@426: * Much of the data in here is duplicated with the plugin itself. Chris@425: */ Chris@423: PluginStaticData staticData; Chris@425: Chris@425: /** Chris@425: * The default configuration for this plugin, that is, default Chris@425: * values for parameters etc. The contents of this structure are Chris@425: * only valid if plugin is non-0. Chris@425: */ Chris@423: PluginConfiguration defaultConfiguration; Chris@423: }; Chris@423: Chris@430: /** Chris@430: * \class ConfigurationRequest RequestResponse.h Chris@430: * Chris@430: * A wrapper for a plugin pointer and PluginConfiguration, bundling up Chris@430: * the data needed to configure a plugin after it has been loaded. Chris@430: * Chris@430: * \see PluginConfiguration, ConfigurationResponse, LoadRequest, LoadResponse Chris@431: * Chris@431: * \note This class was introduced in version 2.7 of the Vamp plugin Chris@431: * SDK, along with the PluginLoader method that returns this structure. Chris@430: */ Chris@430: struct ConfigurationRequest Chris@430: { Chris@430: public: Chris@430: ConfigurationRequest() : // invalid request by default Chris@430: plugin(0) { } Chris@430: Chris@430: Plugin *plugin; Chris@430: PluginConfiguration configuration; Chris@430: }; Chris@430: Chris@430: /** Chris@430: * \class ConfigurationResponse RequestResponse.h Chris@430: * Chris@430: * The return value from a configuration request (i.e. setting the Chris@430: * parameters and initialising the plugin). If the configuration was Chris@430: * successful, the output list will contain the final Chris@430: * post-initialisation output descriptors. If configuration failed, Chris@430: * the output list will be empty. Chris@430: * Chris@430: * \see PluginConfiguration, ConfigurationRequest, LoadRequest, LoadResponse Chris@431: * Chris@431: * \note This class was introduced in version 2.7 of the Vamp plugin Chris@431: * SDK, along with the PluginLoader method that returns this structure. Chris@430: */ Chris@430: struct ConfigurationResponse Chris@430: { Chris@430: public: Chris@455: ConfigurationResponse() : // failed by default Chris@455: plugin(0) { } Chris@430: Chris@455: Plugin *plugin; Chris@430: Plugin::OutputList outputs; Chris@430: }; Chris@430: Chris@431: /** Chris@431: * \class ProcessRequest RequestResponse.h Chris@431: * Chris@431: * A structure that bundles the necessary data for making a process Chris@431: * call: plugin, input buffers, and timestamp. Caller retains Chris@431: * ownership of the plugin, but the buffers are passed "by value" to Chris@431: * avoid ownership concerns. Chris@431: * Chris@431: * \see Plugin::process() Chris@431: * Chris@431: * \note This class was introduced in version 2.7 of the Vamp plugin Chris@431: * SDK, but it is not currently used by the SDK. It is supplied as a Chris@431: * convenience for code using the SDK, and for symmetry with the load Chris@431: * and configuration request structs. Chris@431: */ Chris@431: struct ProcessRequest Chris@431: { Chris@431: public: Chris@431: ProcessRequest() : // invalid by default Chris@431: plugin(0) { } Chris@431: Chris@431: Plugin *plugin; Chris@432: std::vector > inputBuffers; Chris@431: RealTime timestamp; Chris@431: }; Chris@431: Chris@431: /** Chris@431: * \class ProcessResponse RequestResponse.h Chris@431: * Chris@431: * A structure that bundles the data returned by a process call and by Chris@431: * Plugin::getRemainingFeatures(). This is simply a FeatureSet Chris@454: * wrapper that happens to reference the plugin as well. Chris@431: * Chris@431: * \see Plugin::process(), Plugin::getRemainingFeatures() Chris@431: * Chris@431: * \note This class was introduced in version 2.7 of the Vamp plugin Chris@431: * SDK, but it is not currently used by the SDK. It is supplied as a Chris@431: * convenience for code using the SDK, and for symmetry with the load Chris@431: * and configuration request structs. Chris@431: */ Chris@431: struct ProcessResponse Chris@431: { Chris@431: public: Chris@454: ProcessResponse() : // invalid by default Chris@454: plugin(0) { } Chris@431: Chris@454: Plugin *plugin; Chris@431: Plugin::FeatureSet features; Chris@431: }; Chris@431: Chris@455: /** Chris@455: * \class FinishRequest RequestResponse.h Chris@455: * Chris@455: * A structure that bundles the necessary data for finishing Chris@455: * processing, i.e. calling getRemainingFeatures(). This consists only Chris@455: * of the plugin pointer. Caller retains ownership of the plugin. Chris@455: * Chris@455: * \see Plugin::getRemainingFeatures() Chris@455: * Chris@455: * \note This class was introduced in version 2.7 of the Vamp plugin Chris@455: * SDK, but it is not currently used by the SDK. It is supplied as a Chris@455: * convenience for code using the SDK, and for symmetry with the load Chris@455: * and configuration request structs. Chris@455: * Chris@455: * \note The response to a finish request (getRemainingFeatures()) is Chris@455: * a ProcessResponse, just as it is for a process request. Chris@455: */ Chris@455: struct FinishRequest Chris@455: { Chris@455: public: Chris@455: FinishRequest() : // invalid by default Chris@455: plugin(0) { } Chris@455: Chris@455: Plugin *plugin; Chris@455: }; Chris@455: Chris@423: } Chris@423: Chris@423: } Chris@423: Chris@429: _VAMP_SDK_HOSTSPACE_END(RequestResponse.h) Chris@423: Chris@423: #endif