comparison data/model/AlignmentModel.cpp @ 662:6502c33b1cb1

* minor tidy
author Chris Cannam
date Sun, 24 Oct 2010 22:10:44 +0200
parents 52303ec15cd2
children 06f13a3b9e9e
comparison
equal deleted inserted replaced
658:29efe322ab47 662:6502c33b1cb1
248 248
249 void 249 void
250 AlignmentModel::constructReversePath() const 250 AlignmentModel::constructReversePath() const
251 { 251 {
252 if (!m_reversePath) { 252 if (!m_reversePath) {
253 /*!!!
254 if (!m_rawPath) {
255 std::cerr << "ERROR: AlignmentModel::constructReversePath: "
256 << "No raw path available" << std::endl;
257 return;
258 }
259 m_reversePath = new PathModel
260 (m_rawPath->getSampleRate(), m_rawPath->getResolution(), false);
261 */
262 if (!m_path) { 253 if (!m_path) {
263 std::cerr << "ERROR: AlignmentModel::constructReversePath: " 254 std::cerr << "ERROR: AlignmentModel::constructReversePath: "
264 << "No forward path available" << std::endl; 255 << "No forward path available" << std::endl;
265 return; 256 return;
266 } 257 }
267 m_reversePath = new PathModel 258 m_reversePath = new PathModel
268 (m_path->getSampleRate(), m_path->getResolution(), false); 259 (m_path->getSampleRate(), m_path->getResolution(), false);
269 } else { 260 } else {
270 /*!!!
271 if (!m_rawPath) return;
272 */
273 if (!m_path) return; 261 if (!m_path) return;
274 } 262 }
275 263
276 m_reversePath->clear(); 264 m_reversePath->clear();
277 /*!!!
278 SparseTimeValueModel::PointList points = m_rawPath->getPoints();
279
280 for (SparseTimeValueModel::PointList::const_iterator i = points.begin();
281 i != points.end(); ++i) {
282 long frame = i->frame;
283 float value = i->value;
284 long rframe = lrintf(value * m_aligned->getSampleRate());
285 m_reversePath->addPoint(PathPoint(rframe, frame));
286 }
287 */
288 265
289 PathModel::PointList points = m_path->getPoints(); 266 PathModel::PointList points = m_path->getPoints();
290 267
291 for (PathModel::PointList::const_iterator i = points.begin(); 268 for (PathModel::PointList::const_iterator i = points.begin();
292 i != points.end(); ++i) { 269 i != points.end(); ++i) {
373 AlignmentModel::setPath(PathModel *path) 350 AlignmentModel::setPath(PathModel *path)
374 { 351 {
375 if (m_path) m_path->aboutToDelete(); 352 if (m_path) m_path->aboutToDelete();
376 delete m_path; 353 delete m_path;
377 m_path = path; 354 m_path = path;
355 #ifdef DEBUG_ALIGNMENT_MODEL
356 std::cerr << "AlignmentModel::setPath: path = " << m_path << std::endl;
357 #endif
378 constructReversePath(); 358 constructReversePath();
359 #ifdef DEBUG_ALIGNMENT_MODEL
360 std::cerr << "AlignmentModel::setPath: after construction path = "
361 << m_path << ", rpath = " << m_reversePath << std::endl;
362 #endif
379 } 363 }
380 364
381 void 365 void
382 AlignmentModel::toXml(QTextStream &stream, 366 AlignmentModel::toXml(QTextStream &stream,
383 QString indent, 367 QString indent,