comparison framework/Document.cpp @ 90:db267a315058

* Make alignment plugin configurable through settings file, even though it isn't yet available in the preferences GUI
author Chris Cannam
date Thu, 07 Feb 2008 12:35:08 +0000
parents dd74c5332b49
children 907e44e4ecf0
comparison
equal deleted inserted replaced
89:3b616971bdc6 90:db267a315058
27 #include "base/PlayParameters.h" 27 #include "base/PlayParameters.h"
28 #include "plugin/transform/TransformFactory.h" 28 #include "plugin/transform/TransformFactory.h"
29 #include "plugin/transform/ModelTransformerFactory.h" 29 #include "plugin/transform/ModelTransformerFactory.h"
30 #include <QApplication> 30 #include <QApplication>
31 #include <QTextStream> 31 #include <QTextStream>
32 #include <QSettings>
32 #include <iostream> 33 #include <iostream>
33 34
34 // For alignment: 35 // For alignment:
35 #include "data/model/AggregateWaveModel.h" 36 #include "data/model/AggregateWaveModel.h"
36 #include "data/model/SparseTimeValueModel.h" 37 #include "data/model/SparseTimeValueModel.h"
757 { 758 {
758 if (model == m_mainModel) return true; 759 if (model == m_mainModel) return true;
759 return (m_models.find(const_cast<Model *>(model)) != m_models.end()); 760 return (m_models.find(const_cast<Model *>(model)) != m_models.end());
760 } 761 }
761 762
763 TransformId
764 Document::getAlignmentTransformName()
765 {
766 QSettings settings;
767 settings.beginGroup("Alignment");
768 TransformId id =
769 settings.value("transform-id",
770 "vamp:match-vamp-plugin:match:path").toString();
771 settings.endGroup();
772 return id;
773 }
774
762 bool 775 bool
763 Document::canAlign() 776 Document::canAlign()
764 { 777 {
765 TransformId id = "vamp:match-vamp-plugin:match:path"; 778 TransformId id = getAlignmentTransformName();
766 TransformFactory *factory = TransformFactory::getInstance(); 779 TransformFactory *factory = TransformFactory::getInstance();
767 return factory->haveTransform(id); 780 return factory->haveTransform(id);
768 } 781 }
769 782
770 void 783 void
829 842
830 transform.setStepSize(transform.getBlockSize()/2); 843 transform.setStepSize(transform.getBlockSize()/2);
831 transform.setParameter("serialise", 1); 844 transform.setParameter("serialise", 1);
832 845
833 std::cerr << "Document::alignModel: Alignment transform step size " << transform.getStepSize() << ", block size " << transform.getBlockSize() << std::endl; 846 std::cerr << "Document::alignModel: Alignment transform step size " << transform.getStepSize() << ", block size " << transform.getBlockSize() << std::endl;
834
835 //!!! QString args = "<plugin param-serialise=\"1\"/>";
836 // Model *transformOutput = factory->transform(id, aggregate, context, args);
837 847
838 ModelTransformerFactory *mtf = ModelTransformerFactory::getInstance(); 848 ModelTransformerFactory *mtf = ModelTransformerFactory::getInstance();
839 849
840 QString message; 850 QString message;
841 Model *transformOutput = mtf->transform(transform, aggregate, message); 851 Model *transformOutput = mtf->transform(transform, aggregate, message);