comparison data/model/SparseModel.h @ 1040:a1cd5abcb38b cxx11

Introduce and use a samplerate type
author Chris Cannam
date Wed, 04 Mar 2015 12:01:04 +0000
parents cc27f35aa75c
children 57633d605547
comparison
equal deleted inserted replaced
1039:b14064bd1f97 1040:a1cd5abcb38b
41 template <typename PointType> 41 template <typename PointType>
42 class SparseModel : public Model, 42 class SparseModel : public Model,
43 public TabularModel 43 public TabularModel
44 { 44 {
45 public: 45 public:
46 SparseModel(int sampleRate, int resolution, 46 SparseModel(sv_samplerate_t sampleRate, int resolution,
47 bool notifyOnAdd = true); 47 bool notifyOnAdd = true);
48 virtual ~SparseModel() { } 48 virtual ~SparseModel() { }
49 49
50 virtual bool isOK() const { return true; } 50 virtual bool isOK() const { return true; }
51 virtual sv_frame_t getStartFrame() const; 51 virtual sv_frame_t getStartFrame() const;
52 virtual sv_frame_t getEndFrame() const; 52 virtual sv_frame_t getEndFrame() const;
53 virtual int getSampleRate() const { return m_sampleRate; } 53 virtual sv_samplerate_t getSampleRate() const { return m_sampleRate; }
54 54
55 virtual Model *clone() const; 55 virtual Model *clone() const;
56 56
57 // Number of frames of the underlying sample rate that this model 57 // Number of frames of the underlying sample rate that this model
58 // is capable of resolving to. For example, if m_resolution == 10 58 // is capable of resolving to. For example, if m_resolution == 10
364 command->deletePoint(*i); 364 command->deletePoint(*i);
365 return command->finish(); 365 return command->finish();
366 } 366 }
367 367
368 protected: 368 protected:
369 int m_sampleRate; 369 sv_samplerate_t m_sampleRate;
370 int m_resolution; 370 int m_resolution;
371 bool m_notifyOnAdd; 371 bool m_notifyOnAdd;
372 sv_frame_t m_sinceLastNotifyMin; 372 sv_frame_t m_sinceLastNotifyMin;
373 sv_frame_t m_sinceLastNotifyMax; 373 sv_frame_t m_sinceLastNotifyMax;
374 bool m_hasTextLabels; 374 bool m_hasTextLabels;
458 } 458 }
459 }; 459 };
460 460
461 461
462 template <typename PointType> 462 template <typename PointType>
463 SparseModel<PointType>::SparseModel(int sampleRate, 463 SparseModel<PointType>::SparseModel(sv_samplerate_t sampleRate,
464 int resolution, 464 int resolution,
465 bool notifyOnAdd) : 465 bool notifyOnAdd) :
466 m_sampleRate(sampleRate), 466 m_sampleRate(sampleRate),
467 m_resolution(resolution), 467 m_resolution(resolution),
468 m_notifyOnAdd(notifyOnAdd), 468 m_notifyOnAdd(notifyOnAdd),