diff data/model/SparseModel.h @ 1451:b40f67578976 streaming-csv-writer

Update getEndFrame so as to refer explicitly to final frame + 1 (consistent with selection semantics and existing wave model)
author Chris Cannam
date Tue, 17 Apr 2018 10:37:15 +0100
parents 48e9f538e6e9
children 6e9615bde1f9
line wrap: on
line diff
--- a/data/model/SparseModel.h	Tue Apr 17 10:35:42 2018 +0100
+++ b/data/model/SparseModel.h	Tue Apr 17 10:37:15 2018 +0100
@@ -62,12 +62,6 @@
         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.
-    virtual void extendEndFrame(sv_frame_t to) { m_extendTo = to; }
     
     typedef PointType Point;
     typedef std::multiset<PointType,
@@ -168,7 +162,7 @@
                                                      DataExportOptions opts) const {
         return toDelimitedDataStringSubsetWithOptions
             (delimiter, opts,
-             std::min(getStartFrame(), sv_frame_t(0)), getEndFrame() + 1);
+             std::min(getStartFrame(), sv_frame_t(0)), getEndFrame());
     }
 
     virtual QString toDelimitedDataStringSubset(QString delimiter, sv_frame_t f0, sv_frame_t f1) const {
@@ -395,7 +389,6 @@
 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;
@@ -541,7 +534,6 @@
                                     bool notifyOnAdd) :
     m_sampleRate(sampleRate),
     m_resolution(resolution),
-    m_extendTo(0),
     m_notifyOnAdd(notifyOnAdd),
     m_sinceLastNotifyMin(-1),
     m_sinceLastNotifyMax(-1),
@@ -571,10 +563,9 @@
     sv_frame_t f = 0;
     if (!m_points.empty()) {
         PointListConstIterator i(m_points.end());
-        f = (--i)->frame;
+        f = (--i)->frame + 1;
     }
-    if (m_extendTo > f) return m_extendTo;
-    else return f;
+    return f;
 }
 
 template <typename PointType>