comparison transform/TransformFactory.cpp @ 182:21a76c9ed5c3

* Merge transform directory from sv-match-alignment branch (the previous comment included notes for this stuff, but I missed it in the actual merge) * Fix crash when a transform fails to create an output model and the thread that created the transform then deletes its input model thinking it's no longer needed, even though the transform run thread is still using it -- fix is to wait() on the transform before returning the null output model
author Chris Cannam
date Fri, 28 Sep 2007 16:15:06 +0000
parents aaf806ce329a
children ebd906049fb6
comparison
equal deleted inserted replaced
181:a65a01870d8c 182:21a76c9ed5c3
290 description, 290 description,
291 maker, 291 maker,
292 units, 292 units,
293 configurable); 293 configurable);
294 } 294 }
295
296 delete plugin;
295 } 297 }
296 } 298 }
297 299
298 void 300 void
299 TransformFactory::populateRealTimePlugins(TransformDescriptionMap &transforms) 301 TransformFactory::populateRealTimePlugins(TransformDescriptionMap &transforms)
551 bool effect = false; 553 bool effect = false;
552 bool generator = false; 554 bool generator = false;
553 555
554 if (FeatureExtractionPluginFactory::instanceFor(id)) { 556 if (FeatureExtractionPluginFactory::instanceFor(id)) {
555 557
558 std::cerr << "getConfigurationForTransform: instantiating Vamp plugin" << std::endl;
559
556 Vamp::Plugin *vp = 560 Vamp::Plugin *vp =
557 FeatureExtractionPluginFactory::instanceFor(id)->instantiatePlugin 561 FeatureExtractionPluginFactory::instanceFor(id)->instantiatePlugin
558 (id, inputModel->getSampleRate()); 562 (id, inputModel->getSampleRate());
559 563
560 if (vp) { 564 if (vp) {
707 711
708 Vamp::Plugin *vp = 712 Vamp::Plugin *vp =
709 FeatureExtractionPluginFactory::instanceFor(id)->instantiatePlugin 713 FeatureExtractionPluginFactory::instanceFor(id)->instantiatePlugin
710 (id, inputModel ? inputModel->getSampleRate() : 48000); 714 (id, inputModel ? inputModel->getSampleRate() : 48000);
711 715
712 if (vp) context = PluginTransform::ExecutionContext(-1, vp); 716 if (vp) {
713 717 context = PluginTransform::ExecutionContext(-1, vp);
718 delete vp;
719 }
714 } 720 }
715 721
716 return context; 722 return context;
717 } 723 }
718 724
777 model->setObjectName(imn); 783 model->setObjectName(imn);
778 } 784 }
779 } else if (trn != "") { 785 } else if (trn != "") {
780 model->setObjectName(trn); 786 model->setObjectName(trn);
781 } 787 }
788 } else {
789 t->wait();
782 } 790 }
783 791
784 return model; 792 return model;
785 } 793 }
786 794