changeset 1466:f68911282993

Restore m_extendTo, which is needed for Tony
author Chris Cannam
date Tue, 15 May 2018 15:50:40 +0100
parents cee1be4fb8c1
children 5630df84d99f
files data/model/SparseModel.h
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/data/model/SparseModel.h	Tue May 15 11:03:49 2018 +0100
+++ b/data/model/SparseModel.h	Tue May 15 15:50:40 2018 +0100
@@ -69,7 +69,13 @@
         return m_resolution ? m_resolution : 1;
     }
     virtual void setResolution(int resolution);
-    
+
+    // Extend the end of the model. If this is set to something beyond
+    // the end of the final point in the model, then getEndFrame()
+    // will return this value. Otherwise getEndFrame() will return the
+    // end of the final point. (This is used by the Tony application)
+    virtual void extendEndFrame(sv_frame_t to) { m_extendTo = to; }
+
     typedef PointType Point;
     typedef std::multiset<PointType,
                           typename PointType::OrderComparator> PointList;
@@ -398,6 +404,7 @@
 protected:
     sv_samplerate_t m_sampleRate;
     int m_resolution;
+    sv_frame_t m_extendTo;
     bool m_notifyOnAdd;
     sv_frame_t m_sinceLastNotifyMin;
     sv_frame_t m_sinceLastNotifyMax;
@@ -543,6 +550,7 @@
                                     bool notifyOnAdd) :
     m_sampleRate(sampleRate),
     m_resolution(resolution),
+    m_extendTo(0),
     m_notifyOnAdd(notifyOnAdd),
     m_sinceLastNotifyMin(-1),
     m_sinceLastNotifyMax(-1),
@@ -574,7 +582,11 @@
         PointListConstIterator i(m_points.end());
         f = (--i)->frame + 1;
     }
-    return f;
+    if (m_extendTo > f) {
+        return m_extendTo;
+    } else {
+        return f;
+    }
 }
 
 template <typename PointType>