Mercurial > hg > svcore
comparison data/model/SparseTimeValueModel.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 |
---|---|
47 stream << QString("%1<point frame=\"%2\" value=\"%3\" label=\"%4\" %5/>\n") | 47 stream << QString("%1<point frame=\"%2\" value=\"%3\" label=\"%4\" %5/>\n") |
48 .arg(indent).arg(frame).arg(value).arg(XmlExportable::encodeEntities(label)) | 48 .arg(indent).arg(frame).arg(value).arg(XmlExportable::encodeEntities(label)) |
49 .arg(extraAttributes); | 49 .arg(extraAttributes); |
50 } | 50 } |
51 | 51 |
52 QString toDelimitedDataString(QString delimiter, int sampleRate) const | 52 QString toDelimitedDataString(QString delimiter, sv_samplerate_t sampleRate) const |
53 { | 53 { |
54 QStringList list; | 54 QStringList list; |
55 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); | 55 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); |
56 list << QString("%1").arg(value); | 56 list << QString("%1").arg(value); |
57 if (label != "") list << label; | 57 if (label != "") list << label; |
79 class SparseTimeValueModel : public SparseValueModel<TimeValuePoint> | 79 class SparseTimeValueModel : public SparseValueModel<TimeValuePoint> |
80 { | 80 { |
81 Q_OBJECT | 81 Q_OBJECT |
82 | 82 |
83 public: | 83 public: |
84 SparseTimeValueModel(int sampleRate, int resolution, | 84 SparseTimeValueModel(sv_samplerate_t sampleRate, int resolution, |
85 bool notifyOnAdd = true) : | 85 bool notifyOnAdd = true) : |
86 SparseValueModel<TimeValuePoint>(sampleRate, resolution, | 86 SparseValueModel<TimeValuePoint>(sampleRate, resolution, |
87 notifyOnAdd) | 87 notifyOnAdd) |
88 { | 88 { |
89 // Model is playable, but may not sound (if units not Hz or | 89 // Model is playable, but may not sound (if units not Hz or |
90 // range unsuitable) | 90 // range unsuitable) |
91 PlayParameterRepository::getInstance()->addPlayable(this); | 91 PlayParameterRepository::getInstance()->addPlayable(this); |
92 } | 92 } |
93 | 93 |
94 SparseTimeValueModel(int sampleRate, int resolution, | 94 SparseTimeValueModel(sv_samplerate_t sampleRate, int resolution, |
95 float valueMinimum, float valueMaximum, | 95 float valueMinimum, float valueMaximum, |
96 bool notifyOnAdd = true) : | 96 bool notifyOnAdd = true) : |
97 SparseValueModel<TimeValuePoint>(sampleRate, resolution, | 97 SparseValueModel<TimeValuePoint>(sampleRate, resolution, |
98 valueMinimum, valueMaximum, | 98 valueMinimum, valueMaximum, |
99 notifyOnAdd) | 99 notifyOnAdd) |