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