comparison vamp-sdk/hostext/PluginBufferingAdapter.h @ 169:af8e59f43d1d

* Add capability for setting underlying plugin's step and block sizes to PluginBufferingAdapter
author cannam
date Fri, 25 Jul 2008 11:49:06 +0000
parents 92ca8e401044
children ff72d97823f7
comparison
equal deleted inserted replaced
168:006a775133b1 169:af8e59f43d1d
72 class PluginBufferingAdapter : public PluginWrapper 72 class PluginBufferingAdapter : public PluginWrapper
73 { 73 {
74 public: 74 public:
75 PluginBufferingAdapter(Plugin *plugin); // I take ownership of plugin 75 PluginBufferingAdapter(Plugin *plugin); // I take ownership of plugin
76 virtual ~PluginBufferingAdapter(); 76 virtual ~PluginBufferingAdapter();
77 77
78 /**
79 * Return the preferred step size for this adapter.
80 *
81 * Because of the way this adapter works, its preferred step size
82 * will always be the same as its preferred block size. This may
83 * or may not be the same as the preferred step size of the
84 * underlying plugin, which may be obtained by calling
85 * getPluginPreferredStepSize().
86 */
87 size_t getPreferredStepSize() const;
88
89 /**
90 * Return the preferred block size for this adapter.
91 *
92 * This may or may not be the same as the preferred block size of
93 * the underlying plugin, which may be obtained by calling
94 * getPluginPreferredBlockSize().
95 *
96 * Note that this adapter may be initialised with any block size,
97 * not just its supposedly preferred one.
98 */
99 size_t getPreferredBlockSize() const;
100
101 /**
102 * Return the preferred step size of the plugin wrapped by this
103 * adapter.
104 *
105 * This is included mainly for informational purposes. This value
106 * is not likely to be a valid step size for the adapter itself,
107 * and it is not usually of any use in interpreting the results
108 * (because the adapter re-writes OneSamplePerStep outputs to
109 * FixedSampleRate so that the hop size no longer needs to be
110 * known beforehand in order to interpret them).
111 */
112 size_t getPluginPreferredStepSize() const;
113
114 /**
115 * Return the preferred block size of the plugin wrapped by this
116 * adapter.
117 *
118 * This is included mainly for informational purposes.
119 */
120 size_t getPluginPreferredBlockSize() const;
121
122 /**
123 * Set the step size that will be used for the underlying plugin
124 * when initialise() is called. If this is not set, the plugin's
125 * own preferred step size will be used. You will not usually
126 * need to call this function. If you do call it, it must be
127 * before the first call to initialise().
128 */
129 void setPluginStepSize(size_t stepSize);
130
131 /**
132 * Set the block size that will be used for the underlying plugin
133 * when initialise() is called. If this is not set, the plugin's
134 * own preferred block size will be used. You will not usually
135 * need to call this function. If you do call it, it must be
136 * before the first call to initialise().
137 */
138 void setPluginBlockSize(size_t blockSize);
139
140 /**
141 * Initialise the adapter (and therefore the plugin) for the given
142 * number of channels. Initialise the adapter for the given step
143 * and block size, which must be equal.
144 *
145 * The step and block size used for the underlying plugin will
146 * depend on its preferences, or any values previously passed to
147 * setPluginStepSize and setPluginBlockSize.
148 */
78 bool initialise(size_t channels, size_t stepSize, size_t blockSize); 149 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
79 150
80 size_t getPreferredStepSize() const;
81
82 OutputList getOutputDescriptors() const; 151 OutputList getOutputDescriptors() const;
83 152
84 void reset(); 153 void reset();
85 154
86 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); 155 FeatureSet process(const float *const *inputBuffers, RealTime timestamp);