CSL  5.2
BlockResizer.h
Go to the documentation of this file.
1 ///
2 /// BlockResizer.h -- Regularizes the amount of data called for,
3 /// meaning that different parts of a graph can run at different callback block sizes.
4 /// This is useful for time-frequency transformations that only work with fixed buffer sizes.
5 /// A BlockResizer either caches large blocks between multiple smaller callbacks, or it calls a
6 /// smaller-block-size graph several times per larger-sized downstream callbacks.
7 /// BlockResizer works for up-block and down-block situations.
8 /// This version also handles multi-channel mapping, so you can use a mono input and ask it for
9 /// multi-channel output; it will copy.
10 ///
11 /// See the copyright notice and acknowledgment of authors in the file COPYRIGHT
12 ///
13 
14 #ifndef CSL_BlockResizer_H
15 #define CSL_BlockResizer_H
16 
17 #include "CSL_Core.h"
18 
19 namespace csl {
20 
21 /// Regularizes the amount of data called for.
22 /// This is useful for time-frequency transformations that only work with certain buffer sizes.
23 
24 class BlockResizer : public UnitGenerator { // it could be an Effect
25 
26 public: /// ctor / dtor
27  BlockResizer(UnitGenerator & input, unsigned blockSize);
28  ~BlockResizer();
29  /// the work-horse method calls the up-hill graph as needed
30  void nextBuffer(Buffer & outputBuffer) throw(CException);
31 
32 protected:
33  UnitGenerator * mInput; ///< my input unit generator (pointer)
34  Buffer mInputBuffer; ///< buffer used to pull input
35  unsigned mBufferSize; ///< fixed buffer size of the up-hill graph
36  int mFramePointer; ///< where am I in reading the input?
37 };
38 
39 }
40 
41 #endif