changeset 8:c4662bbef275

* Allow plugins to return 0 for preferred block/step size to accept a host default
author cannam
date Mon, 03 Apr 2006 14:19:02 +0000
parents c66551966b5f
children 44113b1e296b
files examples/SpectralCentroid.cpp examples/SpectralCentroid.h examples/ZeroCrossing.cpp examples/ZeroCrossing.h vamp-sdk/Plugin.h
diffstat 5 files changed, 18 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/examples/SpectralCentroid.cpp	Fri Mar 31 17:39:49 2006 +0000
+++ b/examples/SpectralCentroid.cpp	Mon Apr 03 14:19:02 2006 +0000
@@ -109,18 +109,6 @@
     m_workBuffer = new double[m_blockSize * 4];
 }
 
-size_t
-SpectralCentroid::getPreferredStepSize() const
-{
-    return 2048; // or whatever -- parameter?
-}
-
-size_t
-SpectralCentroid::getPreferredBlockSize() const
-{
-    return getPreferredStepSize();
-}
-
 SpectralCentroid::OutputList
 SpectralCentroid::getOutputDescriptors() const
 {
--- a/examples/SpectralCentroid.h	Fri Mar 31 17:39:49 2006 +0000
+++ b/examples/SpectralCentroid.h	Mon Apr 03 14:19:02 2006 +0000
@@ -58,9 +58,6 @@
     int getPluginVersion() const;
     std::string getCopyright() const;
 
-    size_t getPreferredStepSize() const;
-    size_t getPreferredBlockSize() const;
-
     OutputList getOutputDescriptors() const;
 
     FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp);
--- a/examples/ZeroCrossing.cpp	Fri Mar 31 17:39:49 2006 +0000
+++ b/examples/ZeroCrossing.cpp	Mon Apr 03 14:19:02 2006 +0000
@@ -100,18 +100,6 @@
     m_previousSample = 0.0f;
 }
 
-size_t
-ZeroCrossing::getPreferredStepSize() const
-{
-    return 4096; // or whatever
-}
-
-size_t
-ZeroCrossing::getPreferredBlockSize() const
-{
-    return getPreferredStepSize();
-}
-
 ZeroCrossing::OutputList
 ZeroCrossing::getOutputDescriptors() const
 {
--- a/examples/ZeroCrossing.h	Fri Mar 31 17:39:49 2006 +0000
+++ b/examples/ZeroCrossing.h	Mon Apr 03 14:19:02 2006 +0000
@@ -58,9 +58,6 @@
     int getPluginVersion() const;
     std::string getCopyright() const;
 
-    size_t getPreferredStepSize() const;
-    size_t getPreferredBlockSize() const;
-
     OutputList getOutputDescriptors() const;
 
     FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp);
--- a/vamp-sdk/Plugin.h	Fri Mar 31 17:39:49 2006 +0000
+++ b/vamp-sdk/Plugin.h	Mon Apr 03 14:19:02 2006 +0000
@@ -152,19 +152,29 @@
     virtual InputDomain getInputDomain() const = 0;
 
     /**
+     * Get the preferred block size (window size -- the number of
+     * sample frames passed in each block to the process() function).
+     * This should be called before initialise().
+     *
+     * A plugin that can handle any block size may return 0.  The
+     * final block size will be set in the initialise() call.
+     */
+    virtual size_t getPreferredBlockSize() const { return 0; }
+
+    /**
      * Get the preferred step size (window increment -- the distance
      * in sample frames between the start frames of consecutive blocks
      * passed to the process() function) for the plugin.  This should
      * be called before initialise().
+     *
+     * A plugin may return 0 if it has no particular interest in the
+     * step size.  In this case, the host should make the step size
+     * equal to the block size if the plugin is accepting input in the
+     * time domain.  If the plugin is accepting input in the frequency
+     * domain, the host may use any step size.  The final step size
+     * will be set in the initialise() call.
      */
-    virtual size_t getPreferredStepSize() const = 0;
-
-    /**
-     * Get the preferred block size (window size -- the number of
-     * sample frames passed in each block to the process() function).
-     * This should be called before initialise().
-     */
-    virtual size_t getPreferredBlockSize() const { return getPreferredStepSize(); }
+    virtual size_t getPreferredStepSize() const { return 0; }
 
     /**
      * Get the minimum supported number of input channels.