comparison vamp-hostsdk/PluginStaticData.h @ 460:b409560a805b

Merge from branch vampipe
author Chris Cannam
date Mon, 10 Oct 2016 15:48:35 +0100
parents 56a23abf8283
children
comparison
equal deleted inserted replaced
442:4101e3f80aa0 460:b409560a805b
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 * All of the information in here can be queried from other sources
58 * directly (notably the Plugin class itself); this structure just
59 * pulls it together in one place and provides something that can be
60 * stored and recalled without having a Plugin object to hand.
61 *
62 * \note This class was introduced in version 2.7 of the Vamp plugin
63 * SDK and is used only by host SDK functions that were also
64 * introduced in that release (or newer).
65 */
66 struct PluginStaticData
67 {
68 public:
69 struct Basic {
70 std::string identifier;
71 std::string name;
72 std::string description;
73 };
74 typedef std::vector<Basic> BasicList;
75
76 PluginStaticData() : // invalid static data by default
77 pluginVersion(0), minChannelCount(0), maxChannelCount(0),
78 inputDomain(Plugin::TimeDomain) { }
79
80 std::string pluginKey;
81 Basic basic;
82 std::string maker;
83 std::string copyright;
84 int pluginVersion;
85 std::vector<std::string> category;
86 int minChannelCount;
87 int maxChannelCount;
88 PluginBase::ParameterList parameters;
89 PluginBase::ProgramList programs;
90 Plugin::InputDomain inputDomain;
91 BasicList basicOutputInfo;
92
93 static PluginStaticData
94 fromPlugin(std::string pluginKey,
95 std::vector<std::string> category,
96 Plugin *p) {
97
98 PluginStaticData d;
99 d.pluginKey = pluginKey;
100 d.basic.identifier = p->getIdentifier();
101 d.basic.name = p->getName();
102 d.basic.description = p->getDescription();
103 d.maker = p->getMaker();
104 d.copyright = p->getCopyright();
105 d.pluginVersion = p->getPluginVersion();
106 d.category = category;
107 d.minChannelCount = p->getMinChannelCount();
108 d.maxChannelCount = p->getMaxChannelCount();
109 d.parameters = p->getParameterDescriptors();
110 d.programs = p->getPrograms();
111 d.inputDomain = p->getInputDomain();
112
113 Plugin::OutputList outputs = p->getOutputDescriptors();
114 for (Plugin::OutputList::const_iterator i = outputs.begin();
115 i != outputs.end(); ++i) {
116 Basic b;
117 b.identifier = i->identifier;
118 b.name = i->name;
119 b.description = i->description;
120 d.basicOutputInfo.push_back(b);
121 }
122
123 return d;
124 }
125 };
126
127 }
128
129 }
130
131 _VAMP_SDK_HOSTSPACE_END(PluginStaticData.h)
132
133 #endif