changeset 192:d4fbd4e6fdbf

* Add hasDuration to output descriptor as well as the features themselves
author cannam
date Thu, 18 Sep 2008 16:08:28 +0000
parents d1bdcd4a226f
children 20393d30baee
files vamp-sdk/Plugin.h vamp-sdk/PluginAdapter.cpp vamp-sdk/PluginHostAdapter.cpp vamp/vamp.h
diffstat 4 files changed, 33 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/vamp-sdk/Plugin.h	Thu Sep 18 11:47:05 2008 +0000
+++ b/vamp-sdk/Plugin.h	Thu Sep 18 16:08:28 2008 +0000
@@ -305,9 +305,15 @@
 	 */
 	float sampleRate;
 
+        /**
+         * True if the returned results for this output are known to
+         * have a duration field.
+         */
+        bool hasDuration;
+
         OutputDescriptor() : // defaults for mandatory non-class-type members
             hasFixedBinCount(false), hasKnownExtents(false), isQuantized(false),
-            sampleType(OneSamplePerStep) { }
+            sampleType(OneSamplePerStep), hasDuration(false) { }
     };
 
     typedef std::vector<OutputDescriptor> OutputList;
--- a/vamp-sdk/PluginAdapter.cpp	Thu Sep 18 11:47:05 2008 +0000
+++ b/vamp-sdk/PluginAdapter.cpp	Thu Sep 18 16:08:28 2008 +0000
@@ -166,6 +166,8 @@
                   << plugin->getVampApiVersion()
                   << " does not match actual API version "
                   << VAMP_API_VERSION << std::endl;
+        std::cerr << "(Plugin identifier is: "
+                  << plugin->getIdentifier() << ")" << std::endl;
         delete plugin;
         return 0;
     }
@@ -682,6 +684,7 @@
     }
 
     desc->sampleRate = od.sampleRate;
+    desc->hasDuration = od.hasDuration;
 
     return desc;
 }
--- a/vamp-sdk/PluginHostAdapter.cpp	Thu Sep 18 11:47:05 2008 +0000
+++ b/vamp-sdk/PluginHostAdapter.cpp	Thu Sep 18 16:08:28 2008 +0000
@@ -341,6 +341,12 @@
 
         d.sampleRate = sd->sampleRate;
 
+        if (m_descriptor->vampApiVersion >= 2) {
+            d.hasDuration = sd->hasDuration;
+        } else {
+            d.hasDuration = false;
+        }
+
         list.push_back(d);
 
         m_descriptor->releaseOutputDescriptor(sd);
--- a/vamp/vamp.h	Thu Sep 18 11:47:05 2008 +0000
+++ b/vamp/vamp.h	Thu Sep 18 16:08:28 2008 +0000
@@ -160,6 +160,15 @@
        "Resolution" of result, if sampleType is vampVariableSampleRate. */
     float sampleRate;
 
+    /** 1 if the returned results for this output are known to have a
+        duration field.
+
+        This field is new in Vamp API version 2; it must not be tested
+        for plugins that report an older API version in their plugin
+        descriptor.
+    */
+    int hasDuration;
+
 } VampOutputDescriptor;
 
 typedef struct _VampFeature
@@ -214,14 +223,14 @@
         zero.
 
         If present, this array must contain featureCount feature
-        structures for a Vamp 1.0 plugin, or 2*featureCount feature
-        unions for a Vamp 2.0 plugin.
+        structures for a Vamp API version 1 plugin, or 2*featureCount
+        feature unions for a Vamp API version 2 plugin.
 
-        The features returned by a Vamp 2.0 plugin must consist of the
-        same feature structures as in 1.0 for the first featureCount
-        array elements, followed by featureCount unions that contain
-        pointers to V2 feature structures (or NULL pointers if no V2
-        feature structures are present).
+        The features returned by an API version 2 plugin must consist
+        of the same feature structures as in API version 1 for the
+        first featureCount array elements, followed by featureCount
+        unions that contain VampFeatureV2 structures (or NULL pointers
+        if no V2 feature structures are present).
      */
     VampFeatureUnion *features;
 
@@ -322,7 +331,7 @@
         handle, or releaseOutputDescriptor for this descriptor. Host
         must call releaseOutputDescriptor after use. */
     VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle,
-                                                unsigned int);
+                                                 unsigned int);
 
     /** Destroy a descriptor for a feature output. */
     void (*releaseOutputDescriptor)(VampOutputDescriptor *);