changeset 170:ff72d97823f7

* Add means to obtain actually used step & block sizes from buffering adapter
author cannam
date Fri, 25 Jul 2008 14:01:57 +0000
parents af8e59f43d1d
children dcc5df7e3253
files vamp-sdk/hostext/PluginBufferingAdapter.cpp vamp-sdk/hostext/PluginBufferingAdapter.h
diffstat 2 files changed, 37 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/vamp-sdk/hostext/PluginBufferingAdapter.cpp	Fri Jul 25 11:49:06 2008 +0000
+++ b/vamp-sdk/hostext/PluginBufferingAdapter.cpp	Fri Jul 25 14:01:57 2008 +0000
@@ -58,6 +58,8 @@
 
     bool initialise(size_t channels, size_t stepSize, size_t blockSize);
 
+    void getActualStepAndBlockSizes(size_t &stepSize, size_t &blockSize);
+
     OutputList getOutputDescriptors() const;
 
     void reset();
@@ -286,6 +288,13 @@
 {
     m_impl->setPluginBlockSize(blockSize);
 }
+
+void
+PluginBufferingAdapter::getActualStepAndBlockSizes(size_t &stepSize,
+                                                   size_t &blockSize)
+{
+    m_impl->getActualStepAndBlockSizes(stepSize, blockSize);
+}
 		
 bool
 PluginBufferingAdapter::initialise(size_t channels, size_t stepSize, size_t blockSize)
@@ -367,6 +376,14 @@
     m_setBlockSize = blockSize;
 }
 
+void
+PluginBufferingAdapter::Impl::getActualStepAndBlockSizes(size_t &stepSize,
+                                                         size_t &blockSize)
+{
+    stepSize = m_stepSize;
+    blockSize = m_blockSize;
+}
+
 bool
 PluginBufferingAdapter::Impl::initialise(size_t channels, size_t stepSize, size_t blockSize)
 {
--- a/vamp-sdk/hostext/PluginBufferingAdapter.h	Fri Jul 25 11:49:06 2008 +0000
+++ b/vamp-sdk/hostext/PluginBufferingAdapter.h	Fri Jul 25 14:01:57 2008 +0000
@@ -99,6 +99,17 @@
     size_t getPreferredBlockSize() const;
 
     /**
+     * Initialise the adapter (and therefore the plugin) for the given
+     * number of channels.  Initialise the adapter for the given step
+     * and block size, which must be equal.
+     *
+     * The step and block size used for the underlying plugin will
+     * depend on its preferences, or any values previously passed to
+     * setPluginStepSize and setPluginBlockSize.
+     */
+    bool initialise(size_t channels, size_t stepSize, size_t blockSize);
+
+    /**
      * Return the preferred step size of the plugin wrapped by this
      * adapter.
      *
@@ -138,15 +149,17 @@
     void setPluginBlockSize(size_t blockSize);
 
     /**
-     * Initialise the adapter (and therefore the plugin) for the given
-     * number of channels.  Initialise the adapter for the given step
-     * and block size, which must be equal.
+     * Return the step and block sizes that were actually used when
+     * initialising the underlying plugin.
      *
-     * The step and block size used for the underlying plugin will
-     * depend on its preferences, or any values previously passed to
-     * setPluginStepSize and setPluginBlockSize.
+     * This is included mainly for informational purposes.  You will
+     * not usually need to call this function.  If this is called
+     * before initialise(), it will return 0 for both values.  If it
+     * is called after a failed call to initialise(), it will return
+     * the values that were used in the failed call to the plugin's
+     * initialise() function.
      */
-    bool initialise(size_t channels, size_t stepSize, size_t blockSize);
+    void getActualStepAndBlockSizes(size_t &stepSize, size_t &blockSize);
 
     OutputList getOutputDescriptors() const;