# HG changeset patch # User Chris Cannam # Date 1403014686 -3600 # Node ID 1d526ba11a24ba436811133eadd99bcd7c0331da # Parent ddae586bc47bbe718d625109065b06d11d23db8a Remove size_t's and fix warnings in layer/ diff -r ddae586bc47b -r 1d526ba11a24 layer/Colour3DPlotLayer.cpp --- a/layer/Colour3DPlotLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/Colour3DPlotLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -41,7 +41,6 @@ m_model(0), m_cache(0), m_peaksCache(0), - m_peakResolution(256), m_cacheValidStart(0), m_cacheValidEnd(0), m_colourScale(LinearScale), @@ -55,6 +54,7 @@ m_invertVertical(false), m_opaque(false), m_smooth(false), + m_peakResolution(256), m_miny(0), m_maxy(0) { @@ -78,8 +78,8 @@ connectSignals(m_model); connect(m_model, SIGNAL(modelChanged()), this, SLOT(modelChanged())); - connect(m_model, SIGNAL(modelChanged(size_t, size_t)), - this, SLOT(modelChanged(size_t, size_t))); + connect(m_model, SIGNAL(modelChanged(int, int)), + this, SLOT(modelChanged(int, int))); m_peakResolution = 256; if (model->getResolution() > 512) { @@ -107,13 +107,13 @@ } void -Colour3DPlotLayer::cacheInvalid(size_t startFrame, size_t endFrame) +Colour3DPlotLayer::cacheInvalid(int startFrame, int endFrame) { if (!m_cache) return; - size_t modelResolution = m_model->getResolution(); - size_t start = startFrame / modelResolution; - size_t end = endFrame / modelResolution + 1; + int modelResolution = m_model->getResolution(); + int start = startFrame / modelResolution; + int end = endFrame / modelResolution + 1; if (m_cacheValidStart < end) m_cacheValidStart = end; if (m_cacheValidEnd > start) m_cacheValidEnd = start; if (m_cacheValidStart > m_cacheValidEnd) m_cacheValidEnd = m_cacheValidStart; @@ -135,7 +135,7 @@ } void -Colour3DPlotLayer::modelChanged(size_t startFrame, size_t endFrame) +Colour3DPlotLayer::modelChanged(int startFrame, int endFrame) { if (!m_colourScaleSet && m_colourScale == LinearScale) { if (m_model && m_model->getWidth() > 50) { @@ -580,8 +580,8 @@ } bool -Colour3DPlotLayer::getYScaleValue(const View *v, int y, - float &value, QString &unit) const +Colour3DPlotLayer::getYScaleValue(const View *, int, + float &, QString &) const { return false;//!!! } @@ -679,8 +679,8 @@ int x = pos.x(); int y = pos.y(); - size_t modelStart = m_model->getStartFrame(); - size_t modelResolution = m_model->getResolution(); + int modelStart = m_model->getStartFrame(); + int modelResolution = m_model->getResolution(); float srRatio = float(v->getViewManager()->getMainModelSampleRate()) / @@ -745,7 +745,7 @@ int tw = paint.fontMetrics().width(sampleText); bool another = false; - for (size_t i = 0; i < m_model->getHeight(); ++i) { + for (int i = 0; i < m_model->getHeight(); ++i) { if (m_model->getBinName(i).length() > sampleText.length()) { sampleText = m_model->getBinName(i); another = true; @@ -857,7 +857,7 @@ int py = h; - for (size_t i = symin; i <= symax; ++i) { + for (int i = symin; i <= symax; ++i) { int y0; @@ -884,7 +884,7 @@ if (i > symin) { - size_t idx = i - 1; + int idx = i - 1; if (m_invertVertical) idx = m_model->getHeight() - idx - 1; QString text = m_model->getBinName(idx); @@ -901,7 +901,7 @@ } DenseThreeDimensionalModel::Column -Colour3DPlotLayer::getColumn(size_t col) const +Colour3DPlotLayer::getColumn(int col) const { DenseThreeDimensionalModel::Column values = m_model->getColumn(col); while (values.size() < m_model->getHeight()) values.push_back(0.f); @@ -913,13 +913,13 @@ min = m_model->getMinimumLevel(); max = m_model->getMaximumLevel(); - for (size_t y = 0; y < values.size(); ++y) { + for (int y = 0; y < values.size(); ++y) { if (y == 0 || values.at(y) > colMax) colMax = values.at(y); if (y == 0 || values.at(y) < colMin) colMin = values.at(y); } if (colMin == colMax) colMax = colMin + 1; - for (size_t y = 0; y < values.size(); ++y) { + for (int y = 0; y < values.size(); ++y) { float value = values.at(y); float norm = (value - colMin) / (colMax - colMin); @@ -930,7 +930,7 @@ if (m_normalizeHybrid && (colMax > 0.0)) { float logmax = log10(colMax); - for (size_t y = 0; y < values.size(); ++y) { + for (int y = 0; y < values.size(); ++y) { values[y] *= logmax; } } @@ -939,24 +939,24 @@ } void -Colour3DPlotLayer::fillCache(size_t firstBin, size_t lastBin) const +Colour3DPlotLayer::fillCache(int firstBin, int lastBin) const { Profiler profiler("Colour3DPlotLayer::fillCache"); - size_t modelStart = m_model->getStartFrame(); - size_t modelEnd = m_model->getEndFrame(); - size_t modelResolution = m_model->getResolution(); + int modelStart = m_model->getStartFrame(); + int modelEnd = m_model->getEndFrame(); + int modelResolution = m_model->getResolution(); #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT SVDEBUG << "Colour3DPlotLayer::fillCache: " << firstBin << " -> " << lastBin << endl; #endif - size_t modelStartBin = modelStart / modelResolution; - size_t modelEndBin = modelEnd / modelResolution; + int modelStartBin = modelStart / modelResolution; + int modelEndBin = modelEnd / modelResolution; - size_t cacheWidth = modelEndBin - modelStartBin + 1; + int cacheWidth = modelEndBin - modelStartBin + 1; if (lastBin > modelEndBin) cacheWidth = lastBin - modelStartBin + 1; - size_t cacheHeight = m_model->getHeight(); + int cacheHeight = m_model->getHeight(); if (m_cache && (m_cache->height() != int(cacheHeight))) { // height has changed: delete everything rather than resizing @@ -1010,8 +1010,8 @@ return; } - size_t fillStart = firstBin; - size_t fillEnd = lastBin; + int fillStart = firstBin; + int fillEnd = lastBin; if (fillStart < modelStartBin) fillStart = modelStartBin; if (fillStart > modelEndBin) fillStart = modelEndBin; @@ -1083,13 +1083,13 @@ if (normalizeVisible) { - for (size_t c = fillStart; c <= fillEnd; ++c) { + for (int c = fillStart; c <= fillEnd; ++c) { values = getColumn(c); float colMax = 0.f, colMin = 0.f; - for (size_t y = 0; y < cacheHeight; ++y) { + for (int y = 0; y < cacheHeight; ++y) { if (y >= values.size()) break; if (y == 0 || values[y] > colMax) colMax = values[y]; if (y == 0 || values[y] < colMin) colMin = values[y]; @@ -1125,7 +1125,7 @@ } } - for (size_t c = fillStart; c <= fillEnd; ++c) { + for (int c = fillStart; c <= fillEnd; ++c) { values = getColumn(c); @@ -1135,7 +1135,7 @@ continue; } - for (size_t y = 0; y < cacheHeight; ++y) { + for (int y = 0; y < cacheHeight; ++y) { float value = min; if (y < values.size()) { @@ -1172,16 +1172,16 @@ } if (peaks) { - size_t notch = (c % m_peakResolution); + int notch = (c % m_peakResolution); if (notch == m_peakResolution-1 || c == fillEnd) { - size_t pc = c / m_peakResolution; + int pc = c / m_peakResolution; if (pc >= m_peaksCache->width()) { cerr << "ERROR: peak column " << pc << " (from col " << c << ") >= peaks cache width " << m_peaksCache->width() << endl; continue; } - for (size_t y = 0; y < cacheHeight; ++y) { + for (int y = 0; y < cacheHeight; ++y) { if (m_invertVertical) { m_peaksCache->setPixel(pc, cacheHeight - y - 1, peaks[y]); } else { @@ -1228,9 +1228,9 @@ if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->rect(); - size_t modelStart = m_model->getStartFrame(); - size_t modelEnd = m_model->getEndFrame(); - size_t modelResolution = m_model->getResolution(); + int modelStart = m_model->getStartFrame(); + int modelEnd = m_model->getEndFrame(); + int modelResolution = m_model->getResolution(); // The cache is from the model's start frame to the model's end // frame at the model's window increment frames per pixel. We @@ -1585,7 +1585,7 @@ bool Colour3DPlotLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { diff -r ddae586bc47b -r 1d526ba11a24 layer/Colour3DPlotLayer.h --- a/layer/Colour3DPlotLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/Colour3DPlotLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -57,7 +57,7 @@ virtual QString getFeatureDescription(View *v, QPoint &) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void setLayerDormant(const View *v, bool dormant); @@ -166,17 +166,17 @@ protected slots: void cacheInvalid(); - void cacheInvalid(size_t startFrame, size_t endFrame); + void cacheInvalid(int startFrame, int endFrame); void modelChanged(); - void modelChanged(size_t, size_t); + void modelChanged(int, int); protected: const DenseThreeDimensionalModel *m_model; // I do not own this mutable QImage *m_cache; mutable QImage *m_peaksCache; - mutable size_t m_cacheValidStart; - mutable size_t m_cacheValidEnd; + mutable int m_cacheValidStart; + mutable int m_cacheValidEnd; ColourScale m_colourScale; bool m_colourScaleSet; @@ -189,7 +189,7 @@ bool m_invertVertical; bool m_opaque; bool m_smooth; - size_t m_peakResolution; + int m_peakResolution; // Minimum and maximum bin numbers visible within the view. We // always snap to whole bins at view edges. @@ -212,10 +212,10 @@ */ float getBinForY(View *, float y) const; - DenseThreeDimensionalModel::Column getColumn(size_t col) const; + DenseThreeDimensionalModel::Column getColumn(int col) const; int getColourScaleWidth(QPainter &) const; - void fillCache(size_t firstBin, size_t lastBin) const; + void fillCache(int firstBin, int lastBin) const; void paintDense(View *v, QPainter &paint, QRect rect) const; }; diff -r ddae586bc47b -r 1d526ba11a24 layer/ColourMapper.cpp --- a/layer/ColourMapper.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/ColourMapper.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -278,6 +278,16 @@ case HighGain: return true; + case DefaultColours: + case Sunset: + case WhiteOnBlack: + case RedOnBlue: + case YellowOnBlack: + case BlueOnBlack: + case FruitSalad: + case Banded: + case Highlight: + default: return false; } diff -r ddae586bc47b -r 1d526ba11a24 layer/FlexiNoteLayer.cpp --- a/layer/FlexiNoteLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/FlexiNoteLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -61,14 +61,14 @@ m_model(0), m_editing(false), + m_intelligentActions(true), m_originalPoint(0, 0.0, 0, 1.f, tr("New Point")), m_editingPoint(0, 0.0, 0, 1.f, tr("New Point")), m_editingCommand(0), m_verticalScale(AutoAlignScale), m_editMode(DragNote), m_scaleMinimum(34), - m_scaleMaximum(77), - m_intelligentActions(true) + m_scaleMaximum(77) { } @@ -421,11 +421,11 @@ if (prevPoints.empty()) { usePoints = nextPoints; - } else if (long(prevPoints.begin()->frame) < v->getStartFrame() && + } else if (prevPoints.begin()->frame < v->getStartFrame() && !(nextPoints.begin()->frame > v->getEndFrame())) { usePoints = nextPoints; - } else if (long(nextPoints.begin()->frame) - frame < - frame - long(prevPoints.begin()->frame)) { + } else if (nextPoints.begin()->frame - frame < + frame - prevPoints.begin()->frame) { usePoints = nextPoints; } @@ -588,7 +588,7 @@ bool FlexiNoteLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -818,12 +818,12 @@ QPoint localPos; FlexiNoteModel::Point illuminatePoint(0); - bool shouldIlluminate = false; +// bool shouldIlluminate = false; - if (v->shouldIlluminateLocalFeatures(this, localPos)) { - shouldIlluminate = getPointToDrag(v, localPos.x(), localPos.y(), - illuminatePoint); - } +// if (v->shouldIlluminateLocalFeatures(this, localPos)) { +// shouldIlluminate = getPointToDrag(v, localPos.x(), localPos.y(), +// illuminatePoint); +// } paint.save(); paint.setRenderHint(QPainter::Antialiasing, false); @@ -1007,7 +1007,7 @@ } void -FlexiNoteLayer::eraseDrag(View *v, QMouseEvent *e) +FlexiNoteLayer::eraseDrag(View *, QMouseEvent *) { } @@ -1140,6 +1140,8 @@ m_editingPoint.value = value; break; } + case SplitNote: // nothing + break; } updateNoteValue(v, m_editingPoint); m_editingCommand->addPoint(m_editingPoint); @@ -1148,7 +1150,7 @@ } void -FlexiNoteLayer::editEnd(View *v, QMouseEvent *e) +FlexiNoteLayer::editEnd(View *, QMouseEvent *e) { // SVDEBUG << "FlexiNoteLayer::editEnd(" << e->x() << "," << e->y() << ")" << endl; std::cerr << "FlexiNoteLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl; @@ -1435,7 +1437,7 @@ if (pitchValues.empty()) return false; sort(pitchValues.begin(), pitchValues.end()); - size_t size = pitchValues.size(); + int size = pitchValues.size(); double median; if (size % 2 == 0) { @@ -1550,7 +1552,7 @@ } void -FlexiNoteLayer::moveSelection(Selection s, size_t newStartFrame) +FlexiNoteLayer::moveSelection(Selection s, int newStartFrame) { if (!m_model) return; @@ -1654,7 +1656,7 @@ } bool -FlexiNoteLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */) +FlexiNoteLayer::paste(View *v, const Clipboard &from, int /*frameOffset */, bool /* interactive */) { if (!m_model) return false; @@ -1686,7 +1688,7 @@ i != points.end(); ++i) { if (!i->haveFrame()) continue; - size_t frame = 0; + int frame = 0; if (!realign) { @@ -1711,7 +1713,7 @@ if (i->haveLevel()) newPoint.level = i->getLevel(); if (i->haveDuration()) newPoint.duration = i->getDuration(); else { - size_t nextFrame = frame; + int nextFrame = frame; Clipboard::PointList::const_iterator j = i; for (; j != points.end(); ++j) { if (!j->haveFrame()) continue; @@ -1790,13 +1792,14 @@ { SingleColourLayer::setProperties(attributes); - bool ok, alsoOk; + bool ok; VerticalScale scale = (VerticalScale) attributes.value("verticalScale").toInt(&ok); if (ok) setVerticalScale(scale); - float min = attributes.value("scaleMinimum").toFloat(&ok); - float max = attributes.value("scaleMaximum").toFloat(&alsoOk); +// bool alsoOk; +// float min = attributes.value("scaleMinimum").toFloat(&ok); +// float max = attributes.value("scaleMaximum").toFloat(&alsoOk); // if (ok && alsoOk && min != max) setDisplayExtents(min, max); } diff -r ddae586bc47b -r 1d526ba11a24 layer/FlexiNoteLayer.h --- a/layer/FlexiNoteLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/FlexiNoteLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -46,7 +46,7 @@ virtual QString getFeatureDescription(View *v, QPoint &) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void drawStart(View *v, QMouseEvent *); @@ -70,7 +70,7 @@ virtual bool editOpen(View *v, QMouseEvent *); - virtual void moveSelection(Selection s, size_t newStartFrame); + virtual void moveSelection(Selection s, int newStartFrame); virtual void resizeSelection(Selection s, Selection newSize); virtual void deleteSelection(Selection s); diff -r ddae586bc47b -r 1d526ba11a24 layer/ImageLayer.cpp --- a/layer/ImageLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/ImageLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -78,7 +78,7 @@ } QString -ImageLayer::getPropertyLabel(const PropertyName &name) const +ImageLayer::getPropertyLabel(const PropertyName &) const { return ""; } @@ -116,14 +116,14 @@ } bool -ImageLayer::isLayerScrollable(const View *v) const +ImageLayer::isLayerScrollable(const View *) const { return true; } ImageModel::PointList -ImageLayer::getLocalPoints(View *v, int x, int y) const +ImageLayer::getLocalPoints(View *v, int x, int ) const { if (!m_model) return ImageModel::PointList(); @@ -185,9 +185,9 @@ } } - long useFrame = points.begin()->frame; +// long useFrame = points.begin()->frame; - RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate()); +// RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate()); QString text; /* @@ -209,7 +209,7 @@ bool ImageLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -519,8 +519,6 @@ QImage ImageLayer::getImage(View *v, QString name, QSize maxSize) const { - bool need = false; - // SVDEBUG << "ImageLayer::getImage(" << v << ", " << name << ", (" // << maxSize.width() << "x" << maxSize.height() << "))" << endl; @@ -596,13 +594,11 @@ } void -ImageLayer::drawEnd(View *v, QMouseEvent *) +ImageLayer::drawEnd(View *, QMouseEvent *) { // SVDEBUG << "ImageLayer::drawEnd(" << e->x() << "," << e->y() << ")" << endl; if (!m_model || !m_editing) return; - bool ok = false; - ImageDialog dialog(tr("Select image"), "", ""); if (dialog.exec() == QDialog::Accepted) { @@ -727,7 +723,7 @@ } void -ImageLayer::moveSelection(Selection s, size_t newStartFrame) +ImageLayer::moveSelection(Selection s, int newStartFrame) { if (!m_model) return; @@ -823,7 +819,7 @@ } bool -ImageLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */) +ImageLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */) { if (!m_model) return false; @@ -856,7 +852,7 @@ if (!i->haveFrame()) continue; - size_t frame = 0; + int frame = 0; if (!realign) { @@ -970,7 +966,7 @@ } void -ImageLayer::setProperties(const QXmlAttributes &attributes) +ImageLayer::setProperties(const QXmlAttributes &) { } diff -r ddae586bc47b -r 1d526ba11a24 layer/ImageLayer.h --- a/layer/ImageLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/ImageLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -43,7 +43,7 @@ virtual QString getFeatureDescription(View *v, QPoint &) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void drawStart(View *v, QMouseEvent *); @@ -54,7 +54,7 @@ virtual void editDrag(View *v, QMouseEvent *); virtual void editEnd(View *v, QMouseEvent *); - virtual void moveSelection(Selection s, size_t newStartFrame); + virtual void moveSelection(Selection s, int newStartFrame); virtual void resizeSelection(Selection s, Selection newSize); virtual void deleteSelection(Selection s); diff -r ddae586bc47b -r 1d526ba11a24 layer/Layer.cpp --- a/layer/Layer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/Layer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -51,8 +51,8 @@ connect(model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged())); - connect(model, SIGNAL(modelChanged(size_t, size_t)), - this, SIGNAL(modelChanged(size_t, size_t))); + connect(model, SIGNAL(modelChanged(int, int)), + this, SIGNAL(modelChanged(int, int))); connect(model, SIGNAL(completionChanged()), this, SIGNAL(modelCompletionChanged())); @@ -165,8 +165,8 @@ return true; } -size_t -Layer::alignToReference(View *v, size_t frame) const +int +Layer::alignToReference(View *v, int frame) const { const Model *m = getModel(); SVDEBUG << "Layer::alignToReference(" << frame << "): model = " << m << ", alignment reference = " << (m ? m->getAlignmentReference() : 0) << endl; @@ -177,8 +177,8 @@ } } -size_t -Layer::alignFromReference(View *v, size_t frame) const +int +Layer::alignFromReference(View *v, int frame) const { const Model *m = getModel(); SVDEBUG << "Layer::alignFromReference(" << frame << "): model = " << m << ", alignment reference = " << (m ? m->getAlignmentReference() : 0) << endl; @@ -405,7 +405,7 @@ } void -Layer::measureDoubleClick(View *v, QMouseEvent *e) +Layer::measureDoubleClick(View *, QMouseEvent *) { // nothing, in the base class } diff -r ddae586bc47b -r 1d526ba11a24 layer/Layer.h --- a/layer/Layer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/Layer.h Tue Jun 17 15:18:06 2014 +0100 @@ -150,7 +150,7 @@ return ""; } - virtual QString getLabelPreceding(size_t /* frame */) const { + virtual QString getLabelPreceding(int /* frame */) const { return ""; } @@ -182,7 +182,7 @@ */ virtual bool snapToFeatureFrame(View * /* v */, int & /* frame */, - size_t &resolution, + int &resolution, SnapType /* snap */) const { resolution = 1; return false; @@ -206,7 +206,7 @@ */ virtual bool snapToSimilarFeature(View * /* v */, int & /* source frame */, - size_t &resolution, + int &resolution, SnapType /* snap */) const { resolution = 1; return false; @@ -254,7 +254,7 @@ */ virtual bool editOpen(View *, QMouseEvent *) { return false; } - virtual void moveSelection(Selection, size_t /* newStartFrame */) { } + virtual void moveSelection(Selection, int /* newStartFrame */) { } virtual void resizeSelection(Selection, Selection /* newSize */) { } virtual void deleteSelection(Selection) { } @@ -525,7 +525,7 @@ void modelChanged(); void modelCompletionChanged(); void modelAlignmentCompletionChanged(); - void modelChanged(size_t startFrame, size_t endFrame); + void modelChanged(int startFrame, int endFrame); void modelReplaced(); void layerParametersChanged(); @@ -538,8 +538,8 @@ protected: void connectSignals(const Model *); - virtual size_t alignToReference(View *v, size_t frame) const; - virtual size_t alignFromReference(View *v, size_t frame) const; + virtual int alignToReference(View *v, int frame) const; + virtual int alignFromReference(View *v, int frame) const; bool clipboardHasDifferentAlignment(View *v, const Clipboard &clip) const; struct MeasureRect { diff -r ddae586bc47b -r 1d526ba11a24 layer/LayerFactory.cpp --- a/layer/LayerFactory.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/LayerFactory.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -93,10 +93,11 @@ // likewise return Layer::tr("Spectrogram"); - default: break; + case UnknownLayer: + default: + cerr << "WARNING: LayerFactory::getLayerPresentationName passed unknown layer" << endl; + return Layer::tr("Unknown Layer"); } - - return Layer::tr("Layer"); } bool @@ -244,7 +245,10 @@ case Slice: return "spectrum"; case MelodicRangeSpectrogram: return "spectrogram"; case PeakFrequencySpectrogram: return "spectrogram"; - default: return "unknown"; + case UnknownLayer: + default: + cerr << "WARNING: LayerFactory::getLayerIconName passed unknown layer" << endl; + return "unknown"; } } @@ -267,7 +271,10 @@ case Slice: return "slice"; case MelodicRangeSpectrogram: return "melodicrange"; case PeakFrequencySpectrogram: return "peakfrequency"; - default: return "unknown"; + case UnknownLayer: + default: + cerr << "WARNING: LayerFactory::getLayerTypeName passed unknown layer" << endl; + return "unknown"; } } @@ -460,11 +467,14 @@ layer = new SpectrogramLayer(SpectrogramLayer::MelodicPeaks); break; - default: break; + case UnknownLayer: + default: + cerr << "WARNING: LayerFactory::createLayer passed unknown layer" << endl; + break; } if (!layer) { - SVDEBUG << "LayerFactory::createLayer: Unknown layer type " + cerr << "LayerFactory::createLayer: Unknown layer type " << type << endl; } else { // SVDEBUG << "LayerFactory::createLayer: Setting object name " @@ -499,7 +509,7 @@ QDomElement layerElt = docNew.firstChildElement("layer"); QDomNamedNodeMap attrNodes = layerElt.attributes(); - for (unsigned int i = 0; i < attrNodes.length(); ++i) { + for (int i = 0; i < attrNodes.length(); ++i) { QDomAttr attr = attrNodes.item(i).toAttr(); if (attr.isNull()) continue; // cerr << "append \"" << attr.name() @@ -510,7 +520,7 @@ layerElt = docOld.firstChildElement("layer"); attrNodes = layerElt.attributes(); - for (unsigned int i = 0; i < attrNodes.length(); ++i) { + for (int i = 0; i < attrNodes.length(); ++i) { QDomAttr attr = attrNodes.item(i).toAttr(); if (attr.isNull()) continue; if (attrs.value(attr.name()) == "") { diff -r ddae586bc47b -r 1d526ba11a24 layer/LinearColourScale.cpp --- a/layer/LinearColourScale.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/LinearColourScale.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -23,7 +23,7 @@ #include "view/View.h" int -LinearColourScale::getWidth(View *v, +LinearColourScale::getWidth(View *, QPainter &paint) { return paint.fontMetrics().width("-000.00") + 15; @@ -33,7 +33,7 @@ LinearColourScale::paintVertical(View *v, const ColourScaleLayer *layer, QPainter &paint, - int x0, + int /* x0 */, float min, float max) { @@ -46,8 +46,6 @@ char buffer[40]; - int w = getWidth(v, paint) + x0; - int boxx = 5, boxy = 5; if (layer->getScaleUnits() != "") { boxy += paint.fontMetrics().height(); @@ -65,16 +63,16 @@ } paint.restore(); - float round = 1.f; +// float round = 1.f; int dp = 0; if (inc > 0) { int prec = trunc(log10f(inc)); prec -= 1; if (prec < 0) dp = -prec; - round = powf(10.f, prec); -#ifdef DEBUG_TIME_VALUE_LAYER - cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl; -#endif +// round = powf(10.f, prec); +//#ifdef DEBUG_TIME_VALUE_LAYER +// cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl; +//#endif } for (int i = 0; i < n; ++i) { diff -r ddae586bc47b -r 1d526ba11a24 layer/LinearNumericalScale.cpp --- a/layer/LinearNumericalScale.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/LinearNumericalScale.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -23,7 +23,7 @@ #include "view/View.h" int -LinearNumericalScale::getWidth(View *v, +LinearNumericalScale::getWidth(View *, QPainter &paint) { return paint.fontMetrics().width("-000.00") + 10; @@ -37,8 +37,6 @@ float minf, float maxf) { - int h = v->height(); - int n = 10; float val = minf; diff -r ddae586bc47b -r 1d526ba11a24 layer/LogColourScale.cpp --- a/layer/LogColourScale.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/LogColourScale.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -25,7 +25,7 @@ #include "view/View.h" int -LogColourScale::getWidth(View *v, +LogColourScale::getWidth(View *, QPainter &paint) { return paint.fontMetrics().width("-000.00") + 15; @@ -35,7 +35,7 @@ LogColourScale::paintVertical(View *v, const ColourScaleLayer *layer, QPainter &paint, - int x0, + int /* x0 */, float minlog, float maxlog) { @@ -48,8 +48,6 @@ char buffer[40]; - int w = getWidth(v, paint) + x0; - int boxx = 5, boxy = 5; if (layer->getScaleUnits() != "") { boxy += paint.fontMetrics().height(); diff -r ddae586bc47b -r 1d526ba11a24 layer/NoteLayer.cpp --- a/layer/NoteLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/NoteLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -544,7 +544,7 @@ bool NoteLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -956,7 +956,7 @@ } void -NoteLayer::eraseDrag(View *v, QMouseEvent *e) +NoteLayer::eraseDrag(View *, QMouseEvent *) { } @@ -1103,7 +1103,7 @@ } void -NoteLayer::moveSelection(Selection s, size_t newStartFrame) +NoteLayer::moveSelection(Selection s, int newStartFrame) { if (!m_model) return; @@ -1207,7 +1207,7 @@ } bool -NoteLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */) +NoteLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */) { if (!m_model) return false; @@ -1239,7 +1239,7 @@ i != points.end(); ++i) { if (!i->haveFrame()) continue; - size_t frame = 0; + int frame = 0; if (!realign) { @@ -1264,7 +1264,7 @@ if (i->haveLevel()) newPoint.level = i->getLevel(); if (i->haveDuration()) newPoint.duration = i->getDuration(); else { - size_t nextFrame = frame; + int nextFrame = frame; Clipboard::PointList::const_iterator j = i; for (; j != points.end(); ++j) { if (!j->haveFrame()) continue; diff -r ddae586bc47b -r 1d526ba11a24 layer/NoteLayer.h --- a/layer/NoteLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/NoteLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -43,7 +43,7 @@ virtual QString getFeatureDescription(View *v, QPoint &) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void drawStart(View *v, QMouseEvent *); @@ -60,7 +60,7 @@ virtual bool editOpen(View *v, QMouseEvent *); - virtual void moveSelection(Selection s, size_t newStartFrame); + virtual void moveSelection(Selection s, int newStartFrame); virtual void resizeSelection(Selection s, Selection newSize); virtual void deleteSelection(Selection s); diff -r ddae586bc47b -r 1d526ba11a24 layer/RegionLayer.cpp --- a/layer/RegionLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/RegionLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -367,7 +367,7 @@ } QString -RegionLayer::getLabelPreceding(size_t frame) const +RegionLayer::getLabelPreceding(int frame) const { if (!m_model) return ""; RegionModel::PointList points = m_model->getPreviousPoints(frame); @@ -450,7 +450,7 @@ bool RegionLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -533,7 +533,7 @@ bool RegionLayer::snapToSimilarFeature(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -901,7 +901,6 @@ //!!! coord is never completely flat on the top or bottom int fontHeight = paint.fontMetrics().height(); - int fontAscent = paint.fontMetrics().ascent(); for (RegionModel::PointList::const_iterator i = points.begin(); i != points.end(); ++i) { @@ -1076,7 +1075,6 @@ bool logarithmic; int w = getVerticalScaleWidth(v, false, paint); - int h = v->height(); if (m_plotStyle == PlotSegmentation) { @@ -1192,7 +1190,7 @@ } void -RegionLayer::eraseDrag(View *v, QMouseEvent *e) +RegionLayer::eraseDrag(View *, QMouseEvent *) { } @@ -1279,7 +1277,7 @@ } void -RegionLayer::editEnd(View *, QMouseEvent *e) +RegionLayer::editEnd(View *, QMouseEvent *) { if (!m_model || !m_editing) return; @@ -1348,7 +1346,7 @@ } void -RegionLayer::moveSelection(Selection s, size_t newStartFrame) +RegionLayer::moveSelection(Selection s, int newStartFrame) { if (!m_model) return; @@ -1455,7 +1453,7 @@ } bool -RegionLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */) +RegionLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */) { if (!m_model) return false; @@ -1487,7 +1485,7 @@ i != points.end(); ++i) { if (!i->haveFrame()) continue; - size_t frame = 0; + int frame = 0; if (!realign) { @@ -1511,7 +1509,7 @@ m_model->getValueMaximum()) / 2; if (i->haveDuration()) newPoint.duration = i->getDuration(); else { - size_t nextFrame = frame; + int nextFrame = frame; Clipboard::PointList::const_iterator j = i; for (; j != points.end(); ++j) { if (!j->haveFrame()) continue; diff -r ddae586bc47b -r 1d526ba11a24 layer/RegionLayer.h --- a/layer/RegionLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/RegionLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -45,13 +45,13 @@ virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; virtual QString getFeatureDescription(View *v, QPoint &) const; - virtual QString getLabelPreceding(size_t) const; + virtual QString getLabelPreceding(int) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual bool snapToSimilarFeature(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void drawStart(View *v, QMouseEvent *); @@ -68,7 +68,7 @@ virtual bool editOpen(View *v, QMouseEvent *); - virtual void moveSelection(Selection s, size_t newStartFrame); + virtual void moveSelection(Selection s, int newStartFrame); virtual void resizeSelection(Selection s, Selection newSize); virtual void deleteSelection(Selection s); diff -r ddae586bc47b -r 1d526ba11a24 layer/SingleColourLayer.cpp --- a/layer/SingleColourLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/SingleColourLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -115,7 +115,7 @@ { if (name == "Colour") { ColourDatabase *db = ColourDatabase::getInstance(); - if (value >= 0 && size_t(value) < db->getColourCount()) { + if (value >= 0 && value < db->getColourCount()) { return db->getColourName(value); } } diff -r ddae586bc47b -r 1d526ba11a24 layer/SliceLayer.cpp --- a/layer/SliceLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/SliceLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -95,13 +95,13 @@ SliceLayer::getFeatureDescription(View *v, QPoint &p) const { int minbin, maxbin, range; - return getFeatureDescription(v, p, true, minbin, maxbin, range); + return getFeatureDescriptionAux(v, p, true, minbin, maxbin, range); } QString -SliceLayer::getFeatureDescription(View *v, QPoint &p, - bool includeBinDescription, - int &minbin, int &maxbin, int &range) const +SliceLayer::getFeatureDescriptionAux(View *v, QPoint &p, + bool includeBinDescription, + int &minbin, int &maxbin, int &range) const { minbin = 0; maxbin = 0; @@ -121,8 +121,8 @@ int sampleRate = m_sliceableModel->getSampleRate(); - size_t f0 = m_currentf0; - size_t f1 = m_currentf1; + int f0 = m_currentf0; + int f1 = m_currentf1; RealTime rt0 = RealTime::frame2RealTime(f0, sampleRate); RealTime rt1 = RealTime::frame2RealTime(f1, sampleRate); @@ -264,6 +264,7 @@ value = fabsf(value); // and fall through + case LinearScale: default: norm = (value - m_threshold); if (norm < 0) norm = 0; @@ -301,7 +302,9 @@ case MeterScale: value = AudioLevel::preview_to_multiplier(lrintf(y), h); break; - + + case LinearScale: + case AbsoluteScale: default: value = y / h + m_threshold; } @@ -322,7 +325,7 @@ if (v->getViewManager() && v->getViewManager()->shouldShowScaleGuides()) { if (!m_scalePoints.empty()) { paint.setPen(QColor(240, 240, 240)); //!!! and dark background? - for (size_t i = 0; i < m_scalePoints.size(); ++i) { + for (int i = 0; i < (int)m_scalePoints.size(); ++i) { paint.drawLine(0, m_scalePoints[i], rect.width(), m_scalePoints[i]); } } @@ -345,26 +348,26 @@ QPainterPath path; - size_t mh = m_sliceableModel->getHeight(); + int mh = m_sliceableModel->getHeight(); int divisor = 0; m_values.clear(); - for (size_t bin = 0; bin < mh; ++bin) { + for (int bin = 0; bin < mh; ++bin) { m_values.push_back(0.f); } - size_t f0 = v->getCentreFrame(); + int f0 = v->getCentreFrame(); int f0x = v->getXForFrame(f0); f0 = v->getFrameForX(f0x); - size_t f1 = v->getFrameForX(f0x + 1); + int f1 = v->getFrameForX(f0x + 1); if (f1 > f0) --f1; // cerr << "centre frame " << v->getCentreFrame() << ", x " << f0x << ", f0 " << f0 << ", f1 " << f1 << endl; - size_t res = m_sliceableModel->getResolution(); - size_t col0 = f0 / res; - size_t col1 = col0; + int res = m_sliceableModel->getResolution(); + int col0 = f0 / res; + int col1 = col0; if (m_samplingMode != NearestSample) col1 = f1 / res; f0 = col0 * res; f1 = (col1 + 1) * res - 1; @@ -376,10 +379,10 @@ BiasCurve curve; getBiasCurve(curve); - size_t cs = curve.size(); + int cs = curve.size(); - for (size_t col = col0; col <= col1; ++col) { - for (size_t bin = 0; bin < mh; ++bin) { + for (int col = col0; col <= col1; ++col) { + for (int bin = 0; bin < mh; ++bin) { float value = m_sliceableModel->getValueAt(col, bin); if (bin < cs) value *= curve[bin]; if (m_samplingMode == SamplePeak) { @@ -392,22 +395,21 @@ } float max = 0.f; - for (size_t bin = 0; bin < mh; ++bin) { + for (int bin = 0; bin < mh; ++bin) { if (m_samplingMode == SampleMean) m_values[bin] /= divisor; if (m_values[bin] > max) max = m_values[bin]; } if (max != 0.f && m_normalize) { - for (size_t bin = 0; bin < mh; ++bin) { + for (int bin = 0; bin < mh; ++bin) { m_values[bin] /= max; } } - float py = 0; float nx = xorigin; ColourMapper mapper(m_colourMap, 0, 1); - for (size_t bin = 0; bin < mh; ++bin) { + for (int bin = 0; bin < mh; ++bin) { float x = nx; nx = xorigin + getXForBin(bin + 1, mh, w); @@ -446,7 +448,6 @@ paint.fillRect(QRectF(x, y, nx - x, yorigin - y), mapper.map(norm)); } - py = y; } if (m_plotStyle != PlotFilledBlocks) { diff -r ddae586bc47b -r 1d526ba11a24 layer/SliceLayer.h --- a/layer/SliceLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/SliceLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -115,10 +115,10 @@ virtual float getYForValue(float value, const View *v, float &norm) const; virtual float getValueForY(float y, const View *v) const; - virtual QString getFeatureDescription(View *v, QPoint &, - bool includeBinDescription, - int &minbin, int &maxbin, - int &range) const; + virtual QString getFeatureDescriptionAux(View *v, QPoint &, + bool includeBinDescription, + int &minbin, int &maxbin, + int &range) const; // This curve may, of course, be flat -- the spectrum uses it for // normalizing the fft results by the fft size (with 1/(fftsize/2) @@ -144,8 +144,8 @@ mutable std::map m_xorigins; mutable std::map m_yorigins; mutable std::map m_heights; - mutable size_t m_currentf0; - mutable size_t m_currentf1; + mutable int m_currentf0; + mutable int m_currentf1; mutable std::vector m_values; }; diff -r ddae586bc47b -r 1d526ba11a24 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/SpectrogramLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -141,8 +141,8 @@ connectSignals(m_model); connect(m_model, SIGNAL(modelChanged()), this, SLOT(cacheInvalid())); - connect(m_model, SIGNAL(modelChanged(size_t, size_t)), - this, SLOT(cacheInvalid(size_t, size_t))); + connect(m_model, SIGNAL(modelChanged(int, int)), + this, SLOT(cacheInvalid(int, int))); emit modelReplaced(); } @@ -572,7 +572,7 @@ } void -SpectrogramLayer::invalidateImageCaches(size_t startFrame, size_t endFrame) +SpectrogramLayer::invalidateImageCaches(int startFrame, int endFrame) { for (ViewImageCache::iterator i = m_imageCaches.begin(); i != m_imageCaches.end(); ++i) { @@ -681,7 +681,7 @@ } void -SpectrogramLayer::setWindowSize(size_t ws) +SpectrogramLayer::setWindowSize(int ws) { if (m_windowSize == ws) return; @@ -695,14 +695,14 @@ emit layerParametersChanged(); } -size_t +int SpectrogramLayer::getWindowSize() const { return m_windowSize; } void -SpectrogramLayer::setWindowHopLevel(size_t v) +SpectrogramLayer::setWindowHopLevel(int v) { if (m_windowHopLevel == v) return; @@ -717,14 +717,14 @@ // fillCache(); } -size_t +int SpectrogramLayer::getWindowHopLevel() const { return m_windowHopLevel; } void -SpectrogramLayer::setZeroPadLevel(size_t v) +SpectrogramLayer::setZeroPadLevel(int v) { if (m_zeroPadLevel == v) return; @@ -738,7 +738,7 @@ emit layerParametersChanged(); } -size_t +int SpectrogramLayer::getZeroPadLevel() const { return m_zeroPadLevel; @@ -804,7 +804,7 @@ } void -SpectrogramLayer::setMinFrequency(size_t mf) +SpectrogramLayer::setMinFrequency(int mf) { if (m_minFrequency == mf) return; @@ -818,14 +818,14 @@ emit layerParametersChanged(); } -size_t +int SpectrogramLayer::getMinFrequency() const { return m_minFrequency; } void -SpectrogramLayer::setMaxFrequency(size_t mf) +SpectrogramLayer::setMaxFrequency(int mf) { if (m_maxFrequency == mf) return; @@ -839,7 +839,7 @@ emit layerParametersChanged(); } -size_t +int SpectrogramLayer::getMaxFrequency() const { return m_maxFrequency; @@ -1049,7 +1049,7 @@ } void -SpectrogramLayer::cacheInvalid(size_t from, size_t to) +SpectrogramLayer::cacheInvalid(int from, int to) { #ifdef DEBUG_SPECTROGRAM_REPAINT SVDEBUG << "SpectrogramLayer::cacheInvalid(" << from << ", " << to << ")" << endl; @@ -1074,11 +1074,11 @@ i != m_fftModels.end(); ++i) { const FFTModel *model = i->second.first; - size_t lastFill = i->second.second; + int lastFill = i->second.second; if (model) { - size_t fill = model->getFillExtent(); + int fill = model->getFillExtent(); #ifdef DEBUG_SPECTROGRAM_REPAINT SVDEBUG << "SpectrogramLayer::fillTimerTimedOut: extent for " << model << ": " << fill << ", last " << lastFill << ", total " << m_model->getEndFrame() << endl; @@ -1270,7 +1270,7 @@ float minf = float(sr) / m_fftSize; if (m_minFrequency > 0.0) { - size_t minbin = size_t((double(m_minFrequency) * m_fftSize) / sr + 0.01); + int minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.01); if (minbin < 1) minbin = 1; minf = minbin * sr / m_fftSize; } @@ -1285,7 +1285,7 @@ float maxf = float(sr) / 2; if (m_maxFrequency > 0.0) { - size_t maxbin = size_t((double(m_maxFrequency) * m_fftSize) / sr + 0.1); + int maxbin = int((double(m_maxFrequency) * m_fftSize) / sr + 0.1); if (maxbin > m_fftSize / 2) maxbin = m_fftSize / 2; maxf = maxbin * sr / m_fftSize; } @@ -1348,8 +1348,8 @@ bool SpectrogramLayer::getXBinRange(View *v, int x, float &s0, float &s1) const { - size_t modelStart = m_model->getStartFrame(); - size_t modelEnd = m_model->getEndFrame(); + int modelStart = m_model->getStartFrame(); + int modelEnd = m_model->getEndFrame(); // Each pixel column covers an exact range of sample frames: int f0 = v->getFrameForX(x) - modelStart; @@ -1362,7 +1362,7 @@ // And that range may be drawn from a possibly non-integral // range of spectrogram windows: - size_t windowIncrement = getWindowIncrement(); + int windowIncrement = getWindowIncrement(); s0 = float(f0) / windowIncrement; s1 = float(f1) / windowIncrement; @@ -1434,9 +1434,6 @@ int sr = m_model->getSampleRate(); - size_t windowSize = m_windowSize; - size_t windowIncrement = getWindowIncrement(); - bool haveAdj = false; bool peaksOnly = (m_binDisplay == PeakBins || @@ -1457,7 +1454,6 @@ if (!fft->isOverThreshold(s, q, m_threshold * (m_fftSize/2))) continue; float freq = binfreq; - bool steady = false; if (s < int(fft->getWidth()) - 1) { @@ -1501,7 +1497,7 @@ bool rv = false; - size_t zp = getZeroPadLevel(v); + int zp = getZeroPadLevel(v); q0i *= zp + 1; q1i *= zp + 1; @@ -1547,7 +1543,7 @@ return rv; } -size_t +int SpectrogramLayer::getZeroPadLevel(const View *v) const { //!!! tidy all this stuff @@ -1564,13 +1560,13 @@ int sr = m_model->getSampleRate(); - size_t maxbin = m_fftSize / 2; + int maxbin = m_fftSize / 2; if (m_maxFrequency > 0) { maxbin = int((double(m_maxFrequency) * m_fftSize) / sr + 0.1); if (maxbin > m_fftSize / 2) maxbin = m_fftSize / 2; } - size_t minbin = 1; + int minbin = 1; if (m_minFrequency > 0) { minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.1); if (minbin < 1) minbin = 1; @@ -1590,7 +1586,7 @@ } } -size_t +int SpectrogramLayer::getFFTSize(const View *v) const { return m_fftSize * (getZeroPadLevel(v) + 1); @@ -1601,7 +1597,7 @@ { if (!m_model) return 0; - size_t fftSize = getFFTSize(v); + int fftSize = getFFTSize(v); if (m_fftModels.find(v) != m_fftModels.end()) { if (m_fftModels[v].first == 0) { @@ -1803,7 +1799,7 @@ //!!! no longer use cache-fill thread const_cast(this)->Layer::setLayerDormant(v, false); - size_t fftSize = getFFTSize(v); + int fftSize = getFFTSize(v); /* FFTModel *fft = getFFTModel(v); if (!fft) { @@ -2123,13 +2119,13 @@ // Note fftSize is the actual zero-padded fft size, m_fftSize the // nominal fft size. - size_t maxbin = m_fftSize / 2; + int maxbin = m_fftSize / 2; if (m_maxFrequency > 0) { maxbin = int((double(m_maxFrequency) * m_fftSize) / sr + 0.001); if (maxbin > m_fftSize / 2) maxbin = m_fftSize / 2; } - size_t minbin = 1; + int minbin = 1; if (m_minFrequency > 0) { minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.001); // cerr << "m_minFrequency = " << m_minFrequency << " -> minbin = " << minbin << endl; @@ -2160,7 +2156,7 @@ /* float yforbin[maxbin - minbin + 1]; - for (size_t q = minbin; q <= maxbin; ++q) { + for (int q = minbin; q <= maxbin; ++q) { float f0 = (float(q) * sr) / fftSize; yforbin[q - minbin] = v->getYForFrequency(f0, displayMinFreq, displayMaxFreq, @@ -2170,20 +2166,16 @@ MagnitudeRange overallMag = m_viewMags[v]; bool overallMagChanged = false; - bool fftSuspended = false; - #ifdef DEBUG_SPECTROGRAM_REPAINT cerr << ((float(v->getFrameForX(1) - v->getFrameForX(0))) / increment) << " bin(s) per pixel" << endl; #endif - bool runOutOfData = false; - if (w == 0) { SVDEBUG << "*** NOTE: w == 0" << endl; } #ifdef DEBUG_SPECTROGRAM_REPAINT - size_t pixels = 0; + int pixels = 0; #endif Profiler outerprof("SpectrogramLayer::paint: all cols"); @@ -2499,8 +2491,6 @@ if (binforx[x] < 0) continue; - float columnMax = 0.f; - int sx0 = binforx[x]; int sx1 = sx0; if (x+1 < w) sx1 = binforx[x+1]; @@ -2894,7 +2884,7 @@ if (m_updateTimer == 0) return 100; if (m_fftModels.find(v) == m_fftModels.end()) return 100; - size_t completion = m_fftModels[v].first->getCompletion(); + int completion = m_fftModels[v].first->getCompletion(); #ifdef DEBUG_SPECTROGRAM_REPAINT SVDEBUG << "SpectrogramLayer::getCompletion: completion = " << completion << endl; #endif @@ -2943,8 +2933,8 @@ if (min < 0) min = 0; if (max > m_model->getSampleRate()/2) max = m_model->getSampleRate()/2; - size_t minf = lrintf(min); - size_t maxf = lrintf(max); + int minf = lrintf(min); + int maxf = lrintf(max); if (m_minFrequency == minf && m_maxFrequency == maxf) return true; @@ -2976,7 +2966,7 @@ bool SpectrogramLayer::snapToFeatureFrame(View *, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { resolution = getWindowIncrement(); @@ -3292,7 +3282,7 @@ int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4); int pkw = (m_frequencyScale == LogFrequencyScale ? 10 : 0); - size_t bins = m_fftSize / 2; + int bins = m_fftSize / 2; int sr = m_model->getSampleRate(); if (m_maxFrequency > 0) { @@ -3508,7 +3498,7 @@ int maxStep = mapper.getPositionForValue(0); int minStep = mapper.getPositionForValue(float(sr) / 2); - size_t initialMax = m_initialMaxFrequency; + int initialMax = m_initialMaxFrequency; if (initialMax == 0) initialMax = sr / 2; defaultStep = mapper.getPositionForValue(initialMax) - minStep; @@ -3684,13 +3674,13 @@ int channel = attributes.value("channel").toInt(&ok); if (ok) setChannel(channel); - size_t windowSize = attributes.value("windowSize").toUInt(&ok); + int windowSize = attributes.value("windowSize").toUInt(&ok); if (ok) setWindowSize(windowSize); - size_t windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok); + int windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok); if (ok) setWindowHopLevel(windowHopLevel); else { - size_t windowOverlap = attributes.value("windowOverlap").toUInt(&ok); + int windowOverlap = attributes.value("windowOverlap").toUInt(&ok); // a percentage value if (ok) { if (windowOverlap == 0) setWindowHopLevel(0); @@ -3707,13 +3697,13 @@ float threshold = attributes.value("threshold").toFloat(&ok); if (ok) setThreshold(threshold); - size_t minFrequency = attributes.value("minFrequency").toUInt(&ok); + int minFrequency = attributes.value("minFrequency").toUInt(&ok); if (ok) { SVDEBUG << "SpectrogramLayer::setProperties: setting min freq to " << minFrequency << endl; setMinFrequency(minFrequency); } - size_t maxFrequency = attributes.value("maxFrequency").toUInt(&ok); + int maxFrequency = attributes.value("maxFrequency").toUInt(&ok); if (ok) { SVDEBUG << "SpectrogramLayer::setProperties: setting max freq to " << maxFrequency << endl; setMaxFrequency(maxFrequency); diff -r ddae586bc47b -r 1d526ba11a24 layer/SpectrogramLayer.h --- a/layer/SpectrogramLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/SpectrogramLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -70,7 +70,7 @@ virtual QString getFeatureDescription(View *v, QPoint &) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void measureDoubleClick(View *, QMouseEvent *); @@ -99,17 +99,17 @@ void setChannel(int); int getChannel() const; - void setWindowSize(size_t); - size_t getWindowSize() const; + void setWindowSize(int); + int getWindowSize() const; - void setWindowHopLevel(size_t level); - size_t getWindowHopLevel() const; + void setWindowHopLevel(int level); + int getWindowHopLevel() const; void setWindowType(WindowType type); WindowType getWindowType() const; - void setZeroPadLevel(size_t level); - size_t getZeroPadLevel() const; + void setZeroPadLevel(int level); + int getZeroPadLevel() const; /** * Set the gain multiplier for sample values in this view. @@ -127,11 +127,11 @@ void setThreshold(float threshold); float getThreshold() const; - void setMinFrequency(size_t); - size_t getMinFrequency() const; + void setMinFrequency(int); + int getMinFrequency() const; - void setMaxFrequency(size_t); // 0 -> no maximum - size_t getMaxFrequency() const; + void setMaxFrequency(int); // 0 -> no maximum + int getMaxFrequency() const; enum ColourScale { LinearColourScale, @@ -243,7 +243,7 @@ protected slots: void cacheInvalid(); - void cacheInvalid(size_t startFrame, size_t endFrame); + void cacheInvalid(int startFrame, int endFrame); void preferenceChanged(PropertyContainer::PropertyName name); @@ -253,20 +253,20 @@ const DenseTimeValueModel *m_model; // I do not own this int m_channel; - size_t m_windowSize; + int m_windowSize; WindowType m_windowType; - size_t m_windowHopLevel; - size_t m_zeroPadLevel; - size_t m_fftSize; + int m_windowHopLevel; + int m_zeroPadLevel; + int m_fftSize; float m_gain; float m_initialGain; float m_threshold; float m_initialThreshold; int m_colourRotation; int m_initialRotation; - size_t m_minFrequency; - size_t m_maxFrequency; - size_t m_initialMaxFrequency; + int m_minFrequency; + int m_maxFrequency; + int m_initialMaxFrequency; ColourScale m_colourScale; int m_colourMap; QColor m_crosshairColour; @@ -311,11 +311,11 @@ QImage image; QRect validArea; long startFrame; - size_t zoomLevel; + int zoomLevel; }; typedef std::map ViewImageCache; void invalidateImageCaches(); - void invalidateImageCaches(size_t startFrame, size_t endFrame); + void invalidateImageCaches(int startFrame, int endFrame); mutable ViewImageCache m_imageCaches; /** @@ -328,7 +328,7 @@ mutable QTimer *m_updateTimer; - mutable size_t m_candidateFillStartFrame; + mutable int m_candidateFillStartFrame; bool m_exiting; void initialisePalette(); @@ -346,8 +346,8 @@ struct LayerRange { long startFrame; int zoomLevel; - size_t modelStart; - size_t modelEnd; + int modelStart; + int modelEnd; }; // Note that the getYBin... methods return the nominal bin in the @@ -368,14 +368,14 @@ bool getXYBinSourceRange(View *v, int x, int y, float &min, float &max, float &phaseMin, float &phaseMax) const; - size_t getWindowIncrement() const { + int getWindowIncrement() const { if (m_windowHopLevel == 0) return m_windowSize; else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4; else return m_windowSize / (1 << (m_windowHopLevel - 1)); } - size_t getZeroPadLevel(const View *v) const; - size_t getFFTSize(const View *v) const; + int getZeroPadLevel(const View *v) const; + int getFFTSize(const View *v) const; FFTModel *getFFTModel(const View *v) const; Dense3DModelPeakCache *getPeakCache(const View *v) const; void invalidateFFTModels(); diff -r ddae586bc47b -r 1d526ba11a24 layer/SpectrumLayer.cpp --- a/layer/SpectrumLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/SpectrumLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -121,7 +121,7 @@ setSliceableModel(newFFT); m_biasCurve.clear(); - for (size_t i = 0; i < m_windowSize; ++i) { + for (int i = 0; i < m_windowSize; ++i) { m_biasCurve.push_back(1.f / (float(m_windowSize)/2.f)); } @@ -257,7 +257,7 @@ } void -SpectrumLayer::setWindowSize(size_t ws) +SpectrumLayer::setWindowSize(int ws) { if (m_windowSize == ws) return; m_windowSize = ws; @@ -266,7 +266,7 @@ } void -SpectrumLayer::setWindowHopLevel(size_t v) +SpectrumLayer::setWindowHopLevel(int v) { if (m_windowHopLevel == v) return; m_windowHopLevel = v; @@ -566,7 +566,7 @@ if (!m_sliceableModel) return ""; int minbin = 0, maxbin = 0, range = 0; - QString genericDesc = SliceLayer::getFeatureDescription + QString genericDesc = SliceLayer::getFeatureDescriptionAux (v, p, false, minbin, maxbin, range); if (genericDesc == "") return ""; @@ -684,7 +684,7 @@ // SVDEBUG << "Showing peaks..." << endl; - size_t col = v->getCentreFrame() / fft->getResolution(); + int col = v->getCentreFrame() / fft->getResolution(); paint.save(); paint.setRenderHint(QPainter::Antialiasing, false); @@ -702,11 +702,11 @@ BiasCurve curve; getBiasCurve(curve); - size_t cs = curve.size(); + int cs = curve.size(); std::vector values; - for (size_t bin = 0; bin < fft->getHeight(); ++bin) { + for (int bin = 0; bin < fft->getHeight(); ++bin) { float value = m_sliceableModel->getValueAt(col, bin); if (bin < cs) value *= curve[bin]; values.push_back(value); @@ -715,7 +715,7 @@ for (FFTModel::PeakSet::iterator i = peaks.begin(); i != peaks.end(); ++i) { - size_t bin = i->first; + int bin = i->first; // cerr << "bin = " << bin << ", thresh = " << thresh << ", value = " << fft->getMagnitudeAt(col, bin) << endl; @@ -726,7 +726,7 @@ int x = lrintf(getXForFrequency(freq, w)); float norm = 0.f; - float y = getYForValue(values[bin], v, norm); // don't need y, need norm + (void)getYForValue(values[bin], v, norm); // don't need return value, need norm paint.setPen(mapper.map(norm)); paint.drawLine(xorigin + x, 0, xorigin + x, v->height() - pkh - 1); @@ -850,10 +850,10 @@ bool ok = false; - size_t windowSize = attributes.value("windowSize").toUInt(&ok); + int windowSize = attributes.value("windowSize").toUInt(&ok); if (ok) setWindowSize(windowSize); - size_t windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok); + int windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok); if (ok) setWindowHopLevel(windowHopLevel); bool showPeaks = (attributes.value("showPeaks").trimmed() == "true"); diff -r ddae586bc47b -r 1d526ba11a24 layer/SpectrumLayer.h --- a/layer/SpectrumLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/SpectrumLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -81,11 +81,11 @@ void setChannel(int); int getChannel() const { return m_channel; } - void setWindowSize(size_t); - size_t getWindowSize() const { return m_windowSize; } + void setWindowSize(int); + int getWindowSize() const { return m_windowSize; } - void setWindowHopLevel(size_t level); - size_t getWindowHopLevel() const { return m_windowHopLevel; } + void setWindowHopLevel(int level); + int getWindowHopLevel() const { return m_windowHopLevel; } void setWindowType(WindowType type); WindowType getWindowType() const { return m_windowType; } @@ -110,9 +110,9 @@ DenseTimeValueModel *m_originModel; int m_channel; bool m_channelSet; - size_t m_windowSize; + int m_windowSize; WindowType m_windowType; - size_t m_windowHopLevel; + int m_windowHopLevel; bool m_showPeaks; mutable bool m_newFFTNeeded; @@ -129,7 +129,7 @@ float getFrequencyForX(float x, float w) const; float getXForFrequency(float freq, float w) const; - size_t getWindowIncrement() const { + int getWindowIncrement() const { if (m_windowHopLevel == 0) return m_windowSize; else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4; else return m_windowSize / (1 << (m_windowHopLevel - 1)); diff -r ddae586bc47b -r 1d526ba11a24 layer/TextLayer.cpp --- a/layer/TextLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/TextLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -221,7 +221,7 @@ bool TextLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -495,7 +495,7 @@ } void -TextLayer::eraseDrag(View *v, QMouseEvent *e) +TextLayer::eraseDrag(View *, QMouseEvent *) { } @@ -621,7 +621,7 @@ } void -TextLayer::moveSelection(Selection s, size_t newStartFrame) +TextLayer::moveSelection(Selection s, int newStartFrame) { if (!m_model) return; @@ -717,7 +717,7 @@ } bool -TextLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */) +TextLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */) { if (!m_model) return false; @@ -759,7 +759,7 @@ i != points.end(); ++i) { if (!i->haveFrame()) continue; - size_t frame = 0; + int frame = 0; if (!realign) { diff -r ddae586bc47b -r 1d526ba11a24 layer/TextLayer.h --- a/layer/TextLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/TextLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -37,7 +37,7 @@ virtual QString getFeatureDescription(View *v, QPoint &) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void drawStart(View *v, QMouseEvent *); @@ -52,7 +52,7 @@ virtual void editDrag(View *v, QMouseEvent *); virtual void editEnd(View *v, QMouseEvent *); - virtual void moveSelection(Selection s, size_t newStartFrame); + virtual void moveSelection(Selection s, int newStartFrame); virtual void resizeSelection(Selection s, Selection newSize); virtual void deleteSelection(Selection s); diff -r ddae586bc47b -r 1d526ba11a24 layer/TimeInstantLayer.cpp --- a/layer/TimeInstantLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/TimeInstantLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -201,7 +201,7 @@ } QString -TimeInstantLayer::getLabelPreceding(size_t frame) const +TimeInstantLayer::getLabelPreceding(int frame) const { if (!m_model) return ""; SparseOneDimensionalModel::PointList points = m_model->getPreviousPoints(frame); @@ -250,7 +250,7 @@ bool TimeInstantLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -506,7 +506,7 @@ } void -TimeInstantLayer::drawEnd(View *, QMouseEvent *e) +TimeInstantLayer::drawEnd(View *, QMouseEvent *) { #ifdef DEBUG_TIME_INSTANT_LAYER cerr << "TimeInstantLayer::drawEnd(" << e->x() << ")" << endl; @@ -541,7 +541,7 @@ } void -TimeInstantLayer::eraseDrag(View *v, QMouseEvent *e) +TimeInstantLayer::eraseDrag(View *, QMouseEvent *) { } @@ -612,7 +612,7 @@ } void -TimeInstantLayer::editEnd(View *, QMouseEvent *e) +TimeInstantLayer::editEnd(View *, QMouseEvent *) { #ifdef DEBUG_TIME_INSTANT_LAYER cerr << "TimeInstantLayer::editEnd(" << e->x() << ")" << endl; @@ -666,7 +666,7 @@ } void -TimeInstantLayer::moveSelection(Selection s, size_t newStartFrame) +TimeInstantLayer::moveSelection(Selection s, int newStartFrame) { if (!m_model) return; @@ -798,7 +798,7 @@ if (!i->haveFrame()) continue; - size_t frame = 0; + int frame = 0; if (!realign) { diff -r ddae586bc47b -r 1d526ba11a24 layer/TimeInstantLayer.h --- a/layer/TimeInstantLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/TimeInstantLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -35,11 +35,11 @@ virtual void paint(View *v, QPainter &paint, QRect rect) const; - virtual QString getLabelPreceding(size_t) const; + virtual QString getLabelPreceding(int) const; virtual QString getFeatureDescription(View *v, QPoint &) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void drawStart(View *v, QMouseEvent *); @@ -56,7 +56,7 @@ virtual bool editOpen(View *, QMouseEvent *); - virtual void moveSelection(Selection s, size_t newStartFrame); + virtual void moveSelection(Selection s, int newStartFrame); virtual void resizeSelection(Selection s, Selection newSize); virtual void deleteSelection(Selection s); diff -r ddae586bc47b -r 1d526ba11a24 layer/TimeRulerLayer.cpp --- a/layer/TimeRulerLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/TimeRulerLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -50,7 +50,7 @@ bool TimeRulerLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, SnapType snap) const + int &resolution, SnapType snap) const { if (!m_model) { resolution = 1; diff -r ddae586bc47b -r 1d526ba11a24 layer/TimeRulerLayer.h --- a/layer/TimeRulerLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/TimeRulerLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -41,7 +41,7 @@ void setLabelHeight(LabelHeight h) { m_labelHeight = h; } LabelHeight getLabelHeight() const { return m_labelHeight; } - virtual bool snapToFeatureFrame(View *, int &, size_t &, SnapType) const; + virtual bool snapToFeatureFrame(View *, int &, int &, SnapType) const; virtual ColourSignificance getLayerColourSignificance() const { return ColourIrrelevant; diff -r ddae586bc47b -r 1d526ba11a24 layer/TimeValueLayer.cpp --- a/layer/TimeValueLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/TimeValueLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -574,7 +574,7 @@ } QString -TimeValueLayer::getLabelPreceding(size_t frame) const +TimeValueLayer::getLabelPreceding(int frame) const { if (!m_model) return ""; SparseTimeValueModel::PointList points = m_model->getPreviousPoints(frame); @@ -630,7 +630,7 @@ bool TimeValueLayer::snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -702,7 +702,7 @@ bool TimeValueLayer::snapToSimilarFeature(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const { if (!m_model) { @@ -1435,7 +1435,7 @@ } void -TimeValueLayer::eraseDrag(View *v, QMouseEvent *e) +TimeValueLayer::eraseDrag(View *, QMouseEvent *) { } @@ -1580,7 +1580,7 @@ } void -TimeValueLayer::moveSelection(Selection s, size_t newStartFrame) +TimeValueLayer::moveSelection(Selection s, int newStartFrame) { if (!m_model) return; @@ -1682,7 +1682,7 @@ } bool -TimeValueLayer::paste(View *v, const Clipboard &from, int frameOffset, +TimeValueLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool interactive) { if (!m_model) return false; @@ -1721,7 +1721,6 @@ Labeller::ValueType generation = Labeller::ValueNone; bool haveUsableLabels = false; - bool haveExistingItems = !(m_model->isEmpty()); Labeller labeller; labeller.setSampleRate(m_model->getSampleRate()); @@ -1823,7 +1822,7 @@ if (!i->haveFrame()) continue; - size_t frame = 0; + int frame = 0; if (!realign) { diff -r ddae586bc47b -r 1d526ba11a24 layer/TimeValueLayer.h --- a/layer/TimeValueLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/TimeValueLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -43,13 +43,13 @@ virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; virtual QString getFeatureDescription(View *v, QPoint &) const; - virtual QString getLabelPreceding(size_t) const; + virtual QString getLabelPreceding(int) const; virtual bool snapToFeatureFrame(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual bool snapToSimilarFeature(View *v, int &frame, - size_t &resolution, + int &resolution, SnapType snap) const; virtual void drawStart(View *v, QMouseEvent *); @@ -66,7 +66,7 @@ virtual bool editOpen(View *v, QMouseEvent *); - virtual void moveSelection(Selection s, size_t newStartFrame); + virtual void moveSelection(Selection s, int newStartFrame); virtual void resizeSelection(Selection s, Selection newSize); virtual void deleteSelection(Selection s); diff -r ddae586bc47b -r 1d526ba11a24 layer/WaveformLayer.cpp --- a/layer/WaveformLayer.cpp Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/WaveformLayer.cpp Tue Jun 17 15:18:06 2014 +0100 @@ -361,17 +361,17 @@ return int(((dB + 50.0) * m) / 50.0 + 0.1); } -size_t -WaveformLayer::getChannelArrangement(size_t &min, size_t &max, +int +WaveformLayer::getChannelArrangement(int &min, int &max, bool &merging, bool &mixing) const { if (!m_model || !m_model->isOK()) return 0; - size_t channels = m_model->getChannelCount(); + int channels = m_model->getChannelCount(); if (channels == 0) return 0; - size_t rawChannels = channels; + int rawChannels = channels; if (m_channel == -1) { min = 0; @@ -407,8 +407,8 @@ -5, -3, -2, -1, -0.5, 0 }; bool -WaveformLayer::getSourceFramesForX(View *v, int x, size_t modelZoomLevel, - size_t &f0, size_t &f1) const +WaveformLayer::getSourceFramesForX(View *v, int x, int modelZoomLevel, + int &f0, int &f1) const { long viewFrame = v->getFrameForX(x); if (viewFrame < 0) { @@ -442,7 +442,7 @@ long modelStart = long(m_model->getStartFrame()); long modelEnd = long(m_model->getEndFrame()); - size_t rangeStart, rangeEnd; + int rangeStart, rangeEnd; if (startFrame < modelStart) rangeStart = modelStart; else rangeStart = startFrame; @@ -456,7 +456,7 @@ RangeSummarisableTimeValueModel::Range range = m_model->getSummary(channel, rangeStart, rangeEnd - rangeStart); - size_t minChannel = 0, maxChannel = 0; + int minChannel = 0, maxChannel = 0; bool mergingChannels = false, mixingChannels = false; getChannelArrangement(minChannel, maxChannel, @@ -488,7 +488,7 @@ << ") [" << rect.width() << "x" << rect.height() << "]: zoom " << zoomLevel << endl; #endif - size_t channels = 0, minChannel = 0, maxChannel = 0; + int channels = 0, minChannel = 0, maxChannel = 0; bool mergingChannels = false, mixingChannels = false; channels = getChannelArrangement(minChannel, maxChannel, @@ -571,11 +571,11 @@ // must remain the same when we scroll one or more pixels left or // right. - size_t modelZoomLevel = m_model->getSummaryBlockSize(zoomLevel); + int modelZoomLevel = m_model->getSummaryBlockSize(zoomLevel); - size_t frame0; - size_t frame1; - size_t spare; + int frame0; + int frame1; + int spare; getSourceFramesForX(v, x0, modelZoomLevel, frame0, spare); getSourceFramesForX(v, x1, modelZoomLevel, spare, frame1); @@ -602,11 +602,11 @@ midColour = midColour.light(50); } - while (m_effectiveGains.size() <= maxChannel) { + while ((int)m_effectiveGains.size() <= maxChannel) { m_effectiveGains.push_back(m_gain); } - for (size_t ch = minChannel; ch <= maxChannel; ++ch) { + for (int ch = minChannel; ch <= maxChannel; ++ch) { int prevRangeBottom = -1, prevRangeTop = -1; QColor prevRangeBottomColour = baseColour, prevRangeTopColour = baseColour; @@ -711,7 +711,7 @@ range = RangeSummarisableTimeValueModel::Range(); - size_t f0, f1; + int f0, f1; if (!getSourceFramesForX(v, x, modelZoomLevel, f0, f1)) continue; f1 = f1 - 1; @@ -720,8 +720,8 @@ continue; } - size_t i0 = (f0 - frame0) / modelZoomLevel; - size_t i1 = (f1 - frame0) / modelZoomLevel; + int i0 = (f0 - frame0) / modelZoomLevel; + int i1 = (f1 - frame0) / modelZoomLevel; #ifdef DEBUG_WAVEFORM_PAINT cerr << "WaveformLayer::paint: pixel " << x << ": i0 " << i0 << " (f " << f0 << "), i1 " << i1 << " (f " << f1 << ")" << endl; @@ -731,11 +731,11 @@ cerr << "WaveformLayer::paint: ERROR: i1 " << i1 << " > i0 " << i0 << " plus one (zoom = " << zoomLevel << ", model zoom = " << modelZoomLevel << ")" << endl; } - if (ranges && i0 < ranges->size()) { + if (ranges && i0 < (int)ranges->size()) { range = (*ranges)[i0]; - if (i1 > i0 && i1 < ranges->size()) { + if (i1 > i0 && i1 < (int)ranges->size()) { range.setMax(std::max(range.max(), (*ranges)[i1].max())); range.setMin(std::min(range.min(), (*ranges)[i1].min())); range.setAbsmean((range.absmean() + (*ranges)[i1].absmean()) / 2); @@ -752,7 +752,7 @@ if (mergingChannels) { - if (otherChannelRanges && i0 < otherChannelRanges->size()) { + if (otherChannelRanges && i0 < (int)otherChannelRanges->size()) { range.setMax(fabsf(range.max())); range.setMin(-fabsf((*otherChannelRanges)[i0].max())); @@ -760,7 +760,7 @@ ((range.absmean() + (*otherChannelRanges)[i0].absmean()) / 2); - if (i1 > i0 && i1 < otherChannelRanges->size()) { + if (i1 > i0 && i1 < (int)otherChannelRanges->size()) { // let's not concern ourselves about the mean range.setMin (std::min @@ -771,7 +771,7 @@ } else if (mixingChannels) { - if (otherChannelRanges && i0 < otherChannelRanges->size()) { + if (otherChannelRanges && i0 < (int)otherChannelRanges->size()) { range.setMax((range.max() + (*otherChannelRanges)[i0].max()) / 2); range.setMin((range.min() + (*otherChannelRanges)[i0].min()) / 2); @@ -962,9 +962,9 @@ int zoomLevel = v->getZoomLevel(); - size_t modelZoomLevel = m_model->getSummaryBlockSize(zoomLevel); + int modelZoomLevel = m_model->getSummaryBlockSize(zoomLevel); - size_t f0, f1; + int f0, f1; if (!getSourceFramesForX(v, x, modelZoomLevel, f0, f1)) return ""; QString text; @@ -981,16 +981,16 @@ .arg(rt0.toText(true).c_str()); } - size_t channels = 0, minChannel = 0, maxChannel = 0; + int channels = 0, minChannel = 0, maxChannel = 0; bool mergingChannels = false, mixingChannels = false; channels = getChannelArrangement(minChannel, maxChannel, mergingChannels, mixingChannels); if (channels == 0) return ""; - for (size_t ch = minChannel; ch <= maxChannel; ++ch) { + for (int ch = minChannel; ch <= maxChannel; ++ch) { - size_t blockSize = v->getZoomLevel(); + int blockSize = v->getZoomLevel(); RangeSummarisableTimeValueModel::RangeBlock ranges; m_model->getSummaries(ch, f0, f1 - f0, ranges, blockSize); @@ -1037,9 +1037,9 @@ } int -WaveformLayer::getYForValue(const View *v, float value, size_t channel) const +WaveformLayer::getYForValue(const View *v, float value, int channel) const { - size_t channels = 0, minChannel = 0, maxChannel = 0; + int channels = 0, minChannel = 0, maxChannel = 0; bool mergingChannels = false, mixingChannels = false; channels = getChannelArrangement(minChannel, maxChannel, @@ -1080,9 +1080,9 @@ } float -WaveformLayer::getValueForY(const View *v, int y, size_t &channel) const +WaveformLayer::getValueForY(const View *v, int y, int &channel) const { - size_t channels = 0, minChannel = 0, maxChannel = 0; + int channels = 0, minChannel = 0, maxChannel = 0; bool mergingChannels = false, mixingChannels = false; channels = getChannelArrangement(minChannel, maxChannel, @@ -1129,7 +1129,7 @@ WaveformLayer::getYScaleValue(const View *v, int y, float &value, QString &unit) const { - size_t channel; + int channel; value = getValueForY(v, y, channel); @@ -1155,7 +1155,7 @@ WaveformLayer::getYScaleDifference(const View *v, int y0, int y1, float &diff, QString &unit) const { - size_t c0, c1; + int c0, c1; float v0 = getValueForY(v, y0, c0); float v1 = getValueForY(v, y1, c1); @@ -1207,7 +1207,7 @@ return; } - size_t channels = 0, minChannel = 0, maxChannel = 0; + int channels = 0, minChannel = 0, maxChannel = 0; bool mergingChannels = false, mixingChannels = false; channels = getChannelArrangement(minChannel, maxChannel, @@ -1220,11 +1220,11 @@ float gain = m_gain; - for (size_t ch = minChannel; ch <= maxChannel; ++ch) { + for (int ch = minChannel; ch <= maxChannel; ++ch) { int lastLabelledY = -1; - if (ch < m_effectiveGains.size()) gain = m_effectiveGains[ch]; + if (ch < (int)m_effectiveGains.size()) gain = m_effectiveGains[ch]; int n = 10; diff -r ddae586bc47b -r 1d526ba11a24 layer/WaveformLayer.h --- a/layer/WaveformLayer.h Tue Jun 03 11:10:52 2014 +0100 +++ b/layer/WaveformLayer.h Tue Jun 17 15:18:06 2014 +0100 @@ -208,15 +208,15 @@ const RangeSummarisableTimeValueModel *m_model; // I do not own this /// Return value is number of channels displayed - size_t getChannelArrangement(size_t &min, size_t &max, + int getChannelArrangement(int &min, int &max, bool &merging, bool &mixing) const; - int getYForValue(const View *v, float value, size_t channel) const; + int getYForValue(const View *v, float value, int channel) const; - float getValueForY(const View *v, int y, size_t &channel) const; + float getValueForY(const View *v, int y, int &channel) const; - bool getSourceFramesForX(View *v, int x, size_t modelZoomLevel, - size_t &f0, size_t &f1) const; + bool getSourceFramesForX(View *v, int x, int modelZoomLevel, + int &f0, int &f1) const; float getNormalizeGain(View *v, int channel) const;