c@97: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ c@97: c@97: /* c@97: Piper C++ c@97: c@97: Centre for Digital Music, Queen Mary, University of London. cannam@220: Copyright 2006-2017 Chris Cannam and QMUL. c@97: c@97: Permission is hereby granted, free of charge, to any person c@97: obtaining a copy of this software and associated documentation c@97: files (the "Software"), to deal in the Software without c@97: restriction, including without limitation the rights to use, copy, c@97: modify, merge, publish, distribute, sublicense, and/or sell copies c@97: of the Software, and to permit persons to whom the Software is c@97: furnished to do so, subject to the following conditions: c@97: c@97: The above copyright notice and this permission notice shall be c@97: included in all copies or substantial portions of the Software. c@97: c@97: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, c@97: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF c@97: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND c@97: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR c@97: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF c@97: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION c@97: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. c@97: c@97: Except as contained in this notice, the names of the Centre for c@97: Digital Music; Queen Mary, University of London; and Chris Cannam c@97: shall not be used in advertising or otherwise to promote the sale, c@97: use or other dealings in this Software without prior written c@97: authorization. c@97: */ c@97: c@97: #ifndef PIPER_PLUGIN_STATIC_DATA_H c@97: #define PIPER_PLUGIN_STATIC_DATA_H c@97: c@97: #include c@97: cannam@220: #include "StaticOutputDescriptor.h" cannam@220: c@97: namespace piper_vamp { c@97: c@97: /** c@97: * \class PluginStaticData c@97: * c@97: * PluginStaticData is a structure bundling together all the c@97: * information about a plugin that cannot be changed by the plugin c@97: * after it is loaded. That is, everything that does not depend on a c@97: * parameter or initialisation setting. c@97: * c@97: * All of the information in here can be queried from other sources c@97: * directly (notably the Vamp::Plugin class itself); this structure c@97: * just pulls it together in one place and provides something that can c@97: * be stored and recalled without having a Vamp::Plugin object to c@97: * hand. c@97: */ c@97: struct PluginStaticData c@97: { c@97: public: c@97: struct Basic { c@97: std::string identifier; c@97: std::string name; c@97: std::string description; c@97: }; c@97: typedef std::vector BasicList; cannam@220: c@97: PluginStaticData() : // invalid static data by default c@97: pluginVersion(0), minChannelCount(0), maxChannelCount(0), c@97: inputDomain(Vamp::Plugin::TimeDomain) { } c@97: c@97: std::string pluginKey; c@97: Basic basic; c@97: std::string maker; c@97: std::string copyright; c@97: int pluginVersion; cannam@220: std::vector category; // not found in the plugin, may cannam@220: // come from accompanying cannam@220: // metadata c@102: size_t minChannelCount; c@102: size_t maxChannelCount; c@97: Vamp::PluginBase::ParameterList parameters; c@97: Vamp::PluginBase::ProgramList programs; c@97: Vamp::Plugin::InputDomain inputDomain; c@97: BasicList basicOutputInfo; cannam@220: StaticOutputInfo staticOutputInfo; // not found in the plugin, may cannam@220: // come from accompanying cannam@220: // (RDF?) metadata cannam@287: c@97: static PluginStaticData c@97: fromPlugin(std::string pluginKey, c@97: std::vector category, c@97: Vamp::Plugin *p) { c@97: c@97: PluginStaticData d; c@97: d.pluginKey = pluginKey; c@97: d.basic.identifier = p->getIdentifier(); c@97: d.basic.name = p->getName(); c@97: d.basic.description = p->getDescription(); c@97: d.maker = p->getMaker(); c@97: d.copyright = p->getCopyright(); c@97: d.pluginVersion = p->getPluginVersion(); c@97: d.category = category; c@97: d.minChannelCount = p->getMinChannelCount(); c@97: d.maxChannelCount = p->getMaxChannelCount(); c@97: d.parameters = p->getParameterDescriptors(); c@97: d.programs = p->getPrograms(); c@97: d.inputDomain = p->getInputDomain(); c@97: c@97: Vamp::Plugin::OutputList outputs = p->getOutputDescriptors(); c@97: for (Vamp::Plugin::OutputList::const_iterator i = outputs.begin(); c@97: i != outputs.end(); ++i) { c@97: Basic b; c@97: b.identifier = i->identifier; c@97: b.name = i->name; c@97: b.description = i->description; c@97: d.basicOutputInfo.push_back(b); c@97: } c@97: c@97: return d; c@97: } c@97: }; c@97: c@97: } c@97: c@97: #endif