# HG changeset patch # User cannam # Date 1144073942 0 # Node ID c4662bbef275a715a3a48d5f8e4fd34288cd8c4a # Parent c66551966b5f6f61aae09794d4eecffeb0dc4453 * Allow plugins to return 0 for preferred block/step size to accept a host default diff -r c66551966b5f -r c4662bbef275 examples/SpectralCentroid.cpp --- 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 { diff -r c66551966b5f -r c4662bbef275 examples/SpectralCentroid.h --- 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); diff -r c66551966b5f -r c4662bbef275 examples/ZeroCrossing.cpp --- 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 { diff -r c66551966b5f -r c4662bbef275 examples/ZeroCrossing.h --- 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); diff -r c66551966b5f -r c4662bbef275 vamp-sdk/Plugin.h --- 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.