Mercurial > hg > svcore
diff data/model/NoteModel.h @ 1038:cc27f35aa75c cxx11
Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author | Chris Cannam |
---|---|
date | Tue, 03 Mar 2015 15:18:24 +0000 |
parents | 59e7fe1b1003 |
children | a1cd5abcb38b |
line wrap: on
line diff
--- a/data/model/NoteModel.h Tue Mar 03 09:33:59 2015 +0000 +++ b/data/model/NoteModel.h Tue Mar 03 15:18:24 2015 +0000 @@ -38,15 +38,15 @@ struct Note { public: - Note(long _frame) : frame(_frame), value(0.0f), duration(0), level(1.f) { } - Note(long _frame, float _value, int _duration, float _level, QString _label) : + Note(sv_frame_t _frame) : frame(_frame), value(0.0f), duration(0), level(1.f) { } + Note(sv_frame_t _frame, float _value, sv_frame_t _duration, float _level, QString _label) : frame(_frame), value(_value), duration(_duration), level(_level), label(_label) { } int getDimensions() const { return 3; } - long frame; + sv_frame_t frame; float value; - int duration; + sv_frame_t duration; float level; QString label; @@ -202,7 +202,7 @@ command->deletePoint(point); switch (column) { - case 4: point.level = value.toDouble(); break; + case 4: point.level = float(value.toDouble()); break; case 5: point.label = value.toString(); break; } @@ -224,7 +224,7 @@ return getNotesWithin(getStartFrame(), getEndFrame()); } - NoteList getNotesWithin(int startFrame, int endFrame) const { + NoteList getNotesWithin(sv_frame_t startFrame, sv_frame_t endFrame) const { PointList points = getPoints(startFrame, endFrame); NoteList notes; @@ -232,16 +232,16 @@ for (PointList::iterator pli = points.begin(); pli != points.end(); ++pli) { - int duration = pli->duration; + sv_frame_t duration = pli->duration; if (duration == 0 || duration == 1) { duration = getSampleRate() / 20; } - int pitch = lrintf(pli->value); + int pitch = int(lrintf(pli->value)); int velocity = 100; if (pli->level > 0.f && pli->level <= 1.f) { - velocity = lrintf(pli->level * 127); + velocity = int(lrintf(pli->level * 127)); } NoteData note(pli->frame, duration, pitch, velocity);