Mercurial > hg > svcore
diff data/model/SparseModel.h @ 1066:9fc8823a73e9 tonioni
Permit extending nominal end of sparse model
author | Chris Cannam |
---|---|
date | Tue, 31 Mar 2015 12:27:56 +0100 |
parents | 0fd3661bcfff |
children | 882d448c8a6d e22bfe8ca248 |
line wrap: on
line diff
--- 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<PointType, typename PointType::OrderComparator> 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 <typename PointType>