comparison data/model/FlexiNoteModel.h @ 929:59e7fe1b1003 warnfix_no_size_t

Unsigned removals and warning fixes in data/
author Chris Cannam
date Tue, 17 Jun 2014 14:33:42 +0100
parents 49618f39ff09
children 06579b8ffb7b
comparison
equal deleted inserted replaced
928:6a94bb528e9d 929:59e7fe1b1003
41 41
42 struct FlexiNote 42 struct FlexiNote
43 { 43 {
44 public: 44 public:
45 FlexiNote(long _frame) : frame(_frame), value(0.0f), duration(0), level(1.f) { } 45 FlexiNote(long _frame) : frame(_frame), value(0.0f), duration(0), level(1.f) { }
46 FlexiNote(long _frame, float _value, size_t _duration, float _level, QString _label) : 46 FlexiNote(long _frame, float _value, int _duration, float _level, QString _label) :
47 frame(_frame), value(_value), duration(_duration), level(_level), label(_label) { } 47 frame(_frame), value(_value), duration(_duration), level(_level), label(_label) { }
48 48
49 int getDimensions() const { return 3; } 49 int getDimensions() const { return 3; }
50 50
51 long frame; 51 long frame;
52 float value; 52 float value;
53 size_t duration; 53 int duration;
54 float level; 54 float level;
55 QString label; 55 QString label;
56 56
57 QString getLabel() const { return label; } 57 QString getLabel() const { return label; }
58 58
64 QString("%1<point frame=\"%2\" value=\"%3\" duration=\"%4\" level=\"%5\" label=\"%6\" %7/>\n") 64 QString("%1<point frame=\"%2\" value=\"%3\" duration=\"%4\" level=\"%5\" label=\"%6\" %7/>\n")
65 .arg(indent).arg(frame).arg(value).arg(duration).arg(level) 65 .arg(indent).arg(frame).arg(value).arg(duration).arg(level)
66 .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes); 66 .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes);
67 } 67 }
68 68
69 QString toDelimitedDataString(QString delimiter, size_t sampleRate) const 69 QString toDelimitedDataString(QString delimiter, int sampleRate) const
70 { 70 {
71 QStringList list; 71 QStringList list;
72 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); 72 list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str();
73 list << QString("%1").arg(value); 73 list << QString("%1").arg(value);
74 list << RealTime::frame2RealTime(duration, sampleRate).toString().c_str(); 74 list << RealTime::frame2RealTime(duration, sampleRate).toString().c_str();
100 class FlexiNoteModel : public IntervalModel<FlexiNote>, public NoteExportable 100 class FlexiNoteModel : public IntervalModel<FlexiNote>, public NoteExportable
101 { 101 {
102 Q_OBJECT 102 Q_OBJECT
103 103
104 public: 104 public:
105 FlexiNoteModel(size_t sampleRate, size_t resolution, 105 FlexiNoteModel(int sampleRate, int resolution,
106 bool notifyOnAdd = true) : 106 bool notifyOnAdd = true) :
107 IntervalModel<FlexiNote>(sampleRate, resolution, notifyOnAdd), 107 IntervalModel<FlexiNote>(sampleRate, resolution, notifyOnAdd),
108 m_valueQuantization(0) 108 m_valueQuantization(0)
109 { 109 {
110 PlayParameterRepository::getInstance()->addPlayable(this); 110 PlayParameterRepository::getInstance()->addPlayable(this);
111 } 111 }
112 112
113 FlexiNoteModel(size_t sampleRate, size_t resolution, 113 FlexiNoteModel(int sampleRate, int resolution,
114 float valueMinimum, float valueMaximum, 114 float valueMinimum, float valueMaximum,
115 bool notifyOnAdd = true) : 115 bool notifyOnAdd = true) :
116 IntervalModel<FlexiNote>(sampleRate, resolution, 116 IntervalModel<FlexiNote>(sampleRate, resolution,
117 valueMinimum, valueMaximum, 117 valueMinimum, valueMaximum,
118 notifyOnAdd), 118 notifyOnAdd),
229 NoteList getNotes() const 229 NoteList getNotes() const
230 { 230 {
231 return getNotes(getStartFrame(), getEndFrame()); 231 return getNotes(getStartFrame(), getEndFrame());
232 } 232 }
233 233
234 NoteList getNotes(size_t startFrame, size_t endFrame) const 234 NoteList getNotes(int startFrame, int endFrame) const
235 { 235 {
236 PointList points = getPoints(startFrame, endFrame); 236 PointList points = getPoints(startFrame, endFrame);
237 NoteList notes; 237 NoteList notes;
238 for (PointList::iterator pli = points.begin(); pli != points.end(); ++pli) { 238 for (PointList::iterator pli = points.begin(); pli != points.end(); ++pli) {
239 size_t duration = pli->duration; 239 int duration = pli->duration;
240 if (duration == 0 || duration == 1) { 240 if (duration == 0 || duration == 1) {
241 duration = getSampleRate() / 20; 241 duration = getSampleRate() / 20;
242 } 242 }
243 int pitch = lrintf(pli->value); 243 int pitch = lrintf(pli->value);
244 244