Mercurial > hg > svcore
changeset 1046:2f49be7d4264 cxx11
More type fixes
author | Chris Cannam |
---|---|
date | Tue, 10 Mar 2015 13:22:10 +0000 |
parents | 1a73618b0b67 |
children | 26cf6d5251ec |
files | base/FrameTimer.h data/model/AlignmentModel.cpp data/model/Labeller.h data/model/ModelDataTableModel.cpp data/model/ModelDataTableModel.h |
diffstat | 5 files changed, 21 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/base/FrameTimer.h Tue Mar 10 10:31:27 2015 +0000 +++ b/base/FrameTimer.h Tue Mar 10 13:22:10 2015 +0000 @@ -16,6 +16,8 @@ #ifndef _FRAME_TIMER_H_ #define _FRAME_TIMER_H_ +#include "BaseTypes.h" + /** * A trivial interface for things that permit retrieving "the current * frame". Implementations of this interface are used, for example, @@ -25,7 +27,7 @@ class FrameTimer { public: - virtual int getFrame() const = 0; + virtual sv_frame_t getFrame() const = 0; }; #endif
--- a/data/model/AlignmentModel.cpp Tue Mar 10 10:31:27 2015 +0000 +++ b/data/model/AlignmentModel.cpp Tue Mar 10 13:22:10 2015 +0000 @@ -364,8 +364,8 @@ connect(m_rawPath, SIGNAL(modelChanged()), this, SLOT(pathChanged())); - connect(m_rawPath, SIGNAL(modelChangedWithin(int, int)), - this, SLOT(pathChangedWithin(int, int))); + connect(m_rawPath, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), + this, SLOT(pathChangedWithin(sv_frame_t, sv_frame_t))); connect(m_rawPath, SIGNAL(completionChanged()), this, SLOT(pathCompletionChanged()));
--- a/data/model/Labeller.h Tue Mar 10 10:31:27 2015 +0000 +++ b/data/model/Labeller.h Tue Mar 10 13:22:10 2015 +0000 @@ -132,7 +132,7 @@ if (m_counter > m_cycle) m_counter = 1; } - void setSampleRate(float rate) { m_rate = rate; } + void setSampleRate(sv_samplerate_t rate) { m_rate = rate; } void resetCounters() { m_counter = 1; @@ -262,24 +262,24 @@ case ValueFromSimpleCounter: case ValueFromCyclicalCounter: - value = m_counter; + value = float(m_counter); incrementCounter(); break; case ValueFromTwoLevelCounter: - value = m_counter2 + double(m_counter) / double(m_dp); + value = float(m_counter2 + double(m_counter) / double(m_dp)); incrementCounter(); break; case ValueFromFrameNumber: - value = newPoint.frame; + value = float(newPoint.frame); break; case ValueFromRealTime: - if (m_rate == 0.f) { + if (m_rate == 0.0) { std::cerr << "ERROR: Labeller::getValueFor: Real-time conversion required, but no sample rate set" << std::endl; } else { - value = float(newPoint.frame) / float(m_rate); + value = float(double(newPoint.frame) / m_rate); } break; @@ -287,18 +287,18 @@ case ValueFromTempoToNext: case ValueFromDurationFromPrevious: case ValueFromTempoFromPrevious: - if (m_rate == 0.f) { + if (m_rate == 0.0) { std::cerr << "ERROR: Labeller::getValueFor: Real-time conversion required, but no sample rate set" << std::endl; } else if (!prevPoint) { std::cerr << "ERROR: Labeller::getValueFor: Time difference required, but only one point provided" << std::endl; } else { - int f0 = prevPoint->frame, f1 = newPoint.frame; + sv_frame_t f0 = prevPoint->frame, f1 = newPoint.frame; if (m_type == ValueFromDurationToNext || m_type == ValueFromDurationFromPrevious) { - value = float(f1 - f0) / m_rate; + value = float(double(f1 - f0) / m_rate); } else { if (f1 > f0) { - value = (60.f * m_rate) / (f1 - f0); + value = float((60.0 * m_rate) / double(f1 - f0)); } } } @@ -313,7 +313,7 @@ case ValueFromLabel: if (newPoint.label != "") { // more forgiving than QString::toFloat() - value = atof(newPoint.label.toLocal8Bit()); + value = float(atof(newPoint.label.toLocal8Bit())); } else { value = 0.f; } @@ -328,7 +328,7 @@ int m_counter2; int m_cycle; int m_dp; - float m_rate; + sv_samplerate_t m_rate; }; #endif
--- a/data/model/ModelDataTableModel.cpp Tue Mar 10 10:31:27 2015 +0000 +++ b/data/model/ModelDataTableModel.cpp Tue Mar 10 13:22:10 2015 +0000 @@ -31,8 +31,8 @@ Model *baseModel = dynamic_cast<Model *>(m); connect(baseModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); - connect(baseModel, SIGNAL(modelChangedWithin(int, int)), - this, SLOT(modelChangedWithin(int, int))); + connect(baseModel, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), + this, SLOT(modelChangedWithin(sv_frame_t, sv_frame_t))); connect(baseModel, SIGNAL(aboutToBeDeleted()), this, SLOT(modelAboutToBeDeleted())); } @@ -219,7 +219,7 @@ } void -ModelDataTableModel::modelChangedWithin(int, int) +ModelDataTableModel::modelChangedWithin(sv_frame_t, sv_frame_t) { //!!! inefficient clearSort();
--- a/data/model/ModelDataTableModel.h Tue Mar 10 10:31:27 2015 +0000 +++ b/data/model/ModelDataTableModel.h Tue Mar 10 13:22:10 2015 +0000 @@ -71,7 +71,7 @@ protected slots: void modelChanged(); - void modelChangedWithin(int, int); + void modelChangedWithin(sv_frame_t, sv_frame_t); void modelAboutToBeDeleted(); protected: