diff transform/FeatureExtractionModelTransformer.cpp @ 891:8962f80f5d8e tony_integration

Merge from default branch
author Chris Cannam
date Tue, 11 Mar 2014 17:32:31 +0000
parents 4cbf8c6a462d 7f97a4d9d14f
children c3656035240f
line wrap: on
line diff
--- a/transform/FeatureExtractionModelTransformer.cpp	Tue Mar 11 17:30:35 2014 +0000
+++ b/transform/FeatureExtractionModelTransformer.cpp	Tue Mar 11 17:32:31 2014 +0000
@@ -278,12 +278,11 @@
         //!!! 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
-//	modelRate = size_t(m_descriptors[n]->sampleRate + 0.001);
         if (m_descriptors[n]->sampleRate > input->getSampleRate()) {
             modelResolution = 1;
         } else {
-            modelResolution = size_t(input->getSampleRate() /
-                                     m_descriptors[n]->sampleRate);
+            modelResolution = size_t(round(input->getSampleRate() /
+                                           m_descriptors[n]->sampleRate));
         }
 	break;
     }
@@ -852,7 +851,6 @@
 //             << ", m_descriptor->sampleRate = " << m_descriptor->sampleRate
 //             << ", inputRate = " << inputRate
 //             << " giving frame = ";
- 
         frame = lrintf((m_fixedRateFeatureNos[n] / m_descriptors[n]->sampleRate)
                        * int(inputRate));
     }
@@ -927,7 +925,7 @@
             }
         }
 
-		if (isOutput<FlexiNoteModel>(n)) { // GF: added for flexi note model
+        if (isOutput<FlexiNoteModel>(n)) { // GF: added for flexi note model
 
             float velocity = 100;
             if (feature.values.size() > index) {
@@ -995,7 +993,14 @@
             getConformingOutput<EditableDenseThreeDimensionalModel>(n);
 	if (!model) return;
 
-	model->setColumn(frame / model->getResolution(), values);
+//        cerr << "(note: model resolution = " << model->getResolution() << ")"
+//             << endl;
+
+        if (!feature.hasTimestamp && m_fixedRateFeatureNos[n] >= 0) {
+            model->setColumn(m_fixedRateFeatureNos[n], values);
+        } else {
+            model->setColumn(frame / model->getResolution(), values);
+        }
 
     } else {
         SVDEBUG << "FeatureExtractionModelTransformer::addFeature: Unknown output model type!" << endl;