# HG changeset patch # User Chris Cannam # Date 1425496292 0 # Node ID a1226b3b7925221db44ed6bfea32cf3d9d05b03a # Parent 0fe1f4407261e6cd4741bb104be48cf6bb0e782f Toward building with new sv types diff -r 0fe1f4407261 -r a1226b3b7925 configure --- a/configure Wed Mar 04 13:53:05 2015 +0000 +++ b/configure Wed Mar 04 19:11:32 2015 +0000 @@ -4343,9 +4343,10 @@ CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" if test "x$GCC" = "xyes"; then - CXXFLAGS_DEBUG="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe" - CXXFLAGS_RELEASE="-std=c++11 -g0 -O2 -Wall -pipe" - CXXFLAGS_MINIMAL="-std=c++11 -g0 -O0" + CXXFLAGS_ANY="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" + CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g" + CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O2" + CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" fi CXXFLAGS_BUILD="$CXXFLAGS_RELEASE" diff -r 0fe1f4407261 -r a1226b3b7925 configure.ac --- a/configure.ac Wed Mar 04 13:53:05 2015 +0000 +++ b/configure.ac Wed Mar 04 19:11:32 2015 +0000 @@ -53,9 +53,10 @@ CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" if test "x$GCC" = "xyes"; then - CXXFLAGS_DEBUG="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe" - CXXFLAGS_RELEASE="-std=c++11 -g0 -O2 -Wall -pipe" - CXXFLAGS_MINIMAL="-std=c++11 -g0 -O0" + CXXFLAGS_ANY="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" + CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g" + CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O2" + CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" fi CXXFLAGS_BUILD="$CXXFLAGS_RELEASE" diff -r 0fe1f4407261 -r a1226b3b7925 layer/Colour3DPlotLayer.cpp --- a/layer/Colour3DPlotLayer.cpp Wed Mar 04 13:53:05 2015 +0000 +++ b/layer/Colour3DPlotLayer.cpp Wed Mar 04 19:11:32 2015 +0000 @@ -234,11 +234,11 @@ *min = -50; *max = 50; - *deflt = lrintf(log10(1.f) * 20.0);; + *deflt = int(lrint(log10(1.0) * 20.0)); if (*deflt < *min) *deflt = *min; if (*deflt > *max) *deflt = *max; - val = lrintf(log10(m_gain) * 20.0); + val = int(lrint(log10(m_gain) * 20.0)); if (val < *min) val = *min; if (val > *max) val = *max; @@ -336,7 +336,7 @@ Colour3DPlotLayer::setProperty(const PropertyName &name, int value) { if (name == "Gain") { - setGain(pow(10, float(value)/20.0)); + setGain(float(pow(10, value/20.0))); } else if (name == "Colour Scale") { switch (value) { default: @@ -547,7 +547,7 @@ if (!m_model) return false; min = 0; - max = m_model->getHeight(); + max = float(m_model->getHeight()); logarithmic = false; unit = ""; @@ -560,14 +560,16 @@ { if (!m_model) return false; - min = m_miny; - max = m_maxy; + float hmax = float(m_model->getHeight()); + + min = float(m_miny); + max = float(m_maxy); if (max <= min) { min = 0; - max = m_model->getHeight(); + max = hmax; } if (min < 0) min = 0; - if (max > m_model->getHeight()) max = m_model->getHeight(); + if (max > hmax) max = hmax; return true; } @@ -577,8 +579,8 @@ { if (!m_model) return false; - m_miny = lrintf(min); - m_maxy = lrintf(max); + m_miny = int(lrintf(min)); + m_maxy = int(lrintf(max)); emit layerParametersChanged(); return true; @@ -608,7 +610,7 @@ float min, max; getDisplayExtents(min, max); - return m_model->getHeight() - lrintf(max - min); + return m_model->getHeight() - int(lrintf(max - min)); } void @@ -620,8 +622,8 @@ int dist = m_model->getHeight() - step; if (dist < 1) dist = 1; - float centre = m_miny + (float(m_maxy) - float(m_miny)) / 2.f; - m_miny = lrintf(centre - float(dist)/2); + float centre = float(m_miny) + (float(m_maxy) - float(m_miny)) / 2.f; + m_miny = int(lrintf(centre - float(dist)/2)); if (m_miny < 0) m_miny = 0; m_maxy = m_miny + dist; if (m_maxy > m_model->getHeight()) m_maxy = m_model->getHeight(); @@ -645,9 +647,9 @@ { float y = bin; if (!m_model) return y; - float mn = 0, mx = m_model->getHeight(); + float mn = 0, mx = float(m_model->getHeight()); getDisplayExtents(mn, mx); - float h = v->height(); + float h = float(v->height()); if (m_binScale == LinearBinScale) { y = h - (((bin - mn) * h) / (mx - mn)); } else { @@ -663,9 +665,9 @@ { float bin = y; if (!m_model) return bin; - float mn = 0, mx = m_model->getHeight(); + float mn = 0, mx = float(m_model->getHeight()); getDisplayExtents(mn, mx); - float h = v->height(); + float h = float(v->height()); if (m_binScale == LinearBinScale) { bin = mn + ((h - y) * (mx - mn)) / h; } else { @@ -684,14 +686,14 @@ int x = pos.x(); int y = pos.y(); - int modelStart = m_model->getStartFrame(); + sv_frame_t modelStart = m_model->getStartFrame(); int modelResolution = m_model->getResolution(); - float srRatio = - float(v->getViewManager()->getMainModelSampleRate()) / - float(m_model->getSampleRate()); + double srRatio = + v->getViewManager()->getMainModelSampleRate() / + m_model->getSampleRate(); - int sx0 = int((v->getFrameForX(x) / srRatio - modelStart) / + int sx0 = int((double(v->getFrameForX(x)) / srRatio - double(modelStart)) / modelResolution); int f0 = sx0 * modelResolution; @@ -711,7 +713,7 @@ // float binHeight = float(v->height()) / (symax - symin); // int sy = int((v->height() - y) / binHeight) + symin; - int sy = getBinForY(v, y); + int sy = int(getBinForY(v, float(y))); if (sy < 0 || sy >= m_model->getHeight()) { return ""; @@ -801,14 +803,14 @@ } } - if (max == min) max = min + 1.0; - if (mmax == mmin) mmax = mmin + 1.0; + if (max == min) max = min + 1.f; + if (mmax == mmin) mmax = mmin + 1.f; paint.setPen(v->getForeground()); paint.drawRect(4, 10, cw - 8, ch+1); for (int y = 0; y < ch; ++y) { - float value = ((max - min) * (ch - y - 1)) / ch + min; + float value = ((max - min) * (float(ch-y) - 1.f)) / float(ch) + min; if (m_colourScale == LogScale) { value = LogRange::map(value); } @@ -870,7 +872,7 @@ int y0; - y0 = lrintf(getYForBin(v, i)); + y0 = int(lrint(getYForBin(v, float(i)))); int h = py - y0; if (i > symin) { @@ -940,7 +942,7 @@ } if (m_normalizeHybrid && (colMax > 0.0)) { - float logmax = log10(colMax); + float logmax = log10f(colMax); for (int y = 0; y < values.size(); ++y) { values[y] *= logmax; } @@ -954,12 +956,12 @@ { Profiler profiler("Colour3DPlotLayer::fillCache", true); - int modelStart = m_model->getStartFrame(); - int modelEnd = m_model->getEndFrame(); + sv_frame_t modelStart = m_model->getStartFrame(); + sv_frame_t modelEnd = m_model->getEndFrame(); int modelResolution = m_model->getResolution(); - int modelStartBin = modelStart / modelResolution; - int modelEndBin = modelEnd / modelResolution; + int modelStartBin = int(modelStart / modelResolution); + int modelEndBin = int(modelEnd / modelResolution); #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT cerr << "Colour3DPlotLayer::fillCache: range " << firstBin << " -> " << lastBin << " of model range " << modelStartBin << " -> " << modelEndBin << " (model resolution " << modelResolution << ")" << endl; @@ -1088,7 +1090,7 @@ } } - if (max == min) max = min + 1.0; + if (max == min) max = min + 1.f; ColourMapper mapper(m_colourMap, 0.f, 255.f); @@ -1235,9 +1237,8 @@ if (!m_model || !v || !(v->getViewManager())) { return false; } - float srRatio = - float(v->getViewManager()->getMainModelSampleRate()) / - float(m_model->getSampleRate()); + double srRatio = + v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate(); if (m_opaque || m_smooth || m_model->getHeight() >= v->height() || @@ -1271,8 +1272,8 @@ if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->rect(); - int modelStart = m_model->getStartFrame(); - int modelEnd = m_model->getEndFrame(); + sv_frame_t modelStart = m_model->getStartFrame(); + sv_frame_t modelEnd = m_model->getEndFrame(); int modelResolution = m_model->getResolution(); // The cache is from the model's start frame to the model's end @@ -1289,13 +1290,12 @@ int h = v->height(); - float srRatio = - float(v->getViewManager()->getMainModelSampleRate()) / - float(m_model->getSampleRate()); + double srRatio = + v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate(); - int sx0 = int((v->getFrameForX(x0) / srRatio - modelStart) + int sx0 = int((double(v->getFrameForX(x0)) / srRatio - double(modelStart)) / modelResolution); - int sx1 = int((v->getFrameForX(x1) / srRatio - modelStart) + int sx1 = int((double(v->getFrameForX(x1)) / srRatio - double(modelStart)) / modelResolution); int sh = m_model->getHeight(); @@ -1337,12 +1337,12 @@ for (int sx = sx0; sx <= sx1; ++sx) { - int fx = sx * modelResolution; + sv_frame_t fx = sx * modelResolution; if (fx + modelResolution <= modelStart || fx > modelEnd) continue; - int rx0 = v->getXForFrame(int((fx + modelStart) * srRatio)); - int rx1 = v->getXForFrame(int((fx + modelStart + modelResolution + 1) * srRatio)); + int rx0 = v->getXForFrame(int(double(fx + modelStart) * srRatio)); + int rx1 = v->getXForFrame(int(double(fx + modelStart + modelResolution + 1) * srRatio)); int rw = rx1 - rx0; if (rw < 1) rw = 1; diff -r 0fe1f4407261 -r a1226b3b7925 layer/ColourMapper.cpp --- a/layer/ColourMapper.cpp Wed Mar 04 13:53:05 2015 +0000 +++ b/layer/ColourMapper.cpp Wed Mar 04 19:11:32 2015 +0000 @@ -21,7 +21,7 @@ #include "base/Debug.h" -ColourMapper::ColourMapper(int map, float min, float max) : +ColourMapper::ColourMapper(int map, double min, double max) : QObject(), m_map(map), m_min(min), @@ -69,17 +69,17 @@ } QColor -ColourMapper::map(float value) const +ColourMapper::map(double value) const { - float norm = (value - m_min) / (m_max - m_min); - if (norm < 0.f) norm = 0.f; - if (norm > 1.f) norm = 1.f; + double norm = (value - m_min) / (m_max - m_min); + if (norm < 0.0) norm = 0.0; + if (norm > 1.0) norm = 1.0; - float h = 0.f, s = 0.f, v = 0.f, r = 0.f, g = 0.f, b = 0.f; + double h = 0.0, s = 0.0, v = 0.0, r = 0.0, g = 0.0, b = 0.0; bool hsv = true; -// float red = 0.f, green = 0.3333f; - float blue = 0.6666f, pieslice = 0.3333f; +// double red = 0.0, green = 0.3333; + double blue = 0.6666f, pieslice = 0.3333; if (m_map >= getColourMapCount()) return Qt::black; StandardMap map = (StandardMap)m_map; @@ -87,8 +87,8 @@ switch (map) { case DefaultColours: - h = blue - norm * 2.f * pieslice; - s = 0.5f + norm/2.f; + h = blue - norm * 2.0 * pieslice; + s = 0.5f + norm/2.0; v = norm; break; @@ -98,53 +98,53 @@ break; case BlackOnWhite: - r = g = b = 1.f - norm; + r = g = b = 1.0 - norm; hsv = false; break; case RedOnBlue: - h = blue - pieslice/4.f + norm * (pieslice + pieslice/4.f); - s = 1.f; + h = blue - pieslice/4.0 + norm * (pieslice + pieslice/4.0); + s = 1.0; v = norm; break; case YellowOnBlack: - h = 0.15f; - s = 1.f; + h = 0.15; + s = 1.0; v = norm; break; case BlueOnBlack: h = blue; - s = 1.f; - v = norm * 2.f; - if (v > 1.f) { - v = 1.f; - s = 1.f - (sqrtf(norm) - 0.707f) * 3.413f; - if (s < 0.f) s = 0.f; - if (s > 1.f) s = 1.f; + s = 1.0; + v = norm * 2.0; + if (v > 1.0) { + v = 1.0; + s = 1.0 - (sqrtf(norm) - 0.707) * 3.413; + if (s < 0.0) s = 0.0; + if (s > 1.0) s = 1.0; } break; case Sunset: - r = (norm - 0.24f) * 2.38f; - if (r > 1.f) r = 1.f; - if (r < 0.f) r = 0.f; - g = (norm - 0.64f) * 2.777f; - if (g > 1.f) g = 1.f; - if (g < 0.f) g = 0.f; + r = (norm - 0.24) * 2.38; + if (r > 1.0) r = 1.0; + if (r < 0.0) r = 0.0; + g = (norm - 0.64) * 2.777; + if (g > 1.0) g = 1.0; + if (g < 0.0) g = 0.0; b = (3.6f * norm); - if (norm > 0.277f) b = 2.f - b; - if (b > 1.f) b = 1.f; - if (b < 0.f) b = 0.f; + if (norm > 0.277) b = 2.0 - b; + if (b > 1.0) b = 1.0; + if (b < 0.0) b = 0.0; hsv = false; break; case FruitSalad: - h = blue + (pieslice/6.f) - norm; - if (h < 0.f) h += 1.f; - s = 1.f; - v = 1.f; + h = blue + (pieslice/6.0) - norm; + if (h < 0.0) h += 1.0; + s = 1.0; + v = 1.0; break; case Banded: @@ -164,47 +164,47 @@ case Printer: if (norm > 0.8) { - r = 1.f; + r = 1.0; } else if (norm > 0.7) { - r = 0.9f; + r = 0.9; } else if (norm > 0.6) { - r = 0.8f; + r = 0.8; } else if (norm > 0.5) { - r = 0.7f; + r = 0.7; } else if (norm > 0.4) { - r = 0.6f; + r = 0.6; } else if (norm > 0.3) { - r = 0.5f; + r = 0.5; } else if (norm > 0.2) { - r = 0.4f; + r = 0.4; } else { - r = 0.f; + r = 0.0; } - r = g = b = 1.f - r; + r = g = b = 1.0 - r; hsv = false; break; case HighGain: - if (norm <= 1.f / 256.f) { - norm = 0.f; + if (norm <= 1.0 / 256.0) { + norm = 0.0; } else { - norm = 0.1f + (powf(((norm - 0.5f) * 2.f), 3.f) + 1.f) / 2.081f; + norm = 0.1f + (powf(((norm - 0.5) * 2.0), 3.0) + 1.0) / 2.081; } // now as for Sunset - r = (norm - 0.24f) * 2.38f; - if (r > 1.f) r = 1.f; - if (r < 0.f) r = 0.f; - g = (norm - 0.64f) * 2.777f; - if (g > 1.f) g = 1.f; - if (g < 0.f) g = 0.f; + r = (norm - 0.24) * 2.38; + if (r > 1.0) r = 1.0; + if (r < 0.0) r = 0.0; + g = (norm - 0.64) * 2.777; + if (g > 1.0) g = 1.0; + if (g < 0.0) g = 0.0; b = (3.6f * norm); - if (norm > 0.277f) b = 2.f - b; - if (b > 1.f) b = 1.f; - if (b < 0.f) b = 0.f; + if (norm > 0.277) b = 2.0 - b; + if (b > 1.0) b = 1.0; + if (b < 0.0) b = 0.0; hsv = false; /* - if (r > 1.f) r = 1.f; - r = g = b = 1.f - r; + if (r > 1.0) r = 1.0; + r = g = b = 1.0 - r; hsv = false; */ break; diff -r 0fe1f4407261 -r a1226b3b7925 layer/ColourMapper.h --- a/layer/ColourMapper.h Wed Mar 04 13:53:05 2015 +0000 +++ b/layer/ColourMapper.h Wed Mar 04 19:11:32 2015 +0000 @@ -29,7 +29,7 @@ Q_OBJECT public: - ColourMapper(int map, float minValue, float maxValue); + ColourMapper(int map, double minValue, double maxValue); virtual ~ColourMapper(); enum StandardMap { @@ -48,21 +48,21 @@ }; int getMap() const { return m_map; } - float getMinValue() const { return m_min; } - float getMaxValue() const { return m_max; } + double getMinValue() const { return m_min; } + double getMaxValue() const { return m_max; } static int getColourMapCount(); static QString getColourMapName(int n); - QColor map(float value) const; + QColor map(double value) const; QColor getContrastingColour() const; // for cursors etc bool hasLightBackground() const; protected: int m_map; - float m_min; - float m_max; + double m_min; + double m_max; }; #endif diff -r 0fe1f4407261 -r a1226b3b7925 view/View.h --- a/view/View.h Wed Mar 04 13:53:05 2015 +0000 +++ b/view/View.h Wed Mar 04 19:11:32 2015 +0000 @@ -23,6 +23,7 @@ #include "base/PropertyContainer.h" #include "ViewManager.h" #include "base/XmlExportable.h" +#include "base/BaseTypes.h" // #define DEBUG_VIEW_WIDGET_PAINT 1 @@ -64,13 +65,13 @@ * This is a calculated value based on the centre-frame, widget * width and zoom level. The result may be negative. */ - int getStartFrame() const; + sv_frame_t getStartFrame() const; /** * Set the widget pan based on the given first visible frame. The * frame value may be negative. */ - void setStartFrame(int); + void setStartFrame(sv_frame_t); /** * Return the centre frame of the visible widget. This is an @@ -78,30 +79,30 @@ * frame values (start, end) are calculated from this based on the * zoom and other factors. */ - int getCentreFrame() const { return m_centreFrame; } + sv_frame_t getCentreFrame() const { return m_centreFrame; } /** * Set the centre frame of the visible widget. */ - void setCentreFrame(int f) { setCentreFrame(f, true); } + void setCentreFrame(sv_frame_t f) { setCentreFrame(f, true); } /** * Retrieve the last visible sample frame on the widget. * This is a calculated value based on the centre-frame, widget * width and zoom level. */ - int getEndFrame() const; + sv_frame_t getEndFrame() const; /** * Return the pixel x-coordinate corresponding to a given sample * frame (which may be negative). */ - int getXForFrame(int frame) const; + int getXForFrame(sv_frame_t frame) const; /** * Return the closest frame to the given pixel x-coordinate. */ - int getFrameForX(int x) const; + sv_frame_t getFrameForX(int x) const; /** * Return the pixel y-coordinate corresponding to a given @@ -163,7 +164,7 @@ * Return the number of layers, regardless of whether visible or * dormant, i.e. invisible, in this view. */ - virtual int getLayerCount() const { return m_layerStack.size(); } + virtual int getLayerCount() const { return int(m_layerStack.size()); } /** * Return the nth layer, counted in stacking order. That is, @@ -172,7 +173,7 @@ * dormant, i.e. invisible. */ virtual Layer *getLayer(int n) { - if (n < int(m_layerStack.size())) return m_layerStack[n]; + if (in_range_for(m_layerStack, n)) return m_layerStack[n]; else return 0; } @@ -308,20 +309,20 @@ QString extraAttributes = "") const; // First frame actually in model, to right of scale, if present - virtual int getFirstVisibleFrame() const; - virtual int getLastVisibleFrame() const; + virtual sv_frame_t getFirstVisibleFrame() const; + virtual sv_frame_t getLastVisibleFrame() const; - int getModelsStartFrame() const; - int getModelsEndFrame() const; + sv_frame_t getModelsStartFrame() const; + sv_frame_t getModelsEndFrame() const; typedef std::set ModelSet; ModelSet getModels(); //!!! Model *getAligningModel() const; - int alignFromReference(int) const; - int alignToReference(int) const; - int getAlignedPlaybackFrame() const; + sv_frame_t alignFromReference(sv_frame_t) const; + sv_frame_t alignToReference(sv_frame_t) const; + sv_frame_t getAlignedPlaybackFrame() const; signals: void propertyContainerAdded(PropertyContainer *pc); @@ -334,7 +335,7 @@ void layerModelChanged(); - void centreFrameChanged(int frame, + void centreFrameChanged(sv_frame_t frame, bool globalScroll, PlaybackFollowMode followMode); @@ -344,7 +345,7 @@ public slots: virtual void modelChanged(); - virtual void modelChangedWithin(int startFrame, int endFrame); + virtual void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); virtual void modelCompletionChanged(); virtual void modelAlignmentCompletionChanged(); virtual void modelReplaced(); @@ -353,9 +354,9 @@ virtual void layerMeasurementRectsChanged(); virtual void layerNameChanged(); - virtual void globalCentreFrameChanged(int); - virtual void viewCentreFrameChanged(View *, int); - virtual void viewManagerPlaybackFrameChanged(int); + virtual void globalCentreFrameChanged(sv_frame_t); + virtual void viewCentreFrameChanged(View *, sv_frame_t); + virtual void viewManagerPlaybackFrameChanged(sv_frame_t); virtual void viewZoomLevelChanged(View *, int, bool); virtual void propertyContainerSelected(View *, PropertyContainer *pc); @@ -398,25 +399,25 @@ // false. bool hasTopLayerTimeXAxis() const; - bool setCentreFrame(int f, bool doEmit); + bool setCentreFrame(sv_frame_t f, bool doEmit); - void movePlayPointer(int f); + void movePlayPointer(sv_frame_t f); void checkProgress(void *object); int getProgressBarWidth() const; // if visible - int m_centreFrame; + sv_frame_t m_centreFrame; int m_zoomLevel; bool m_followPan; bool m_followZoom; PlaybackFollowMode m_followPlay; bool m_followPlayIsDetached; - int m_playPointerFrame; + sv_frame_t m_playPointerFrame; bool m_lightBackground; bool m_showProgress; QPixmap *m_cache; - int m_cacheCentreFrame; + sv_frame_t m_cacheCentreFrame; int m_cacheZoomLevel; bool m_selectionCached; diff -r 0fe1f4407261 -r a1226b3b7925 view/ViewManager.cpp --- a/view/ViewManager.cpp Wed Mar 04 13:53:05 2015 +0000 +++ b/view/ViewManager.cpp Wed Mar 04 19:11:32 2015 +0000 @@ -126,7 +126,7 @@ { } -int +sv_frame_t ViewManager::getGlobalCentreFrame() const { #ifdef DEBUG_VIEW_MANAGER @@ -136,7 +136,7 @@ } void -ViewManager::setGlobalCentreFrame(int f) +ViewManager::setGlobalCentreFrame(sv_frame_t f) { #ifdef DEBUG_VIEW_MANAGER cerr << "ViewManager::setGlobalCentreFrame to " << f << endl; @@ -154,7 +154,7 @@ return m_globalZoom; } -int +sv_frame_t ViewManager::getPlaybackFrame() const { if (m_playSource && m_playSource->isPlaying()) { @@ -164,7 +164,7 @@ } void -ViewManager::setPlaybackFrame(int f) +ViewManager::setPlaybackFrame(sv_frame_t f) { if (m_playbackFrame != f) { m_playbackFrame = f; @@ -187,8 +187,8 @@ m_playbackModel = model; } -int -ViewManager::alignPlaybackFrameToReference(int frame) const +sv_frame_t +ViewManager::alignPlaybackFrameToReference(sv_frame_t frame) const { #ifdef DEBUG_VIEW_MANAGER cerr << "ViewManager::alignPlaybackFrameToReference(" << frame << "): playback model is " << m_playbackModel << endl; @@ -196,7 +196,7 @@ if (!m_playbackModel) { return frame; } else { - int f = m_playbackModel->alignToReference(frame); + sv_frame_t f = m_playbackModel->alignToReference(frame); #ifdef DEBUG_VIEW_MANAGER cerr << "aligned frame = " << f << endl; #endif @@ -204,8 +204,8 @@ } } -int -ViewManager::alignReferenceToPlaybackFrame(int frame) const +sv_frame_t +ViewManager::alignReferenceToPlaybackFrame(sv_frame_t frame) const { #ifdef DEBUG_VIEW_MANAGER cerr << "ViewManager::alignReferenceToPlaybackFrame(" << frame << "): playback model is " << m_playbackModel << endl; @@ -213,7 +213,7 @@ if (!m_playbackModel) { return frame; } else { - int f = m_playbackModel->alignFromReference(frame); + sv_frame_t f = m_playbackModel->alignFromReference(frame); #ifdef DEBUG_VIEW_MANAGER cerr << "aligned frame = " << f << endl; #endif @@ -313,8 +313,8 @@ } } -int -ViewManager::constrainFrameToSelection(int frame) const +sv_frame_t +ViewManager::constrainFrameToSelection(sv_frame_t frame) const { MultiSelection::SelectionList sl = getSelections(); if (sl.empty()) return frame; @@ -373,7 +373,7 @@ } Selection -ViewManager::getContainingSelection(int frame, bool defaultToFollowing) const +ViewManager::getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const { return m_selections.getContainingSelection(frame, defaultToFollowing); } @@ -478,7 +478,7 @@ } } -int +sv_samplerate_t ViewManager::getPlaybackSampleRate() const { if (m_playSource) { @@ -487,7 +487,7 @@ return 0; } -int +sv_samplerate_t ViewManager::getOutputSampleRate() const { if (m_playSource) { @@ -559,7 +559,7 @@ } void -ViewManager::viewCentreFrameChanged(int f, bool locked, +ViewManager::viewCentreFrameChanged(sv_frame_t f, bool locked, PlaybackFollowMode mode) { View *v = dynamic_cast(sender()); @@ -590,15 +590,15 @@ } void -ViewManager::seek(int f) +ViewManager::seek(sv_frame_t f) { #ifdef DEBUG_VIEW_MANAGER cerr << "ViewManager::seek(" << f << ")" << endl; #endif if (m_playSource && m_playSource->isPlaying()) { - int playFrame = m_playSource->getCurrentPlayingFrame(); - int diff = std::max(f, playFrame) - std::min(f, playFrame); + sv_frame_t playFrame = m_playSource->getCurrentPlayingFrame(); + sv_frame_t diff = std::max(f, playFrame) - std::min(f, playFrame); if (diff > 20000) { m_playbackFrame = f; m_playSource->play(f); diff -r 0fe1f4407261 -r a1226b3b7925 view/ViewManager.h --- a/view/ViewManager.h Wed Mar 04 13:53:05 2015 +0000 +++ b/view/ViewManager.h Wed Mar 04 19:11:32 2015 +0000 @@ -26,6 +26,7 @@ #include "base/Selection.h" #include "base/Command.h" #include "base/Clipboard.h" +#include "base/BaseTypes.h" class AudioPlaySource; class Model; @@ -82,17 +83,17 @@ bool isPlaying() const; - int getGlobalCentreFrame() const; // the set method is a slot + sv_frame_t getGlobalCentreFrame() const; // the set method is a slot int getGlobalZoom() const; - int getPlaybackFrame() const; // the set method is a slot + sv_frame_t getPlaybackFrame() const; // the set method is a slot // Only meaningful in solo mode, and used for optional alignment feature Model *getPlaybackModel() const; void setPlaybackModel(Model *); - int alignPlaybackFrameToReference(int) const; - int alignReferenceToPlaybackFrame(int) const; + sv_frame_t alignPlaybackFrameToReference(sv_frame_t) const; + sv_frame_t alignReferenceToPlaybackFrame(sv_frame_t) const; bool haveInProgressSelection() const; const Selection &getInProgressSelection(bool &exclusive) const; @@ -106,7 +107,7 @@ void addSelection(const Selection &selection); void removeSelection(const Selection &selection); void clearSelections(); - int constrainFrameToSelection(int frame) const; + sv_frame_t constrainFrameToSelection(sv_frame_t frame) const; /** * Adding a selection normally emits the selectionChangedByUser @@ -121,7 +122,7 @@ * selected area, return the next selection after the given frame. * Return the empty selection if no appropriate selection is found. */ - Selection getContainingSelection(int frame, bool defaultToFollowing) const; + Selection getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const; Clipboard &getClipboard() { return m_clipboard; } @@ -166,23 +167,23 @@ * differ from this will play back at the wrong speed -- there is * no per-model resampler. */ - int getPlaybackSampleRate() const; + sv_samplerate_t getPlaybackSampleRate() const; /** * The sample rate of the audio output device. If the playback * sample rate differs from this, everything will be resampled at * the output stage. */ - int getOutputSampleRate() const; + sv_samplerate_t getOutputSampleRate() const; /** * The sample rate of the current main model. This may in theory * differ from the playback sample rate, in which case even the * main model will play at the wrong speed. */ - int getMainModelSampleRate() const { return m_mainModelSampleRate; } + sv_samplerate_t getMainModelSampleRate() const { return m_mainModelSampleRate; } - void setMainModelSampleRate(int sr) { m_mainModelSampleRate = sr; } + void setMainModelSampleRate(sv_samplerate_t sr) { m_mainModelSampleRate = sr; } /** * Take a "design pixel" size and scale it for the actual @@ -242,16 +243,16 @@ signals: /** Emitted when user causes the global centre frame to change. */ - void globalCentreFrameChanged(int frame); + void globalCentreFrameChanged(sv_frame_t frame); /** Emitted when user scrolls a view, but doesn't affect global centre. */ - void viewCentreFrameChanged(View *v, int frame); + void viewCentreFrameChanged(View *v, sv_frame_t frame); /** Emitted when a view zooms. */ void viewZoomLevelChanged(View *v, int zoom, bool locked); /** Emitted when the playback frame changes. */ - void playbackFrameChanged(int frame); + void playbackFrameChanged(sv_frame_t frame); /** Emitted when the output levels change. Values in range 0.0 -> 1.0. */ void outputLevelsChanged(float left, float right); @@ -299,24 +300,24 @@ void activity(QString); public slots: - void viewCentreFrameChanged(int, bool, PlaybackFollowMode); + void viewCentreFrameChanged(sv_frame_t, bool, PlaybackFollowMode); void viewZoomLevelChanged(int, bool); - void setGlobalCentreFrame(int); - void setPlaybackFrame(int); + void setGlobalCentreFrame(sv_frame_t); + void setPlaybackFrame(sv_frame_t); void playStatusChanged(bool playing); protected slots: void checkPlayStatus(); - void seek(int); + void seek(sv_frame_t); //!!! void considerZoomChange(void *, int, bool); protected: AudioPlaySource *m_playSource; - int m_globalCentreFrame; + sv_frame_t m_globalCentreFrame; int m_globalZoom; - mutable int m_playbackFrame; + mutable sv_frame_t m_playbackFrame; Model *m_playbackModel; //!!! - int m_mainModelSampleRate; + sv_samplerate_t m_mainModelSampleRate; float m_lastLeft; float m_lastRight;