comparison data/model/SparseModel.h @ 1466:f68911282993

Restore m_extendTo, which is needed for Tony
author Chris Cannam
date Tue, 15 May 2018 15:50:40 +0100
parents 0fb5d4e6edeb
children c01cbe41aeb5
comparison
equal deleted inserted replaced
1465:cee1be4fb8c1 1466:f68911282993
67 // 10 sample frames later. 67 // 10 sample frames later.
68 virtual int getResolution() const { 68 virtual int getResolution() const {
69 return m_resolution ? m_resolution : 1; 69 return m_resolution ? m_resolution : 1;
70 } 70 }
71 virtual void setResolution(int resolution); 71 virtual void setResolution(int resolution);
72 72
73 // Extend the end of the model. If this is set to something beyond
74 // the end of the final point in the model, then getEndFrame()
75 // will return this value. Otherwise getEndFrame() will return the
76 // end of the final point. (This is used by the Tony application)
77 virtual void extendEndFrame(sv_frame_t to) { m_extendTo = to; }
78
73 typedef PointType Point; 79 typedef PointType Point;
74 typedef std::multiset<PointType, 80 typedef std::multiset<PointType,
75 typename PointType::OrderComparator> PointList; 81 typename PointType::OrderComparator> PointList;
76 typedef typename PointList::iterator PointListIterator; 82 typedef typename PointList::iterator PointListIterator;
77 typedef typename PointList::const_iterator PointListConstIterator; 83 typedef typename PointList::const_iterator PointListConstIterator;
396 } 402 }
397 403
398 protected: 404 protected:
399 sv_samplerate_t m_sampleRate; 405 sv_samplerate_t m_sampleRate;
400 int m_resolution; 406 int m_resolution;
407 sv_frame_t m_extendTo;
401 bool m_notifyOnAdd; 408 bool m_notifyOnAdd;
402 sv_frame_t m_sinceLastNotifyMin; 409 sv_frame_t m_sinceLastNotifyMin;
403 sv_frame_t m_sinceLastNotifyMax; 410 sv_frame_t m_sinceLastNotifyMax;
404 bool m_hasTextLabels; 411 bool m_hasTextLabels;
405 412
541 SparseModel<PointType>::SparseModel(sv_samplerate_t sampleRate, 548 SparseModel<PointType>::SparseModel(sv_samplerate_t sampleRate,
542 int resolution, 549 int resolution,
543 bool notifyOnAdd) : 550 bool notifyOnAdd) :
544 m_sampleRate(sampleRate), 551 m_sampleRate(sampleRate),
545 m_resolution(resolution), 552 m_resolution(resolution),
553 m_extendTo(0),
546 m_notifyOnAdd(notifyOnAdd), 554 m_notifyOnAdd(notifyOnAdd),
547 m_sinceLastNotifyMin(-1), 555 m_sinceLastNotifyMin(-1),
548 m_sinceLastNotifyMax(-1), 556 m_sinceLastNotifyMax(-1),
549 m_hasTextLabels(false), 557 m_hasTextLabels(false),
550 m_pointCount(0), 558 m_pointCount(0),
572 sv_frame_t f = 0; 580 sv_frame_t f = 0;
573 if (!m_points.empty()) { 581 if (!m_points.empty()) {
574 PointListConstIterator i(m_points.end()); 582 PointListConstIterator i(m_points.end());
575 f = (--i)->frame + 1; 583 f = (--i)->frame + 1;
576 } 584 }
577 return f; 585 if (m_extendTo > f) {
586 return m_extendTo;
587 } else {
588 return f;
589 }
578 } 590 }
579 591
580 template <typename PointType> 592 template <typename PointType>
581 bool 593 bool
582 SparseModel<PointType>::isEmpty() const 594 SparseModel<PointType>::isEmpty() const