comparison vamp-hostsdk/PluginStaticData.h @ 423:8c45dee08a95 vampipe

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