Mercurial > hg > piper-cpp
comparison vamp-client/PiperVampPlugin.h @ 280:4b581a498981
Use override throughout
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Mon, 26 Nov 2018 13:39:01 +0000 |
parents | 82a89c4345c6 |
children | 09753ad777db |
comparison
equal
deleted
inserted
replaced
279:b7eec400cd94 | 280:4b581a498981 |
---|---|
127 std::cerr << "WARNING: PiperVampPlugin::~PiperVampPlugin: caught exception from finish(): " << e.what() << std::endl; | 127 std::cerr << "WARNING: PiperVampPlugin::~PiperVampPlugin: caught exception from finish(): " << e.what() << std::endl; |
128 } | 128 } |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 virtual std::string getIdentifier() const { | 132 std::string getIdentifier() const override { |
133 return m_psd.basic.identifier; | 133 return m_psd.basic.identifier; |
134 } | 134 } |
135 | 135 |
136 virtual std::string getName() const { | 136 std::string getName() const override { |
137 return m_psd.basic.name; | 137 return m_psd.basic.name; |
138 } | 138 } |
139 | 139 |
140 virtual std::string getDescription() const { | 140 std::string getDescription() const override { |
141 return m_psd.basic.description; | 141 return m_psd.basic.description; |
142 } | 142 } |
143 | 143 |
144 virtual std::string getMaker() const { | 144 std::string getMaker() const override { |
145 return m_psd.maker; | 145 return m_psd.maker; |
146 } | 146 } |
147 | 147 |
148 virtual std::string getCopyright() const { | 148 std::string getCopyright() const override { |
149 return m_psd.copyright; | 149 return m_psd.copyright; |
150 } | 150 } |
151 | 151 |
152 virtual int getPluginVersion() const { | 152 int getPluginVersion() const override { |
153 return m_psd.pluginVersion; | 153 return m_psd.pluginVersion; |
154 } | 154 } |
155 | 155 |
156 virtual ParameterList getParameterDescriptors() const { | 156 ParameterList getParameterDescriptors() const override { |
157 return m_psd.parameters; | 157 return m_psd.parameters; |
158 } | 158 } |
159 | 159 |
160 virtual float getParameter(std::string name) const { | 160 float getParameter(std::string name) const override { |
161 if (m_config.parameterValues.find(name) != m_config.parameterValues.end()) { | 161 if (m_config.parameterValues.find(name) != m_config.parameterValues.end()) { |
162 return m_config.parameterValues.at(name); | 162 return m_config.parameterValues.at(name); |
163 } else { | 163 } else { |
164 return 0.f; | 164 return 0.f; |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 virtual void setParameter(std::string name, float value) { | 168 void setParameter(std::string name, float value) override { |
169 if (m_state == Failed) { | 169 if (m_state == Failed) { |
170 throw std::logic_error("Plugin is in failed state"); | 170 throw std::logic_error("Plugin is in failed state"); |
171 } | 171 } |
172 if (m_state != Loaded) { | 172 if (m_state != Loaded) { |
173 m_state = Failed; | 173 m_state = Failed; |
174 throw std::logic_error("Can't set parameter after plugin initialised"); | 174 throw std::logic_error("Can't set parameter after plugin initialised"); |
175 } | 175 } |
176 m_config.parameterValues[name] = value; | 176 m_config.parameterValues[name] = value; |
177 } | 177 } |
178 | 178 |
179 virtual ProgramList getPrograms() const { | 179 ProgramList getPrograms() const override { |
180 return m_psd.programs; | 180 return m_psd.programs; |
181 } | 181 } |
182 | 182 |
183 virtual std::string getCurrentProgram() const { | 183 std::string getCurrentProgram() const override { |
184 return m_config.currentProgram; | 184 return m_config.currentProgram; |
185 } | 185 } |
186 | 186 |
187 virtual void selectProgram(std::string program) { | 187 void selectProgram(std::string program) override { |
188 if (m_state == Failed) { | 188 if (m_state == Failed) { |
189 throw std::logic_error("Plugin is in failed state"); | 189 throw std::logic_error("Plugin is in failed state"); |
190 } | 190 } |
191 if (m_state != Loaded) { | 191 if (m_state != Loaded) { |
192 m_state = Failed; | 192 m_state = Failed; |
193 throw std::logic_error("Can't select program after plugin initialised"); | 193 throw std::logic_error("Can't select program after plugin initialised"); |
194 } | 194 } |
195 m_config.currentProgram = program; | 195 m_config.currentProgram = program; |
196 } | 196 } |
197 | 197 |
198 virtual bool initialise(size_t inputChannels, | 198 bool initialise(size_t inputChannels, |
199 size_t stepSize, | 199 size_t stepSize, |
200 size_t blockSize) { | 200 size_t blockSize) override { |
201 | 201 |
202 if (m_state == Failed) { | 202 if (m_state == Failed) { |
203 throw std::logic_error("Plugin is in failed state"); | 203 throw std::logic_error("Plugin is in failed state"); |
204 } | 204 } |
205 | 205 |
255 } else { | 255 } else { |
256 return false; | 256 return false; |
257 } | 257 } |
258 } | 258 } |
259 | 259 |
260 virtual void reset() { | 260 void reset() override { |
261 | 261 |
262 if (m_state == Failed) { | 262 if (m_state == Failed) { |
263 throw std::logic_error("Plugin is in failed state"); | 263 throw std::logic_error("Plugin is in failed state"); |
264 } | 264 } |
265 if (m_state == Loaded || m_state == Misconfigured) { | 265 if (m_state == Loaded || m_state == Misconfigured) { |
275 } | 275 } |
276 | 276 |
277 m_state = Configured; | 277 m_state = Configured; |
278 } | 278 } |
279 | 279 |
280 virtual InputDomain getInputDomain() const { | 280 InputDomain getInputDomain() const override { |
281 return m_psd.inputDomain; | 281 return m_psd.inputDomain; |
282 } | 282 } |
283 | 283 |
284 virtual size_t getPreferredBlockSize() const { | 284 size_t getPreferredBlockSize() const override { |
285 // Return this from m_config instead of m_defaultConfig, so | 285 // Return this from m_config instead of m_defaultConfig, so |
286 // that it gets updated in the event of an initialise() call | 286 // that it gets updated in the event of an initialise() call |
287 // that fails for the wrong value | 287 // that fails for the wrong value |
288 return m_config.framing.blockSize; | 288 return m_config.framing.blockSize; |
289 } | 289 } |
290 | 290 |
291 virtual size_t getPreferredStepSize() const { | 291 size_t getPreferredStepSize() const override { |
292 // Return this from m_config instead of m_defaultConfig, so | 292 // Return this from m_config instead of m_defaultConfig, so |
293 // that it gets updated in the event of an initialise() call | 293 // that it gets updated in the event of an initialise() call |
294 // that fails for the wrong value | 294 // that fails for the wrong value |
295 return m_config.framing.stepSize; | 295 return m_config.framing.stepSize; |
296 } | 296 } |
297 | 297 |
298 virtual size_t getMinChannelCount() const { | 298 size_t getMinChannelCount() const override { |
299 return m_psd.minChannelCount; | 299 return m_psd.minChannelCount; |
300 } | 300 } |
301 | 301 |
302 virtual size_t getMaxChannelCount() const { | 302 size_t getMaxChannelCount() const override { |
303 return m_psd.maxChannelCount; | 303 return m_psd.maxChannelCount; |
304 } | 304 } |
305 | 305 |
306 virtual OutputList getOutputDescriptors() const { | 306 OutputList getOutputDescriptors() const override { |
307 | 307 |
308 if (m_state == Failed) { | 308 if (m_state == Failed) { |
309 throw std::logic_error("Plugin is in failed state"); | 309 throw std::logic_error("Plugin is in failed state"); |
310 } | 310 } |
311 if (m_state == Configured) { | 311 if (m_state == Configured) { |
326 staticOutputs.push_back(od); | 326 staticOutputs.push_back(od); |
327 } | 327 } |
328 return staticOutputs; | 328 return staticOutputs; |
329 } | 329 } |
330 | 330 |
331 virtual FeatureSet process(const float *const *inputBuffers, | 331 FeatureSet process(const float *const *inputBuffers, |
332 Vamp::RealTime timestamp) { | 332 Vamp::RealTime timestamp) override { |
333 | 333 |
334 if (m_state == Failed) { | 334 if (m_state == Failed) { |
335 throw std::logic_error("Plugin is in failed state"); | 335 throw std::logic_error("Plugin is in failed state"); |
336 } | 336 } |
337 if (m_state == Loaded || m_state == Misconfigured) { | 337 if (m_state == Loaded || m_state == Misconfigured) { |
363 m_state = Failed; | 363 m_state = Failed; |
364 throw; | 364 throw; |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 virtual FeatureSet getRemainingFeatures() { | 368 FeatureSet getRemainingFeatures() override { |
369 | 369 |
370 if (m_state == Failed) { | 370 if (m_state == Failed) { |
371 throw std::logic_error("Plugin is in failed state"); | 371 throw std::logic_error("Plugin is in failed state"); |
372 } | 372 } |
373 if (m_state == Loaded || m_state == Misconfigured) { | 373 if (m_state == Loaded || m_state == Misconfigured) { |