# HG changeset patch # User Chris Cannam # Date 1523957835 -3600 # Node ID b40f67578976bad8650f5ab244e719769407dcfb # Parent a12fd0456f0c1ebf1c4c4b917860c7715aebb9b9 Update getEndFrame so as to refer explicitly to final frame + 1 (consistent with selection semantics and existing wave model) diff -r a12fd0456f0c -r b40f67578976 data/model/Model.h --- a/data/model/Model.h Tue Apr 17 10:35:42 2018 +0100 +++ b/data/model/Model.h Tue Apr 17 10:37:15 2018 +0100 @@ -53,7 +53,11 @@ virtual sv_frame_t getStartFrame() const = 0; /** - * Return the last audio frame spanned by the model. + * Return the audio frame at the end of the model, i.e. 1 more + * than the final frame contained within the model. The end frame + * minus the start frame should yield the total duration in frames + * spanned by the model. This is consistent with the definition of + * the end frame of a Selection object. */ virtual sv_frame_t getEndFrame() const = 0; @@ -220,11 +224,11 @@ virtual QString toDelimitedDataString(QString delimiter) const { return toDelimitedDataStringSubset - (delimiter, getStartFrame(), getEndFrame() + 1); + (delimiter, getStartFrame(), getEndFrame()); } virtual QString toDelimitedDataStringWithOptions(QString delimiter, DataExportOptions opts) const { return toDelimitedDataStringSubsetWithOptions - (delimiter, opts, getStartFrame(), getEndFrame() + 1); + (delimiter, opts, getStartFrame(), getEndFrame()); } virtual QString toDelimitedDataStringSubset(QString, sv_frame_t /* f0 */, sv_frame_t /* f1 */) const { return ""; diff -r a12fd0456f0c -r b40f67578976 data/model/SparseModel.h --- 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::multisetframe; + f = (--i)->frame + 1; } - if (m_extendTo > f) return m_extendTo; - else return f; + return f; } template