diff host/vamp-simple-host.cpp @ 460:b409560a805b

Merge from branch vampipe
author Chris Cannam
date Mon, 10 Oct 2016 15:48:35 +0100
parents 22b29720da41
children
line wrap: on
line diff
--- a/host/vamp-simple-host.cpp	Thu Aug 18 12:00:24 2016 +0100
+++ b/host/vamp-simple-host.cpp	Mon Oct 10 15:48:35 2016 +0100
@@ -508,7 +508,7 @@
               const Plugin::OutputDescriptor &output, int outputNo,
               const Plugin::FeatureSet &features, ofstream *out, bool useFrames)
 {
-    static int featureCount = 0;
+    static int featureCount = -1;
     
     if (features.find(outputNo) == features.end()) return;
     
@@ -523,12 +523,13 @@
             rt = f.timestamp;
             haveRt = true;
         } else if (output.sampleType == Plugin::OutputDescriptor::FixedSampleRate) {
-            int n = featureCount;
+            int n = featureCount + 1;
             if (f.hasTimestamp) {
                 n = int(round(toSeconds(f.timestamp) * output.sampleRate));
             }
             rt = RealTime::fromSeconds(double(n) / output.sampleRate);
             haveRt = true;
+            featureCount = n;
         }
         
         if (useFrames) {
@@ -570,8 +571,6 @@
         (out ? *out : cout) << " " << f.label;
 
         (out ? *out : cout) << endl;
-
-        ++featureCount;
     }
 }