comparison vamp-sdk/hostext/PluginWrapper.cpp @ 64:9d3272c7db60

* Merge from host-factory-stuff branch: this adds several helper classes in the hostext directory that should make a host's life much easier. This will become version 1.1 of the SDK, eventually.
author cannam
date Fri, 01 Jun 2007 15:10:17 +0000
parents
children 4017e21c12dd
comparison
equal deleted inserted replaced
54:933fee59d33a 64:9d3272c7db60
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 Chris Cannam.
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 "PluginWrapper.h"
38
39 namespace Vamp {
40
41 namespace HostExt {
42
43 class PluginRateExtractor : public Plugin
44 {
45 public:
46 float getRate() const { return m_inputSampleRate; }
47 };
48
49 PluginWrapper::PluginWrapper(Plugin *plugin) :
50 Plugin(((PluginRateExtractor *)plugin)->getRate()),
51 m_plugin(plugin)
52 {
53 }
54
55 PluginWrapper::~PluginWrapper()
56 {
57 delete m_plugin;
58 }
59
60 bool
61 PluginWrapper::initialise(size_t channels, size_t stepSize, size_t blockSize)
62 {
63 return m_plugin->initialise(channels, stepSize, blockSize);
64 }
65
66 void
67 PluginWrapper::reset()
68 {
69 m_plugin->reset();
70 }
71
72 Plugin::InputDomain
73 PluginWrapper::getInputDomain() const
74 {
75 return m_plugin->getInputDomain();
76 }
77
78 unsigned int
79 PluginWrapper::getVampApiVersion() const
80 {
81 return m_plugin->getVampApiVersion();
82 }
83
84 std::string
85 PluginWrapper::getIdentifier() const
86 {
87 return m_plugin->getIdentifier();
88 }
89
90 std::string
91 PluginWrapper::getName() const
92 {
93 return m_plugin->getName();
94 }
95
96 std::string
97 PluginWrapper::getDescription() const
98 {
99 return m_plugin->getDescription();
100 }
101
102 std::string
103 PluginWrapper::getMaker() const
104 {
105 return m_plugin->getMaker();
106 }
107
108 int
109 PluginWrapper::getPluginVersion() const
110 {
111 return m_plugin->getPluginVersion();
112 }
113
114 std::string
115 PluginWrapper::getCopyright() const
116 {
117 return m_plugin->getCopyright();
118 }
119
120 PluginBase::ParameterList
121 PluginWrapper::getParameterDescriptors() const
122 {
123 return m_plugin->getParameterDescriptors();
124 }
125
126 float
127 PluginWrapper::getParameter(std::string parameter) const
128 {
129 return m_plugin->getParameter(parameter);
130 }
131
132 void
133 PluginWrapper::setParameter(std::string parameter, float value)
134 {
135 m_plugin->setParameter(parameter, value);
136 }
137
138 PluginBase::ProgramList
139 PluginWrapper::getPrograms() const
140 {
141 return m_plugin->getPrograms();
142 }
143
144 std::string
145 PluginWrapper::getCurrentProgram() const
146 {
147 return m_plugin->getCurrentProgram();
148 }
149
150 void
151 PluginWrapper::selectProgram(std::string program)
152 {
153 m_plugin->selectProgram(program);
154 }
155
156 size_t
157 PluginWrapper::getPreferredStepSize() const
158 {
159 return m_plugin->getPreferredStepSize();
160 }
161
162 size_t
163 PluginWrapper::getPreferredBlockSize() const
164 {
165 return m_plugin->getPreferredBlockSize();
166 }
167
168 size_t
169 PluginWrapper::getMinChannelCount() const
170 {
171 return m_plugin->getMinChannelCount();
172 }
173
174 size_t PluginWrapper::getMaxChannelCount() const
175 {
176 return m_plugin->getMaxChannelCount();
177 }
178
179 Plugin::OutputList
180 PluginWrapper::getOutputDescriptors() const
181 {
182 return m_plugin->getOutputDescriptors();
183 }
184
185 Plugin::FeatureSet
186 PluginWrapper::process(const float *const *inputBuffers, RealTime timestamp)
187 {
188 return m_plugin->process(inputBuffers, timestamp);
189 }
190
191 Plugin::FeatureSet
192 PluginWrapper::getRemainingFeatures()
193 {
194 return m_plugin->getRemainingFeatures();
195 }
196
197 }
198
199 }
200