comparison transform/TransformFactory.cpp @ 79:9e027aa5b5c3

* Avoid instantiating a plugin twice when configuring it (the min/max channel count call was instantiating the plugin again) * Add static library credits to the About box for static builds
author Chris Cannam
date Mon, 24 Apr 2006 15:52:20 +0000
parents 2beca8ddcdc3
children 0a846f83a4b7
comparison
equal deleted inserted replaced
78:c983dda79f72 79:9e027aa5b5c3
332 332
333 return false; 333 return false;
334 } 334 }
335 335
336 bool 336 bool
337 TransformFactory::getChannelRange(TransformName name, Vamp::PluginBase *plugin,
338 int &minChannels, int &maxChannels)
339 {
340 Vamp::Plugin *vp = 0;
341 if ((vp = dynamic_cast<Vamp::Plugin *>(plugin))) {
342 minChannels = vp->getMinChannelCount();
343 maxChannels = vp->getMaxChannelCount();
344 return true;
345 } else {
346 return getTransformChannelRange(name, minChannels, maxChannels);
347 }
348 }
349
350 bool
337 TransformFactory::getConfigurationForTransform(TransformName name, 351 TransformFactory::getConfigurationForTransform(TransformName name,
338 Model *inputModel, 352 Model *inputModel,
339 int &channel, 353 int &channel,
340 QString &configurationXml) 354 QString &configurationXml)
341 { 355 {
370 sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel) 384 sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel)
371 ->getChannelCount(); 385 ->getChannelCount();
372 } 386 }
373 387
374 int minChannels = 1, maxChannels = sourceChannels; 388 int minChannels = 1, maxChannels = sourceChannels;
375 getTransformChannelRange(name, minChannels, maxChannels); 389 getChannelRange(name, plugin, minChannels, maxChannels);
376 390
377 int targetChannels = sourceChannels; 391 int targetChannels = sourceChannels;
378 if (sourceChannels < minChannels) targetChannels = minChannels; 392 if (sourceChannels < minChannels) targetChannels = minChannels;
379 if (sourceChannels > maxChannels) targetChannels = maxChannels; 393 if (sourceChannels > maxChannels) targetChannels = maxChannels;
380 394