cannam@227
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
cannam@227
|
2
|
cannam@227
|
3 /*
|
cannam@227
|
4 Vamp
|
cannam@227
|
5
|
cannam@227
|
6 An API for audio analysis and feature extraction plugins.
|
cannam@227
|
7
|
cannam@227
|
8 Centre for Digital Music, Queen Mary, University of London.
|
cannam@227
|
9 Copyright 2006-2007 Chris Cannam and QMUL.
|
cannam@227
|
10
|
cannam@227
|
11 Permission is hereby granted, free of charge, to any person
|
cannam@227
|
12 obtaining a copy of this software and associated documentation
|
cannam@227
|
13 files (the "Software"), to deal in the Software without
|
cannam@227
|
14 restriction, including without limitation the rights to use, copy,
|
cannam@227
|
15 modify, merge, publish, distribute, sublicense, and/or sell copies
|
cannam@227
|
16 of the Software, and to permit persons to whom the Software is
|
cannam@227
|
17 furnished to do so, subject to the following conditions:
|
cannam@227
|
18
|
cannam@227
|
19 The above copyright notice and this permission notice shall be
|
cannam@227
|
20 included in all copies or substantial portions of the Software.
|
cannam@227
|
21
|
cannam@227
|
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
cannam@227
|
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
cannam@227
|
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
cannam@227
|
25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
cannam@227
|
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
cannam@227
|
27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
cannam@227
|
28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
cannam@227
|
29
|
cannam@227
|
30 Except as contained in this notice, the names of the Centre for
|
cannam@227
|
31 Digital Music; Queen Mary, University of London; and Chris Cannam
|
cannam@227
|
32 shall not be used in advertising or otherwise to promote the sale,
|
cannam@227
|
33 use or other dealings in this Software without prior written
|
cannam@227
|
34 authorization.
|
cannam@227
|
35 */
|
cannam@227
|
36
|
cannam@227
|
37 #include "PluginWrapper.h"
|
cannam@227
|
38
|
cannam@227
|
39 namespace Vamp {
|
cannam@227
|
40
|
cannam@227
|
41 namespace HostExt {
|
cannam@227
|
42
|
cannam@227
|
43 class PluginRateExtractor : public Plugin
|
cannam@227
|
44 {
|
cannam@227
|
45 public:
|
cannam@227
|
46 PluginRateExtractor() : Plugin(0) { }
|
cannam@227
|
47 float getRate() const { return m_inputSampleRate; }
|
cannam@227
|
48 };
|
cannam@227
|
49
|
cannam@227
|
50 PluginWrapper::PluginWrapper(Plugin *plugin) :
|
cannam@227
|
51 Plugin(((PluginRateExtractor *)plugin)->getRate()),
|
cannam@227
|
52 m_plugin(plugin)
|
cannam@227
|
53 {
|
cannam@227
|
54 }
|
cannam@227
|
55
|
cannam@227
|
56 PluginWrapper::~PluginWrapper()
|
cannam@227
|
57 {
|
cannam@227
|
58 delete m_plugin;
|
cannam@227
|
59 }
|
cannam@227
|
60
|
cannam@227
|
61 bool
|
cannam@227
|
62 PluginWrapper::initialise(size_t channels, size_t stepSize, size_t blockSize)
|
cannam@227
|
63 {
|
cannam@227
|
64 return m_plugin->initialise(channels, stepSize, blockSize);
|
cannam@227
|
65 }
|
cannam@227
|
66
|
cannam@227
|
67 void
|
cannam@227
|
68 PluginWrapper::reset()
|
cannam@227
|
69 {
|
cannam@227
|
70 m_plugin->reset();
|
cannam@227
|
71 }
|
cannam@227
|
72
|
cannam@227
|
73 Plugin::InputDomain
|
cannam@227
|
74 PluginWrapper::getInputDomain() const
|
cannam@227
|
75 {
|
cannam@227
|
76 return m_plugin->getInputDomain();
|
cannam@227
|
77 }
|
cannam@227
|
78
|
cannam@227
|
79 unsigned int
|
cannam@227
|
80 PluginWrapper::getVampApiVersion() const
|
cannam@227
|
81 {
|
cannam@227
|
82 return m_plugin->getVampApiVersion();
|
cannam@227
|
83 }
|
cannam@227
|
84
|
cannam@227
|
85 std::string
|
cannam@227
|
86 PluginWrapper::getIdentifier() const
|
cannam@227
|
87 {
|
cannam@227
|
88 return m_plugin->getIdentifier();
|
cannam@227
|
89 }
|
cannam@227
|
90
|
cannam@227
|
91 std::string
|
cannam@227
|
92 PluginWrapper::getName() const
|
cannam@227
|
93 {
|
cannam@227
|
94 return m_plugin->getName();
|
cannam@227
|
95 }
|
cannam@227
|
96
|
cannam@227
|
97 std::string
|
cannam@227
|
98 PluginWrapper::getDescription() const
|
cannam@227
|
99 {
|
cannam@227
|
100 return m_plugin->getDescription();
|
cannam@227
|
101 }
|
cannam@227
|
102
|
cannam@227
|
103 std::string
|
cannam@227
|
104 PluginWrapper::getMaker() const
|
cannam@227
|
105 {
|
cannam@227
|
106 return m_plugin->getMaker();
|
cannam@227
|
107 }
|
cannam@227
|
108
|
cannam@227
|
109 int
|
cannam@227
|
110 PluginWrapper::getPluginVersion() const
|
cannam@227
|
111 {
|
cannam@227
|
112 return m_plugin->getPluginVersion();
|
cannam@227
|
113 }
|
cannam@227
|
114
|
cannam@227
|
115 std::string
|
cannam@227
|
116 PluginWrapper::getCopyright() const
|
cannam@227
|
117 {
|
cannam@227
|
118 return m_plugin->getCopyright();
|
cannam@227
|
119 }
|
cannam@227
|
120
|
cannam@227
|
121 PluginBase::ParameterList
|
cannam@227
|
122 PluginWrapper::getParameterDescriptors() const
|
cannam@227
|
123 {
|
cannam@227
|
124 return m_plugin->getParameterDescriptors();
|
cannam@227
|
125 }
|
cannam@227
|
126
|
cannam@227
|
127 float
|
cannam@227
|
128 PluginWrapper::getParameter(std::string parameter) const
|
cannam@227
|
129 {
|
cannam@227
|
130 return m_plugin->getParameter(parameter);
|
cannam@227
|
131 }
|
cannam@227
|
132
|
cannam@227
|
133 void
|
cannam@227
|
134 PluginWrapper::setParameter(std::string parameter, float value)
|
cannam@227
|
135 {
|
cannam@227
|
136 m_plugin->setParameter(parameter, value);
|
cannam@227
|
137 }
|
cannam@227
|
138
|
cannam@227
|
139 PluginBase::ProgramList
|
cannam@227
|
140 PluginWrapper::getPrograms() const
|
cannam@227
|
141 {
|
cannam@227
|
142 return m_plugin->getPrograms();
|
cannam@227
|
143 }
|
cannam@227
|
144
|
cannam@227
|
145 std::string
|
cannam@227
|
146 PluginWrapper::getCurrentProgram() const
|
cannam@227
|
147 {
|
cannam@227
|
148 return m_plugin->getCurrentProgram();
|
cannam@227
|
149 }
|
cannam@227
|
150
|
cannam@227
|
151 void
|
cannam@227
|
152 PluginWrapper::selectProgram(std::string program)
|
cannam@227
|
153 {
|
cannam@227
|
154 m_plugin->selectProgram(program);
|
cannam@227
|
155 }
|
cannam@227
|
156
|
cannam@227
|
157 size_t
|
cannam@227
|
158 PluginWrapper::getPreferredStepSize() const
|
cannam@227
|
159 {
|
cannam@227
|
160 return m_plugin->getPreferredStepSize();
|
cannam@227
|
161 }
|
cannam@227
|
162
|
cannam@227
|
163 size_t
|
cannam@227
|
164 PluginWrapper::getPreferredBlockSize() const
|
cannam@227
|
165 {
|
cannam@227
|
166 return m_plugin->getPreferredBlockSize();
|
cannam@227
|
167 }
|
cannam@227
|
168
|
cannam@227
|
169 size_t
|
cannam@227
|
170 PluginWrapper::getMinChannelCount() const
|
cannam@227
|
171 {
|
cannam@227
|
172 return m_plugin->getMinChannelCount();
|
cannam@227
|
173 }
|
cannam@227
|
174
|
cannam@227
|
175 size_t PluginWrapper::getMaxChannelCount() const
|
cannam@227
|
176 {
|
cannam@227
|
177 return m_plugin->getMaxChannelCount();
|
cannam@227
|
178 }
|
cannam@227
|
179
|
cannam@227
|
180 Plugin::OutputList
|
cannam@227
|
181 PluginWrapper::getOutputDescriptors() const
|
cannam@227
|
182 {
|
cannam@227
|
183 return m_plugin->getOutputDescriptors();
|
cannam@227
|
184 }
|
cannam@227
|
185
|
cannam@227
|
186 Plugin::FeatureSet
|
cannam@227
|
187 PluginWrapper::process(const float *const *inputBuffers, RealTime timestamp)
|
cannam@227
|
188 {
|
cannam@227
|
189 return m_plugin->process(inputBuffers, timestamp);
|
cannam@227
|
190 }
|
cannam@227
|
191
|
cannam@227
|
192 Plugin::FeatureSet
|
cannam@227
|
193 PluginWrapper::getRemainingFeatures()
|
cannam@227
|
194 {
|
cannam@227
|
195 return m_plugin->getRemainingFeatures();
|
cannam@227
|
196 }
|
cannam@227
|
197
|
cannam@227
|
198 }
|
cannam@227
|
199
|
cannam@227
|
200 }
|
cannam@227
|
201
|