annotate vamp-support/PluginStaticData.h @ 189:6859f35cb4f8

Manually bring in Catch for testing.
author Lucas Thompson <dev@lucas.im>
date Tue, 07 Feb 2017 10:25:15 +0000
parents cd438188e3f9
children 02de5df3a884
rev   line source
c@97 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@97 2
c@97 3 /*
c@97 4 Piper C++
c@97 5
c@97 6 Centre for Digital Music, Queen Mary, University of London.
c@97 7 Copyright 2006-2016 Chris Cannam and QMUL.
c@97 8
c@97 9 Permission is hereby granted, free of charge, to any person
c@97 10 obtaining a copy of this software and associated documentation
c@97 11 files (the "Software"), to deal in the Software without
c@97 12 restriction, including without limitation the rights to use, copy,
c@97 13 modify, merge, publish, distribute, sublicense, and/or sell copies
c@97 14 of the Software, and to permit persons to whom the Software is
c@97 15 furnished to do so, subject to the following conditions:
c@97 16
c@97 17 The above copyright notice and this permission notice shall be
c@97 18 included in all copies or substantial portions of the Software.
c@97 19
c@97 20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
c@97 21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
c@97 22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
c@97 23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
c@97 24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
c@97 25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
c@97 26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
c@97 27
c@97 28 Except as contained in this notice, the names of the Centre for
c@97 29 Digital Music; Queen Mary, University of London; and Chris Cannam
c@97 30 shall not be used in advertising or otherwise to promote the sale,
c@97 31 use or other dealings in this Software without prior written
c@97 32 authorization.
c@97 33 */
c@97 34
c@97 35 #ifndef PIPER_PLUGIN_STATIC_DATA_H
c@97 36 #define PIPER_PLUGIN_STATIC_DATA_H
c@97 37
c@97 38 #include <vamp-hostsdk/Plugin.h>
c@97 39
c@97 40 namespace piper_vamp {
c@97 41
c@97 42 /**
c@97 43 * \class PluginStaticData
c@97 44 *
c@97 45 * PluginStaticData is a structure bundling together all the
c@97 46 * information about a plugin that cannot be changed by the plugin
c@97 47 * after it is loaded. That is, everything that does not depend on a
c@97 48 * parameter or initialisation setting.
c@97 49 *
c@97 50 * All of the information in here can be queried from other sources
c@97 51 * directly (notably the Vamp::Plugin class itself); this structure
c@97 52 * just pulls it together in one place and provides something that can
c@97 53 * be stored and recalled without having a Vamp::Plugin object to
c@97 54 * hand.
c@97 55 */
c@97 56 struct PluginStaticData
c@97 57 {
c@97 58 public:
c@97 59 struct Basic {
c@97 60 std::string identifier;
c@97 61 std::string name;
c@97 62 std::string description;
c@97 63 };
c@97 64 typedef std::vector<Basic> BasicList;
c@97 65
c@97 66 PluginStaticData() : // invalid static data by default
c@97 67 pluginVersion(0), minChannelCount(0), maxChannelCount(0),
c@97 68 inputDomain(Vamp::Plugin::TimeDomain) { }
c@97 69
c@97 70 std::string pluginKey;
c@97 71 Basic basic;
c@97 72 std::string maker;
c@97 73 std::string copyright;
c@97 74 int pluginVersion;
c@97 75 std::vector<std::string> category;
c@102 76 size_t minChannelCount;
c@102 77 size_t maxChannelCount;
c@97 78 Vamp::PluginBase::ParameterList parameters;
c@97 79 Vamp::PluginBase::ProgramList programs;
c@97 80 Vamp::Plugin::InputDomain inputDomain;
c@97 81 BasicList basicOutputInfo;
c@97 82
c@97 83 static PluginStaticData
c@97 84 fromPlugin(std::string pluginKey,
c@97 85 std::vector<std::string> category,
c@97 86 Vamp::Plugin *p) {
c@97 87
c@97 88 PluginStaticData d;
c@97 89 d.pluginKey = pluginKey;
c@97 90 d.basic.identifier = p->getIdentifier();
c@97 91 d.basic.name = p->getName();
c@97 92 d.basic.description = p->getDescription();
c@97 93 d.maker = p->getMaker();
c@97 94 d.copyright = p->getCopyright();
c@97 95 d.pluginVersion = p->getPluginVersion();
c@97 96 d.category = category;
c@97 97 d.minChannelCount = p->getMinChannelCount();
c@97 98 d.maxChannelCount = p->getMaxChannelCount();
c@97 99 d.parameters = p->getParameterDescriptors();
c@97 100 d.programs = p->getPrograms();
c@97 101 d.inputDomain = p->getInputDomain();
c@97 102
c@97 103 Vamp::Plugin::OutputList outputs = p->getOutputDescriptors();
c@97 104 for (Vamp::Plugin::OutputList::const_iterator i = outputs.begin();
c@97 105 i != outputs.end(); ++i) {
c@97 106 Basic b;
c@97 107 b.identifier = i->identifier;
c@97 108 b.name = i->name;
c@97 109 b.description = i->description;
c@97 110 d.basicOutputInfo.push_back(b);
c@97 111 }
c@97 112
c@97 113 return d;
c@97 114 }
c@97 115 };
c@97 116
c@97 117 }
c@97 118
c@97 119 #endif