annotate vamp-hostsdk/PluginStaticData.h @ 463:43762dba6747 vampipe

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