# HG changeset patch # User Chris Cannam # Date 1427801276 -3600 # Node ID 9fc8823a73e99aa15796140579f0ab94611f4926 # Parent 0fd3661bcfffc7002c399bd9b7b6c8579f42be3a Permit extending nominal end of sparse model diff -r 0fd3661bcfff -r 9fc8823a73e9 data/model/SparseModel.h --- a/data/model/SparseModel.h Tue Mar 31 12:12:31 2015 +0100 +++ b/data/model/SparseModel.h Tue Mar 31 12:27:56 2015 +0100 @@ -62,6 +62,12 @@ } 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 PointList; @@ -375,6 +381,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; @@ -515,6 +522,7 @@ bool notifyOnAdd) : m_sampleRate(sampleRate), m_resolution(resolution), + m_extendTo(0), m_notifyOnAdd(notifyOnAdd), m_sinceLastNotifyMin(-1), m_sinceLastNotifyMax(-1), @@ -546,7 +554,8 @@ PointListConstIterator i(m_points.end()); f = (--i)->frame; } - return f; + if (m_extendTo > f) return m_extendTo; + else return f; } template