comparison data/model/SparseModel.h @ 785:05ba4bbd2b87

Warn if the output sample rate is higher than that of the input model
author Chris Cannam
date Thu, 28 Mar 2013 17:08:04 +0000
parents d373ced0e6e9
children 33fca917c800
comparison
equal deleted inserted replaced
783:459235dccff6 785:05ba4bbd2b87
434 PointListConstIterator i0, i1; 434 PointListConstIterator i0, i1;
435 getPointIterators(frame, i0, i1); 435 getPointIterators(frame, i0, i1);
436 PointListConstIterator i = i0; 436 PointListConstIterator i = i0;
437 437
438 for (i = i0; i != i1; ++i) { 438 for (i = i0; i != i1; ++i) {
439 // std::cerr << "i->frame is " << i->frame << ", wanting " << frame << std::endl;
440
439 if (i->frame < (int)frame) { continue; } 441 if (i->frame < (int)frame) { continue; }
440 if (indexAtFrame > 0) { --indexAtFrame; continue; } 442 if (indexAtFrame > 0) { --indexAtFrame; continue; }
441 return i; 443 return i;
442 } 444 }
445
446 // std::cerr << "returning i with i->frame = " << i->frame << std::endl;
443 447
444 if (indexAtFrame > 0) { 448 if (indexAtFrame > 0) {
445 std::cerr << "WARNING: SparseModel::getPointListIteratorForRow: No iterator available for row " << row << " (frame = " << frame << ", index at frame = " << initialIndexAtFrame << ", leftover index " << indexAtFrame << ")" << std::endl; 449 std::cerr << "WARNING: SparseModel::getPointListIteratorForRow: No iterator available for row " << row << " (frame = " << frame << ", index at frame = " << initialIndexAtFrame << ", leftover index " << indexAtFrame << ")" << std::endl;
446 } 450 }
447 return i; 451 return i;
596 PointListConstIterator &endItr) const 600 PointListConstIterator &endItr) const
597 { 601 {
598 QMutexLocker locker(&m_mutex); 602 QMutexLocker locker(&m_mutex);
599 603
600 if (m_resolution == 0) { 604 if (m_resolution == 0) {
605 // std::cerr << "getPointIterators: resolution == 0, returning end()" << std::endl;
601 startItr = m_points.end(); 606 startItr = m_points.end();
602 endItr = m_points.end(); 607 endItr = m_points.end();
603 return; 608 return;
604 } 609 }
605 610
607 long end = start + m_resolution; 612 long end = start + m_resolution;
608 613
609 PointType startPoint(start), endPoint(end); 614 PointType startPoint(start), endPoint(end);
610 615
611 // std::cerr << "getPointIterators: start frame " << start << ", end frame " << end << ", m_resolution " << m_resolution << std::endl; 616 // std::cerr << "getPointIterators: start frame " << start << ", end frame " << end << ", m_resolution " << m_resolution << std::endl;
612 617
613 startItr = m_points.lower_bound(startPoint); 618 startItr = m_points.lower_bound(startPoint);
614 endItr = m_points.upper_bound(endPoint); 619 endItr = m_points.upper_bound(endPoint);
615 } 620 }
616 621
617 template <typename PointType> 622 template <typename PointType>