comparison data/model/SparseOneDimensionalModel.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 5b7b01da430a
children b234d4d011df
comparison
equal deleted inserted replaced
1658:5b7b01da430a 1659:8bf3a52a1604
58 virtual ~SparseOneDimensionalModel() { 58 virtual ~SparseOneDimensionalModel() {
59 PlayParameterRepository::getInstance()->removePlayable(this); 59 PlayParameterRepository::getInstance()->removePlayable(this);
60 } 60 }
61 61
62 QString getTypeName() const override { return tr("Sparse 1-D"); } 62 QString getTypeName() const override { return tr("Sparse 1-D"); }
63 63 bool isSparse() const { return true; }
64 bool isOK() const override { return true; } 64 bool isOK() const override { return true; }
65 sv_frame_t getStartFrame() const override { return m_events.getStartFrame(); } 65
66 sv_frame_t getEndFrame() const override { return m_events.getEndFrame(); } 66 sv_frame_t getStartFrame() const override {
67 return m_events.getStartFrame();
68 }
69 sv_frame_t getEndFrame() const override {
70 if (m_events.isEmpty()) return 0;
71 sv_frame_t e = m_events.getEndFrame() + 1;
72 if (e % m_resolution == 0) return e;
73 else return (e / m_resolution + 1) * m_resolution;
74 }
75
67 sv_samplerate_t getSampleRate() const override { return m_sampleRate; } 76 sv_samplerate_t getSampleRate() const override { return m_sampleRate; }
68 int getResolution() const { return m_resolution; } 77 int getResolution() const { return m_resolution; }
69 78
70 bool canPlay() const override { return true; } 79 bool canPlay() const override { return true; }
71 QString getDefaultPlayClipId() const override { return "tap"; } 80 QString getDefaultPlayClipId() const override { return "tap"; }