Mercurial > hg > svapp
diff framework/Align.cpp @ 515:51befd6165a3 alignment-simple
Merge in from SV 3.0-integration branches
author | Chris Cannam |
---|---|
date | Wed, 02 Mar 2016 17:25:27 +0000 |
parents | adfb2948fabf |
children | b23bebfdfaba |
line wrap: on
line diff
--- a/framework/Align.cpp Mon Jun 15 09:15:55 2015 +0100 +++ b/framework/Align.cpp Wed Mar 02 17:25:27 2016 +0000 @@ -16,6 +16,7 @@ #include "Align.h" #include "data/model/WaveFileModel.h" +#include "data/model/ReadOnlyWaveFileModel.h" #include "data/model/AggregateWaveModel.h" #include "data/model/RangeSummarisableTimeValueModel.h" #include "data/model/SparseTimeValueModel.h" @@ -173,7 +174,9 @@ WaveFileModel *reference = qobject_cast<WaveFileModel *>(ref); WaveFileModel *rm = qobject_cast<WaveFileModel *>(other); - if (!rm) return false; // but this should have been tested already + if (!reference || !rm) { + return false; // but this should have been tested already + } while (!reference->isReady(0) || !rm->isReady(0)) { qApp->processEvents(); @@ -183,8 +186,15 @@ // model's audio file and the new model's audio file. It returns // the path in CSV form through stdout. - QString refPath = reference->getLocalFilename(); - QString otherPath = rm->getLocalFilename(); + ReadOnlyWaveFileModel *roref = qobject_cast<ReadOnlyWaveFileModel *>(reference); + ReadOnlyWaveFileModel *rorm = qobject_cast<ReadOnlyWaveFileModel *>(rm); + if (!roref || !rorm) { + cerr << "ERROR: Align::alignModelViaProgram: Can't align non-read-only models via program (no local filename available)" << endl; + return false; + } + + QString refPath = roref->getLocalFilename(); + QString otherPath = rorm->getLocalFilename(); if (refPath == "" || otherPath == "") { m_error = "Failed to find local filepath for wave-file model";