Mercurial > hg > svapp
comparison framework/Align.cpp @ 595:b23bebfdfaba
Untabify
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2018 18:02:22 +0000 |
parents | 51befd6165a3 |
children | e2715204feaa |
comparison
equal
deleted
inserted
replaced
594:72b4870f0e6b | 595:b23bebfdfaba |
---|---|
137 | 137 |
138 if (!path) { | 138 if (!path) { |
139 cerr << "Align::alignModel: ERROR: Failed to create alignment path (no MATCH plugin?)" << endl; | 139 cerr << "Align::alignModel: ERROR: Failed to create alignment path (no MATCH plugin?)" << endl; |
140 delete transformOutput; | 140 delete transformOutput; |
141 delete aggregateModel; | 141 delete aggregateModel; |
142 m_error = message; | 142 m_error = message; |
143 return false; | 143 return false; |
144 } | 144 } |
145 | 145 |
146 path->setCompletion(0); | 146 path->setCompletion(0); |
147 | 147 |
195 | 195 |
196 QString refPath = roref->getLocalFilename(); | 196 QString refPath = roref->getLocalFilename(); |
197 QString otherPath = rorm->getLocalFilename(); | 197 QString otherPath = rorm->getLocalFilename(); |
198 | 198 |
199 if (refPath == "" || otherPath == "") { | 199 if (refPath == "" || otherPath == "") { |
200 m_error = "Failed to find local filepath for wave-file model"; | 200 m_error = "Failed to find local filepath for wave-file model"; |
201 return false; | 201 return false; |
202 } | 202 } |
203 | 203 |
204 m_error = ""; | 204 m_error = ""; |
205 | 205 |
206 AlignmentModel *alignmentModel = new AlignmentModel(reference, other, 0, 0); | 206 AlignmentModel *alignmentModel = new AlignmentModel(reference, other, 0, 0); |
245 | 245 |
246 AlignmentModel *alignmentModel = m_processModels[process]; | 246 AlignmentModel *alignmentModel = m_processModels[process]; |
247 | 247 |
248 if (exitCode == 0 && status == 0) { | 248 if (exitCode == 0 && status == 0) { |
249 | 249 |
250 CSVFormat format; | 250 CSVFormat format; |
251 format.setModelType(CSVFormat::TwoDimensionalModel); | 251 format.setModelType(CSVFormat::TwoDimensionalModel); |
252 format.setTimingType(CSVFormat::ExplicitTiming); | 252 format.setTimingType(CSVFormat::ExplicitTiming); |
253 format.setTimeUnits(CSVFormat::TimeSeconds); | 253 format.setTimeUnits(CSVFormat::TimeSeconds); |
254 format.setColumnCount(2); | 254 format.setColumnCount(2); |
255 // The output format has time in the reference file first, and | 255 // The output format has time in the reference file first, and |
256 // time in the "other" file in the second column. This is a | 256 // time in the "other" file in the second column. This is a |
257 // more natural approach for a command-line alignment tool, | 257 // more natural approach for a command-line alignment tool, |
258 // but it's the opposite of what we expect for native | 258 // but it's the opposite of what we expect for native |
259 // alignment paths, which map from "other" file to | 259 // alignment paths, which map from "other" file to |
260 // reference. These column purpose settings reflect that. | 260 // reference. These column purpose settings reflect that. |
261 format.setColumnPurpose(1, CSVFormat::ColumnStartTime); | 261 format.setColumnPurpose(1, CSVFormat::ColumnStartTime); |
262 format.setColumnPurpose(0, CSVFormat::ColumnValue); | 262 format.setColumnPurpose(0, CSVFormat::ColumnValue); |
263 format.setAllowQuoting(false); | 263 format.setAllowQuoting(false); |
264 format.setSeparator(','); | 264 format.setSeparator(','); |
265 | 265 |
266 CSVFileReader reader(process, format, alignmentModel->getSampleRate()); | 266 CSVFileReader reader(process, format, alignmentModel->getSampleRate()); |
267 if (!reader.isOK()) { | 267 if (!reader.isOK()) { |
268 cerr << "ERROR: Align::alignmentProgramFinished: Failed to parse output" | 268 cerr << "ERROR: Align::alignmentProgramFinished: Failed to parse output" |
269 << endl; | 269 << endl; |
270 m_error = QString("Failed to parse output of program: %1") | 270 m_error = QString("Failed to parse output of program: %1") |
271 .arg(reader.getError()); | 271 .arg(reader.getError()); |
272 goto done; | 272 goto done; |
273 } | 273 } |
274 | 274 |
275 Model *csvOutput = reader.load(); | 275 Model *csvOutput = reader.load(); |
276 | 276 |
277 SparseTimeValueModel *path = qobject_cast<SparseTimeValueModel *>(csvOutput); | 277 SparseTimeValueModel *path = qobject_cast<SparseTimeValueModel *>(csvOutput); |
278 if (!path) { | 278 if (!path) { |
279 cerr << "ERROR: Align::alignmentProgramFinished: Output did not convert to sparse time-value model" | 279 cerr << "ERROR: Align::alignmentProgramFinished: Output did not convert to sparse time-value model" |
280 << endl; | 280 << endl; |
281 m_error = QString("Output of program did not produce sparse time-value model"); | 281 m_error = QString("Output of program did not produce sparse time-value model"); |
282 goto done; | 282 goto done; |
283 } | 283 } |
284 | 284 |
285 if (path->getPoints().empty()) { | 285 if (path->getPoints().empty()) { |
286 cerr << "ERROR: Align::alignmentProgramFinished: Output contained no mappings" | 286 cerr << "ERROR: Align::alignmentProgramFinished: Output contained no mappings" |
287 << endl; | 287 << endl; |
288 m_error = QString("Output of alignment program contained no mappings"); | 288 m_error = QString("Output of alignment program contained no mappings"); |
289 goto done; | 289 goto done; |
290 } | 290 } |
291 | 291 |
292 cerr << "Align::alignmentProgramFinished: Setting alignment path (" | 292 cerr << "Align::alignmentProgramFinished: Setting alignment path (" |
293 << path->getPoints().size() << " point(s))" << endl; | 293 << path->getPoints().size() << " point(s))" << endl; |
294 | 294 |
295 alignmentModel->setPathFrom(path); | 295 alignmentModel->setPathFrom(path); |
298 | 298 |
299 } else { | 299 } else { |
300 cerr << "ERROR: Align::alignmentProgramFinished: Aligner program " | 300 cerr << "ERROR: Align::alignmentProgramFinished: Aligner program " |
301 << "failed: exit code " << exitCode << ", status " << status | 301 << "failed: exit code " << exitCode << ", status " << status |
302 << endl; | 302 << endl; |
303 m_error = "Aligner process returned non-zero exit status"; | 303 m_error = "Aligner process returned non-zero exit status"; |
304 } | 304 } |
305 | 305 |
306 done: | 306 done: |
307 m_processModels.erase(process); | 307 m_processModels.erase(process); |
308 delete process; | 308 delete process; |