02bdc280f1767d94c3f02986dee793dff94d26d8
[ardour.git] / libs / vamp-sdk / src / vamp-hostsdk / PluginWrapper.cpp
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-2007 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 #include <vamp-hostsdk/PluginWrapper.h>
38
39 _VAMP_SDK_HOSTSPACE_BEGIN(PluginWrapper.cpp)
40
41 namespace Vamp {
42
43 namespace HostExt {
44
45 class PluginRateExtractor : public Plugin
46 {
47 public:
48     PluginRateExtractor() : Plugin(0) { }
49     float getRate() const { return m_inputSampleRate; }
50 };
51
52 PluginWrapper::PluginWrapper(Plugin *plugin) :
53     Plugin(((PluginRateExtractor *)plugin)->getRate()),
54     m_plugin(plugin)
55 {
56 }
57
58 PluginWrapper::~PluginWrapper()
59 {
60     delete m_plugin;
61 }
62
63 bool
64 PluginWrapper::initialise(size_t channels, size_t stepSize, size_t blockSize)
65 {
66     return m_plugin->initialise(channels, stepSize, blockSize);
67 }
68
69 void
70 PluginWrapper::reset()
71 {
72     m_plugin->reset();
73 }
74
75 Plugin::InputDomain
76 PluginWrapper::getInputDomain() const
77 {
78     return m_plugin->getInputDomain();
79 }
80
81 unsigned int
82 PluginWrapper::getVampApiVersion() const
83 {
84     return m_plugin->getVampApiVersion();
85 }
86
87 std::string
88 PluginWrapper::getIdentifier() const
89 {
90     return m_plugin->getIdentifier();
91 }
92
93 std::string
94 PluginWrapper::getName() const
95 {
96     return m_plugin->getName();
97 }
98
99 std::string
100 PluginWrapper::getDescription() const
101 {
102     return m_plugin->getDescription();
103 }
104
105 std::string
106 PluginWrapper::getMaker() const
107 {
108     return m_plugin->getMaker();
109 }
110
111 int
112 PluginWrapper::getPluginVersion() const
113 {
114     return m_plugin->getPluginVersion();
115 }
116
117 std::string
118 PluginWrapper::getCopyright() const
119 {
120     return m_plugin->getCopyright();
121 }
122
123 PluginBase::ParameterList
124 PluginWrapper::getParameterDescriptors() const
125 {
126     return m_plugin->getParameterDescriptors();
127 }
128
129 float
130 PluginWrapper::getParameter(std::string parameter) const
131 {
132     return m_plugin->getParameter(parameter);
133 }
134
135 void
136 PluginWrapper::setParameter(std::string parameter, float value)
137 {
138     m_plugin->setParameter(parameter, value);
139 }
140
141 PluginBase::ProgramList
142 PluginWrapper::getPrograms() const
143 {
144     return m_plugin->getPrograms();
145 }
146
147 std::string
148 PluginWrapper::getCurrentProgram() const
149 {
150     return m_plugin->getCurrentProgram();
151 }
152
153 void
154 PluginWrapper::selectProgram(std::string program)
155 {
156     m_plugin->selectProgram(program);
157 }
158
159 size_t
160 PluginWrapper::getPreferredStepSize() const
161 {
162     return m_plugin->getPreferredStepSize();
163 }
164
165 size_t
166 PluginWrapper::getPreferredBlockSize() const
167 {
168     return m_plugin->getPreferredBlockSize();
169 }
170
171 size_t
172 PluginWrapper::getMinChannelCount() const
173 {
174     return m_plugin->getMinChannelCount();
175 }
176
177 size_t PluginWrapper::getMaxChannelCount() const
178 {
179     return m_plugin->getMaxChannelCount();
180 }
181
182 Plugin::OutputList
183 PluginWrapper::getOutputDescriptors() const
184 {
185     return m_plugin->getOutputDescriptors();
186 }
187
188 Plugin::FeatureSet
189 PluginWrapper::process(const float *const *inputBuffers, RealTime timestamp)
190 {
191     return m_plugin->process(inputBuffers, timestamp);
192 }
193
194 Plugin::FeatureSet
195 PluginWrapper::getRemainingFeatures()
196 {
197     return m_plugin->getRemainingFeatures();
198 }
199
200 }
201
202 }
203
204 _VAMP_SDK_HOSTSPACE_END(PluginWrapper.cpp)