# HG changeset patch # User Chris Cannam # Date 1478342501 0 # Node ID ca9032dd28118165ae662063779203417b731786 # Parent 303039dd9e05770cd45e51741b383e0c21b53b8e# Parent cbdd534f517aa13d1df9fac1e415ebfd7d6f460c Merge from branch piper diff -r 303039dd9e05 -r ca9032dd2811 data/model/ModelDataTableModel.cpp --- a/data/model/ModelDataTableModel.cpp Fri Nov 04 16:44:59 2016 +0000 +++ b/data/model/ModelDataTableModel.cpp Sat Nov 05 10:41:41 2016 +0000 @@ -47,7 +47,8 @@ if (!m_model) return QVariant(); if (role != Qt::EditRole && role != Qt::DisplayRole) return QVariant(); if (!index.isValid()) return QVariant(); - return m_model->getData(getUnsorted(index.row()), index.column(), role); + QVariant d = m_model->getData(getUnsorted(index.row()), index.column(), role); + return d; } bool diff -r 303039dd9e05 -r ca9032dd2811 data/model/SparseModel.h --- a/data/model/SparseModel.h Fri Nov 04 16:44:59 2016 +0000 +++ b/data/model/SparseModel.h Sat Nov 05 10:41:41 2016 +0000 @@ -332,8 +332,13 @@ virtual QVariant getData(int row, int column, int role) const { PointListConstIterator i = getPointListIteratorForRow(row); - if (i == m_points.end()) return QVariant(); + if (i == m_points.end()) { +// cerr << "no iterator for row " << row << " (have " << getRowCount() << " rows)" << endl; + return QVariant(); + } +// cerr << "returning data for row " << row << " col " << column << endl; + switch (column) { case 0: { if (role == SortRole) return int(i->frame); @@ -411,6 +416,7 @@ // This is only used if the model is called on to act in // TabularModel mode mutable std::vector m_rows; // map from row number to frame + void rebuildRowVector() const { m_rows.clear(); @@ -458,7 +464,7 @@ while (ri > 0 && m_rows[ri-1] == m_rows[row]) { --ri; ++indexAtFrame; } int initialIndexAtFrame = indexAtFrame; -// std::cerr << "getPointListIteratorForRow " << row << ": initialIndexAtFrame = " << initialIndexAtFrame << std::endl; +// std::cerr << "getPointListIteratorForRow " << row << ": initialIndexAtFrame = " << initialIndexAtFrame << " for frame " << frame << std::endl; PointListConstIterator i0, i1; getPointIterators(frame, i0, i1); @@ -471,9 +477,13 @@ if (indexAtFrame > 0) { --indexAtFrame; continue; } return i; } - -// std::cerr << "returning i with i->frame = " << i->frame << std::endl; - +/* + if (i == m_points.end()) { + std::cerr << "returning i at end" << std::endl; + } else { + std::cerr << "returning i with i->frame = " << i->frame << std::endl; + } +*/ if (indexAtFrame > 0) { std::cerr << "WARNING: SparseModel::getPointListIteratorForRow: No iterator available for row " << row << " (frame = " << frame << ", index at frame = " << initialIndexAtFrame << ", leftover index " << indexAtFrame << ")" << std::endl; } diff -r 303039dd9e05 -r ca9032dd2811 transform/FeatureExtractionModelTransformer.cpp --- a/transform/FeatureExtractionModelTransformer.cpp Fri Nov 04 16:44:59 2016 +0000 +++ b/transform/FeatureExtractionModelTransformer.cpp Sat Nov 05 10:41:41 2016 +0000 @@ -277,21 +277,33 @@ } sv_samplerate_t modelRate = input->getSampleRate(); + sv_samplerate_t outputRate = modelRate; int modelResolution = 1; if (m_descriptors[n]->sampleType != Vamp::Plugin::OutputDescriptor::OneSamplePerStep) { - if (m_descriptors[n]->sampleRate > input->getSampleRate()) { + + outputRate = m_descriptors[n]->sampleRate; + + //!!! SV doesn't actually support display of models that have + //!!! different underlying rates together -- so we always set + //!!! the model rate to be the input model's rate, and adjust + //!!! the resolution appropriately. We can't properly display + //!!! data with a higher resolution than the base model at all + if (outputRate > input->getSampleRate()) { cerr << "WARNING: plugin reports output sample rate as " - << m_descriptors[n]->sampleRate << " (can't display features with finer resolution than the input rate of " << input->getSampleRate() << ")" << endl; + << outputRate + << " (can't display features with finer resolution than the input rate of " + << modelRate << ")" << endl; + outputRate = modelRate; } } switch (m_descriptors[n]->sampleType) { case Vamp::Plugin::OutputDescriptor::VariableSampleRate: - if (m_descriptors[n]->sampleRate != 0.0) { - modelResolution = int(round(modelRate / m_descriptors[n]->sampleRate)); + if (outputRate != 0.0) { + modelResolution = int(round(modelRate / outputRate)); } break; @@ -300,18 +312,12 @@ break; case Vamp::Plugin::OutputDescriptor::FixedSampleRate: - //!!! SV doesn't actually support display of models that have - //!!! different underlying rates together -- so we always set - //!!! the model rate to be the input model's rate, and adjust - //!!! the resolution appropriately. We can't properly display - //!!! data with a higher resolution than the base model at all - if (m_descriptors[n]->sampleRate > input->getSampleRate()) { - modelResolution = 1; - } else if (m_descriptors[n]->sampleRate <= 0.0) { + if (outputRate <= 0.0) { cerr << "WARNING: Fixed sample-rate plugin reports invalid sample rate " << m_descriptors[n]->sampleRate << "; defaulting to input rate of " << input->getSampleRate() << endl; modelResolution = 1; } else { - modelResolution = int(round(modelRate / m_descriptors[n]->sampleRate)); + modelResolution = int(round(modelRate / outputRate)); +// cerr << "modelRate = " << modelRate << ", descriptor rate = " << outputRate << ", modelResolution = " << modelResolution << endl; } break; }