comparison data/model/SparseOneDimensionalModel.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
43 stream << QString("%1<point frame=\"%2\" label=\"%3\" %4/>\n") 43 stream << QString("%1<point frame=\"%2\" label=\"%3\" %4/>\n")
44 .arg(indent).arg(frame).arg(XmlExportable::encodeEntities(label)) 44 .arg(indent).arg(frame).arg(XmlExportable::encodeEntities(label))
45 .arg(extraAttributes); 45 .arg(extraAttributes);
46 } 46 }
47 47
48 QString toDelimitedDataString(QString delimiter, int sampleRate) const 48 QString toDelimitedDataString(QString delimiter, sv_samplerate_t sampleRate) const
49 { 49 {
50 QStringList list; 50 QStringList list;
51 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); 51 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str();
52 if (label != "") list << label; 52 if (label != "") list << label;
53 return list.join(delimiter); 53 return list.join(delimiter);
74 public NoteExportable 74 public NoteExportable
75 { 75 {
76 Q_OBJECT 76 Q_OBJECT
77 77
78 public: 78 public:
79 SparseOneDimensionalModel(int sampleRate, int resolution, 79 SparseOneDimensionalModel(sv_samplerate_t sampleRate, int resolution,
80 bool notifyOnAdd = true) : 80 bool notifyOnAdd = true) :
81 SparseModel<OneDimensionalPoint>(sampleRate, resolution, notifyOnAdd) 81 SparseModel<OneDimensionalPoint>(sampleRate, resolution, notifyOnAdd)
82 { 82 {
83 PlayParameterRepository::getInstance()->addPlayable(this); 83 PlayParameterRepository::getInstance()->addPlayable(this);
84 } 84 }
195 for (PointList::iterator pli = 195 for (PointList::iterator pli =
196 points.begin(); pli != points.end(); ++pli) { 196 points.begin(); pli != points.end(); ++pli) {
197 197
198 notes.push_back 198 notes.push_back
199 (NoteData(pli->frame, 199 (NoteData(pli->frame,
200 getSampleRate() / 6, // arbitrary short duration 200 sv_frame_t(getSampleRate() / 6), // arbitrary short duration
201 64, // default pitch 201 64, // default pitch
202 100)); // default velocity 202 100)); // default velocity
203 } 203 }
204 204
205 return notes; 205 return notes;