diff data/model/NoteModel.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/NoteModel.h	Wed Mar 20 16:22:13 2019 +0000
+++ b/data/model/NoteModel.h	Thu Mar 21 11:35:30 2019 +0000
@@ -96,10 +96,19 @@
 
     QString getTypeName() const override { return tr("Note"); }
     Subtype getSubtype() const { return m_subtype; }
+    bool isSparse() const { return true; }
+    bool isOK() const override { return true; }
+    
+    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;
+    }
 
-    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_samplerate_t getSampleRate() const override { return m_sampleRate; }
     int getResolution() const { return m_resolution; }