comparison data/model/RegionModel.h @ 1069:32ab6c48efaa

Merge from branch tonioni
author Chris Cannam
date Mon, 20 Apr 2015 09:11:34 +0100
parents 57633d605547
children 48e9f538e6e9
comparison
equal deleted inserted replaced
1036:682d64f05e72 1069:32ab6c48efaa
35 35
36 struct RegionRec 36 struct RegionRec
37 { 37 {
38 public: 38 public:
39 RegionRec() : frame(0), value(0.f), duration(0) { } 39 RegionRec() : frame(0), value(0.f), duration(0) { }
40 RegionRec(long _frame) : frame(_frame), value(0.0f), duration(0) { } 40 RegionRec(sv_frame_t _frame) : frame(_frame), value(0.0f), duration(0) { }
41 RegionRec(long _frame, float _value, int _duration, QString _label) : 41 RegionRec(sv_frame_t _frame, float _value, sv_frame_t _duration, QString _label) :
42 frame(_frame), value(_value), duration(_duration), label(_label) { } 42 frame(_frame), value(_value), duration(_duration), label(_label) { }
43 43
44 int getDimensions() const { return 3; } 44 int getDimensions() const { return 3; }
45 45
46 long frame; 46 sv_frame_t frame;
47 float value; 47 float value;
48 int duration; 48 sv_frame_t duration;
49 QString label; 49 QString label;
50 50
51 QString getLabel() const { return label; } 51 QString getLabel() const { return label; }
52 52
53 void toXml(QTextStream &stream, 53 void toXml(QTextStream &stream,
58 QString("%1<point frame=\"%2\" value=\"%3\" duration=\"%4\" label=\"%5\" %6/>\n") 58 QString("%1<point frame=\"%2\" value=\"%3\" duration=\"%4\" label=\"%5\" %6/>\n")
59 .arg(indent).arg(frame).arg(value).arg(duration) 59 .arg(indent).arg(frame).arg(value).arg(duration)
60 .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes); 60 .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes);
61 } 61 }
62 62
63 QString toDelimitedDataString(QString delimiter, int sampleRate) const 63 QString toDelimitedDataString(QString delimiter, DataExportOptions, sv_samplerate_t sampleRate) const
64 { 64 {
65 QStringList list; 65 QStringList list;
66 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); 66 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str();
67 list << QString("%1").arg(value); 67 list << QString("%1").arg(value);
68 list << RealTime::frame2RealTime(duration, sampleRate).toString().c_str(); 68 list << RealTime::frame2RealTime(duration, sampleRate).toString().c_str();
92 class RegionModel : public IntervalModel<RegionRec> 92 class RegionModel : public IntervalModel<RegionRec>
93 { 93 {
94 Q_OBJECT 94 Q_OBJECT
95 95
96 public: 96 public:
97 RegionModel(int sampleRate, int resolution, 97 RegionModel(sv_samplerate_t sampleRate, int resolution,
98 bool notifyOnAdd = true) : 98 bool notifyOnAdd = true) :
99 IntervalModel<RegionRec>(sampleRate, resolution, notifyOnAdd), 99 IntervalModel<RegionRec>(sampleRate, resolution, notifyOnAdd),
100 m_valueQuantization(0), 100 m_valueQuantization(0),
101 m_haveDistinctValues(false) 101 m_haveDistinctValues(false)
102 { 102 {
103 } 103 }
104 104
105 RegionModel(int sampleRate, int resolution, 105 RegionModel(sv_samplerate_t sampleRate, int resolution,
106 float valueMinimum, float valueMaximum, 106 float valueMinimum, float valueMaximum,
107 bool notifyOnAdd = true) : 107 bool notifyOnAdd = true) :
108 IntervalModel<RegionRec>(sampleRate, resolution, 108 IntervalModel<RegionRec>(sampleRate, resolution,
109 valueMinimum, valueMaximum, 109 valueMinimum, valueMaximum,
110 notifyOnAdd), 110 notifyOnAdd),