diff data/model/RegionModel.h @ 1659:8bf3a52a1604 single-point

Work on start/end frame stuff to match API description
author Chris Cannam
date Thu, 21 Mar 2019 11:35:30 +0000
parents 31b46a5647db
children 82d03c9661f9
line wrap: on
line diff
--- a/data/model/RegionModel.h	Wed Mar 20 16:22:13 2019 +0000
+++ b/data/model/RegionModel.h	Thu Mar 21 11:35:30 2019 +0000
@@ -77,10 +77,19 @@
     }
 
     QString getTypeName() const override { return tr("Region"); }
+    bool isSparse() const { return true; }
+    bool isOK() const override { return true; }
 
-    bool isOK() const override { return true; }
-    sv_frame_t getStartFrame() const override { return m_events.getStartFrame(); }
-    sv_frame_t getEndFrame() const override { return m_events.getEndFrame(); }
+    sv_frame_t getStartFrame() const override {
+        return m_events.getStartFrame();
+    }
+    sv_frame_t getEndFrame() const override {
+        if (m_events.isEmpty()) return 0;
+        sv_frame_t e = m_events.getEndFrame();
+        if (e % m_resolution == 0) return e;
+        else return (e / m_resolution + 1) * m_resolution;
+    }
+
     sv_samplerate_t getSampleRate() const override { return m_sampleRate; }
     int getResolution() const { return m_resolution; }