comparison transform/ModelTransformerFactory.cpp @ 516:5ab561f664f2

* make it possible to avoid pulling in widgets for non-gui (i.e. runner) build
author Chris Cannam
date Thu, 11 Dec 2008 11:04:01 +0000
parents a70dcfed59c1
children 12578237b99c
comparison
equal deleted inserted replaced
515:1aefb666ecfc 516:5ab561f664f2
24 24
25 #include "plugin/FeatureExtractionPluginFactory.h" 25 #include "plugin/FeatureExtractionPluginFactory.h"
26 #include "plugin/RealTimePluginFactory.h" 26 #include "plugin/RealTimePluginFactory.h"
27 #include "plugin/PluginXml.h" 27 #include "plugin/PluginXml.h"
28 28
29 #ifndef NO_SV_GUI
29 #include "widgets/PluginParameterDialog.h" 30 #include "widgets/PluginParameterDialog.h"
31 #endif
30 32
31 #include "data/model/DenseTimeValueModel.h" 33 #include "data/model/DenseTimeValueModel.h"
32 34
33 #include <vamp-hostsdk/PluginHostAdapter.h> 35 #include <vamp-hostsdk/PluginHostAdapter.h>
34 36
196 198
197 // For this interactive usage, we want to override those with 199 // For this interactive usage, we want to override those with
198 // whatever the user chose last time around 200 // whatever the user chose last time around
199 PluginXml(plugin).setParametersFromXml(configurationXml); 201 PluginXml(plugin).setParametersFromXml(configurationXml);
200 202
203 #ifndef NO_SV_GUI
201 int sourceChannels = 1; 204 int sourceChannels = 1;
202 if (dynamic_cast<DenseTimeValueModel *>(inputModel)) { 205 if (dynamic_cast<DenseTimeValueModel *>(inputModel)) {
203 sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel) 206 sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel)
204 ->getChannelCount(); 207 ->getChannelCount();
205 } 208 }
284 287
285 transform.setStepSize(stepSize); 288 transform.setStepSize(stepSize);
286 transform.setBlockSize(blockSize); 289 transform.setBlockSize(blockSize);
287 transform.setWindowType(windowType); 290 transform.setWindowType(windowType);
288 291
292 #endif
293
289 TransformFactory::getInstance()-> 294 TransformFactory::getInstance()->
290 makeContextConsistentWithPlugin(transform, plugin); 295 makeContextConsistentWithPlugin(transform, plugin);
291 296
292 configurationXml = PluginXml(plugin).toXmlString(); 297 configurationXml = PluginXml(plugin).toXmlString();
293 298
299 #ifndef NO_SV_GUI
294 delete dialog; 300 delete dialog;
301 #endif
295 302
296 if (effect && source) { 303 if (effect && source) {
297 source->setAuditioningEffect(0); // will delete our plugin 304 source->setAuditioningEffect(0); // will delete our plugin
298 } else { 305 } else {
299 delete plugin; 306 delete plugin;
305 input.setModel(inputModel); 312 input.setModel(inputModel);
306 } 313 }
307 314
308 return input; 315 return input;
309 } 316 }
310 /*!!! 317
311 PluginTransformer::ExecutionContext
312 ModelTransformerFactory::getDefaultContextForTransformer(TransformId identifier,
313 Model *inputModel)
314 {
315 PluginTransformer::ExecutionContext context(-1);
316
317 QString id = identifier.section(':', 0, 2);
318
319 if (FeatureExtractionPluginFactory::instanceFor(id)) {
320
321 Vamp::Plugin *vp =
322 FeatureExtractionPluginFactory::instanceFor(id)->instantiatePlugin
323 (id, inputModel ? inputModel->getSampleRate() : 48000);
324
325 if (vp) {
326 context = PluginTransformer::ExecutionContext(-1, vp);
327 delete vp;
328 }
329 }
330
331 return context;
332 }
333 */
334 ModelTransformer * 318 ModelTransformer *
335 ModelTransformerFactory::createTransformer(const Transform &transform, 319 ModelTransformerFactory::createTransformer(const Transform &transform,
336 const ModelTransformer::Input &input) 320 const ModelTransformer::Input &input)
337 { 321 {
338 ModelTransformer *transformer = 0; 322 ModelTransformer *transformer = 0;