Mercurial > hg > svcore
comparison data/model/PathModel.h @ 1069:32ab6c48efaa
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:11:34 +0100 |
parents | 57633d605547 |
children | c01cbe41aeb5 |
comparison
equal
deleted
inserted
replaced
1036:682d64f05e72 | 1069:32ab6c48efaa |
---|---|
17 #define _PATH_MODEL_H_ | 17 #define _PATH_MODEL_H_ |
18 | 18 |
19 #include "Model.h" | 19 #include "Model.h" |
20 #include "SparseModel.h" | 20 #include "SparseModel.h" |
21 #include "base/RealTime.h" | 21 #include "base/RealTime.h" |
22 #include "base/BaseTypes.h" | |
22 | 23 |
23 #include <QStringList> | 24 #include <QStringList> |
24 | 25 |
25 | 26 |
26 struct PathPoint | 27 struct PathPoint |
27 { | 28 { |
28 PathPoint(long _frame) : frame(_frame), mapframe(_frame) { } | 29 PathPoint(sv_frame_t _frame) : frame(_frame), mapframe(_frame) { } |
29 PathPoint(long _frame, long _mapframe) : | 30 PathPoint(sv_frame_t _frame, sv_frame_t _mapframe) : |
30 frame(_frame), mapframe(_mapframe) { } | 31 frame(_frame), mapframe(_mapframe) { } |
31 | 32 |
32 int getDimensions() const { return 2; } | 33 int getDimensions() const { return 2; } |
33 | 34 |
34 long frame; | 35 sv_frame_t frame; |
35 long mapframe; | 36 sv_frame_t mapframe; |
36 | 37 |
37 QString getLabel() const { return ""; } | 38 QString getLabel() const { return ""; } |
38 | 39 |
39 void toXml(QTextStream &stream, QString indent = "", | 40 void toXml(QTextStream &stream, QString indent = "", |
40 QString extraAttributes = "") const { | 41 QString extraAttributes = "") const { |
41 stream << QString("%1<point frame=\"%2\" mapframe=\"%3\" %4/>\n") | 42 stream << QString("%1<point frame=\"%2\" mapframe=\"%3\" %4/>\n") |
42 .arg(indent).arg(frame).arg(mapframe).arg(extraAttributes); | 43 .arg(indent).arg(frame).arg(mapframe).arg(extraAttributes); |
43 } | 44 } |
44 | 45 |
45 QString toDelimitedDataString(QString delimiter, | 46 QString toDelimitedDataString(QString delimiter, DataExportOptions, |
46 int sampleRate) const { | 47 sv_samplerate_t sampleRate) const { |
47 QStringList list; | 48 QStringList list; |
48 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); | 49 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); |
49 list << QString("%1").arg(mapframe); | 50 list << QString("%1").arg(mapframe); |
50 return list.join(delimiter); | 51 return list.join(delimiter); |
51 } | 52 } |
65 }; | 66 }; |
66 | 67 |
67 class PathModel : public SparseModel<PathPoint> | 68 class PathModel : public SparseModel<PathPoint> |
68 { | 69 { |
69 public: | 70 public: |
70 PathModel(int sampleRate, int resolution, bool notify = true) : | 71 PathModel(sv_samplerate_t sampleRate, int resolution, bool notify = true) : |
71 SparseModel<PathPoint>(sampleRate, resolution, notify) { } | 72 SparseModel<PathPoint>(sampleRate, resolution, notify) { } |
72 | 73 |
73 virtual void toXml(QTextStream &out, | 74 virtual void toXml(QTextStream &out, |
74 QString indent = "", | 75 QString indent = "", |
75 QString extraAttributes = "") const | 76 QString extraAttributes = "") const |