diff audioio/PhaseVocoderTimeStretcher.h @ 31:37af203dbd15

* Buffer size fixes in the time stretcher, to avoid running out of input data for large or small ratios
author Chris Cannam
date Thu, 21 Sep 2006 09:43:41 +0000
parents d88d117e0c34
children e3b32dc5180b
line wrap: on
line diff
--- a/audioio/PhaseVocoderTimeStretcher.h	Wed Sep 20 16:02:42 2006 +0000
+++ b/audioio/PhaseVocoderTimeStretcher.h	Thu Sep 21 09:43:41 2006 +0000
@@ -43,36 +43,22 @@
                               size_t channels,
                               float ratio,
                               bool sharpen,
-                              size_t maxProcessInputBlockSize);
+                              size_t maxOutputBlockSize);
     virtual ~PhaseVocoderTimeStretcher();
 
     /**
-     * Process a block.  The input array contains the given number of
-     * samples (on each channel); the output must have space for
-     * lrintf(samples * m_ratio).
-     * 
-     * This function isn't really recommended, and I may yet remove it.
-     * It should work correctly for some ratios, e.g. small powers of
-     * two, if transient sharpening is off.  For other ratios it may
-     * drop samples -- use putInput in a loop followed by getOutput
-     * (when getAvailableOutputSamples reports enough) instead.
-     *
-     * Do not mix process calls with putInput/getOutput calls.
-     */
-    void process(float **input, float **output, size_t samples);
-
-    /**
      * Return the number of samples that would need to be added via
      * putInput in order to provoke the time stretcher into doing some
      * time stretching and making more output samples available.
-     * This will be an estimate, if transient sharpening is on.
+     * This will be an estimate, if transient sharpening is on; the 
+     * caller may need to do the put/get/test cycle more than once.
      */
     size_t getRequiredInputSamples() const;
 
     /**
      * Put (and possibly process) a given number of input samples.
-     * Number must not exceed the maxProcessInputBlockSize passed to
-     * constructor.
+     * Number should usually equal the value returned from
+     * getRequiredInputSamples().
      */
     void putInput(float **input, size_t samples);
 
@@ -159,7 +145,7 @@
 
     size_t m_sampleRate;
     size_t m_channels;
-    size_t m_maxProcessInputBlockSize;
+    size_t m_maxOutputBlockSize;
     float m_ratio;
     bool m_sharpen;
     size_t m_n1;