changeset 785:05ba4bbd2b87

Warn if the output sample rate is higher than that of the input model
author Chris Cannam
date Thu, 28 Mar 2013 17:08:04 +0000
parents 459235dccff6
children 84013dc0ed77
files data/model/SparseModel.h transform/FeatureExtractionModelTransformer.cpp
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/data/model/SparseModel.h	Thu Mar 28 10:01:55 2013 +0000
+++ b/data/model/SparseModel.h	Thu Mar 28 17:08:04 2013 +0000
@@ -436,11 +436,15 @@
         PointListConstIterator i = i0;
 
         for (i = i0; i != i1; ++i) {
+//            std::cerr << "i->frame is " << i->frame << ", wanting " << frame << std::endl;
+
             if (i->frame < (int)frame) { continue; }
             if (indexAtFrame > 0) { --indexAtFrame; continue; }
             return i;
         }
 
+//        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;
         }
@@ -598,6 +602,7 @@
     QMutexLocker locker(&m_mutex);
 
     if (m_resolution == 0) {
+//        std::cerr << "getPointIterators: resolution == 0, returning end()" << std::endl;
         startItr = m_points.end();
         endItr = m_points.end();
         return;
@@ -609,7 +614,7 @@
     PointType startPoint(start), endPoint(end);
     
 //    std::cerr << "getPointIterators: start frame " << start << ", end frame " << end << ", m_resolution " << m_resolution << std::endl;
-    
+
     startItr = m_points.lower_bound(startPoint);
       endItr = m_points.upper_bound(endPoint);
 }
--- a/transform/FeatureExtractionModelTransformer.cpp	Thu Mar 28 10:01:55 2013 +0000
+++ b/transform/FeatureExtractionModelTransformer.cpp	Thu Mar 28 17:08:04 2013 +0000
@@ -202,6 +202,14 @@
     size_t modelRate = input->getSampleRate();
     size_t modelResolution = 1;
 
+    if (m_descriptor->sampleType != 
+        Vamp::Plugin::OutputDescriptor::OneSamplePerStep) {
+        if (m_descriptor->sampleRate > input->getSampleRate()) {
+            std::cerr << "WARNING: plugin reports output sample rate as "
+                      << m_descriptor->sampleRate << " (can't display features with finer resolution than the input rate of " << input->getSampleRate() << ")" << std::endl;
+        }
+    }
+
     switch (m_descriptor->sampleType) {
 
     case Vamp::Plugin::OutputDescriptor::VariableSampleRate: