# HG changeset patch # User Chris Cannam # Date 1476111147 -3600 # Node ID 43762dba6747261d8a0132a4f28ec07393129545 # Parent 85dadd0d482f1dd294a3482a2fe494955f786bb4# Parent 3949cc56f2ce00d6b7e51bc31a3186e6a138a18e Merge from 454:3949cc56f2ce diff -r 3949cc56f2ce -r 43762dba6747 src/vamp-hostsdk/PluginLoader.cpp --- a/src/vamp-hostsdk/PluginLoader.cpp Mon Oct 10 15:48:23 2016 +0100 +++ b/src/vamp-hostsdk/PluginLoader.cpp Mon Oct 10 15:52:27 2016 +0100 @@ -61,7 +61,8 @@ virtual ~Impl(); PluginKeyList listPlugins(); - PluginStaticDataList listPluginData(); + + ListResponse listPluginData(); Plugin *loadPlugin(PluginKey key, float inputSampleRate, @@ -149,7 +150,7 @@ return m_impl->listPlugins(); } -PluginLoader::PluginStaticDataList +ListResponse PluginLoader::listPluginData() { return m_impl->listPluginData(); @@ -222,23 +223,24 @@ return plugins; } -PluginLoader::PluginStaticDataList +ListResponse PluginLoader::Impl::listPluginData() { PluginKeyList keys = listPlugins(); - PluginStaticDataList dataList; + ListResponse response; for (PluginKeyList::const_iterator ki = keys.begin(); ki != keys.end(); ++ki) { string key = *ki; Plugin *p = loadPlugin(key, 44100, 0); if (p) { PluginCategoryHierarchy category = getPluginCategory(key); - dataList.push_back(PluginStaticData::fromPlugin(key, category, p)); + response.available.push_back + (PluginStaticData::fromPlugin(key, category, p)); } delete p; } - return dataList; + return response; } void @@ -469,6 +471,8 @@ ConfigurationResponse response; + response.plugin = req.plugin; + if (req.plugin->initialise(req.configuration.channelCount, req.configuration.stepSize, req.configuration.blockSize)) { diff -r 3949cc56f2ce -r 43762dba6747 vamp-hostsdk/PluginLoader.h --- a/vamp-hostsdk/PluginLoader.h Mon Oct 10 15:48:23 2016 +0100 +++ b/vamp-hostsdk/PluginLoader.h Mon Oct 10 15:52:27 2016 +0100 @@ -123,14 +123,6 @@ typedef std::vector PluginCategoryHierarchy; /** - * PluginStaticDataList is a list containing static information - * about a set of Vamp plugins. - * - * \see PluginStaticData, listPluginData() - */ - typedef std::vector PluginStaticDataList; - - /** * Search for all available Vamp plugins, and return a list of * them in the order in which they were found. */ @@ -141,8 +133,10 @@ * static data about each plugin in the order in which they were * found. This is slower but returns more comprehensive * information than listPlugins(). + * + * \see ListResponse, PluginStaticData */ - PluginStaticDataList listPluginData(); + ListResponse listPluginData(); /** * AdapterFlags contains a set of values that may be OR'd together diff -r 3949cc56f2ce -r 43762dba6747 vamp-hostsdk/RequestResponse.h --- a/vamp-hostsdk/RequestResponse.h Mon Oct 10 15:48:23 2016 +0100 +++ b/vamp-hostsdk/RequestResponse.h Mon Oct 10 15:52:27 2016 +0100 @@ -54,6 +54,25 @@ namespace HostExt { /** + * \class ListResponse RequestResponse.h + * + * Vamp::HostExt::ListResponse is a structure containing the + * information returned by PluginLoader when asked to list static + * information about the available plugins. + * + * \see PluginLoader::listPluginData, PluginStaticData + * + * \note This class was introduced in version 2.7 of the Vamp plugin + * SDK, along with the PluginLoader method that returns this structure. + */ +struct ListResponse +{ + ListResponse() { } // empty by default + + std::vector available; +}; + +/** * \class LoadRequest RequestResponse.h * * Vamp::HostExt::LoadRequest is a structure containing the @@ -186,9 +205,10 @@ struct ConfigurationResponse { public: - ConfigurationResponse() // failed by default - { } + ConfigurationResponse() : // failed by default + plugin(0) { } + Plugin *plugin; Plugin::OutputList outputs; }; @@ -223,7 +243,7 @@ * * A structure that bundles the data returned by a process call and by * Plugin::getRemainingFeatures(). This is simply a FeatureSet - * wrapper, named for symmetry with the other request-response pairs. + * wrapper that happens to reference the plugin as well. * * \see Plugin::process(), Plugin::getRemainingFeatures() * @@ -235,12 +255,39 @@ struct ProcessResponse { public: - ProcessResponse() // empty by default - { } + ProcessResponse() : // invalid by default + plugin(0) { } + Plugin *plugin; Plugin::FeatureSet features; }; +/** + * \class FinishRequest RequestResponse.h + * + * A structure that bundles the necessary data for finishing + * processing, i.e. calling getRemainingFeatures(). This consists only + * of the plugin pointer. Caller retains ownership of the plugin. + * + * \see Plugin::getRemainingFeatures() + * + * \note This class was introduced in version 2.7 of the Vamp plugin + * SDK, but it is not currently used by the SDK. It is supplied as a + * convenience for code using the SDK, and for symmetry with the load + * and configuration request structs. + * + * \note The response to a finish request (getRemainingFeatures()) is + * a ProcessResponse, just as it is for a process request. + */ +struct FinishRequest +{ +public: + FinishRequest() : // invalid by default + plugin(0) { } + + Plugin *plugin; +}; + } }