diff vamp-sdk/Plugin.h @ 167:31eda4b11f2b

* First bit of Vamp v2 work -- add an optional duration to features in a backward compatible way. Warning: this code is unstable and experimental and may change significantly in the coming weeks.
author cannam
date Thu, 17 Jul 2008 08:52:26 +0000
parents c1dce0b033cb
children 1982246a3902
line wrap: on
line diff
--- a/vamp-sdk/Plugin.h	Wed Jul 09 11:00:16 2008 +0000
+++ b/vamp-sdk/Plugin.h	Thu Jul 17 08:52:26 2008 +0000
@@ -304,6 +304,10 @@
 	 * this to zero if that behaviour is not desired.
 	 */
 	float sampleRate;
+
+        OutputDescriptor() : // defaults for mandatory non-class-type members
+            hasFixedBinCount(false), hasKnownExtents(false), isQuantized(false),
+            sampleType(OneSamplePerStep) { }
     };
 
     typedef std::vector<OutputDescriptor> OutputList;
@@ -319,17 +323,34 @@
     {
 	/**
 	 * True if an output feature has its own timestamp.  This is
-	 * mandatory if the output has VariableSampleRate, and is
-	 * likely to be disregarded otherwise.
+	 * mandatory if the output has VariableSampleRate, optional if
+	 * the output has FixedSampleRate, and unused if the output
+	 * has OneSamplePerStep.
 	 */
 	bool hasTimestamp;
 
 	/**
 	 * Timestamp of the output feature.  This is mandatory if the
-	 * output has VariableSampleRate, and is likely to be
-	 * disregarded otherwise.  Undefined if hasTimestamp is false.
+	 * output has VariableSampleRate or if the output has
+	 * FixedSampleRate and hasTimestamp is true, and unused
+	 * otherwise.
 	 */
 	RealTime timestamp;
+
+        /**
+         * True if an output feature has a specified duration.  This
+         * is optional if the output has VariableSampleRate or
+         * FixedSampleRate, and and unused if the output has
+         * OneSamplePerStep.
+         */
+        bool hasDuration;
+
+        /**
+         * Duration of the output feature.  This is mandatory if the
+         * output has VariableSampleRate or FixedSampleRate and
+         * hasDuration is true, and unused otherwise.
+         */
+        RealTime duration;
 	
 	/**
 	 * Results for a single sample of this feature.  If the output
@@ -342,9 +363,13 @@
 	 * Label for the sample of this feature.
 	 */
 	std::string label;
+
+        Feature() : // defaults for mandatory non-class-type members
+            hasTimestamp(false), hasDuration(false) { }
     };
 
     typedef std::vector<Feature> FeatureList;
+
     typedef std::map<int, FeatureList> FeatureSet; // key is output no
 
     /**