comparison framework/Document.cpp @ 112:e54dff673096

* Fix crash when aligning
author Chris Cannam
date Wed, 30 Apr 2008 16:58:19 +0000
parents c82913d31a53
children 3b61a975b47e
comparison
equal deleted inserted replaced
111:c82913d31a53 112:e54dff673096
829 (m_mainModel, -1)); 829 (m_mainModel, -1));
830 830
831 components.push_back(AggregateWaveModel::ModelChannelSpec 831 components.push_back(AggregateWaveModel::ModelChannelSpec
832 (rm, -1)); 832 (rm, -1));
833 833
834 Model *aggregate = new AggregateWaveModel(components); 834 Model *aggregateModel = new AggregateWaveModel(components);
835 ModelTransformer::Input aggregate(aggregateModel);
835 836
836 TransformId id = "vamp:match-vamp-plugin:match:path"; //!!! configure 837 TransformId id = "vamp:match-vamp-plugin:match:path"; //!!! configure
837 838
838 TransformFactory *tf = TransformFactory::getInstance(); 839 TransformFactory *tf = TransformFactory::getInstance();
839 840
840 Transform transform = tf->getDefaultTransformFor 841 Transform transform = tf->getDefaultTransformFor
841 (id, aggregate->getSampleRate()); 842 (id, aggregateModel->getSampleRate());
842 843
843 transform.setStepSize(transform.getBlockSize()/2); 844 transform.setStepSize(transform.getBlockSize()/2);
844 transform.setParameter("serialise", 1); 845 transform.setParameter("serialise", 1);
845 846
846 std::cerr << "Document::alignModel: Alignment transform step size " << transform.getStepSize() << ", block size " << transform.getBlockSize() << std::endl; 847 std::cerr << "Document::alignModel: Alignment transform step size " << transform.getStepSize() << ", block size " << transform.getBlockSize() << std::endl;
860 861
861 if (!path) { 862 if (!path) {
862 std::cerr << "Document::alignModel: ERROR: Failed to create alignment path (no MATCH plugin?)" << std::endl; 863 std::cerr << "Document::alignModel: ERROR: Failed to create alignment path (no MATCH plugin?)" << std::endl;
863 emit alignmentFailed(id, message); 864 emit alignmentFailed(id, message);
864 delete transformOutput; 865 delete transformOutput;
865 delete aggregate; 866 delete aggregateModel;
866 return; 867 return;
867 } 868 }
868 869
870 path->setCompletion(0);
871
869 AlignmentModel *alignmentModel = new AlignmentModel 872 AlignmentModel *alignmentModel = new AlignmentModel
870 (m_mainModel, model, aggregate, path); 873 (m_mainModel, model, aggregateModel, path);
871 874
872 rm->setAlignment(alignmentModel); 875 rm->setAlignment(alignmentModel);
873 } 876 }
874 877
875 void 878 void