Mercurial > hg > vamp-plugin-sdk
comparison vamp-hostsdk/PluginInputDomainAdapter.h @ 317:5cb298435765
Add support for changing window shape in PluginInputDomainAdapter
author | Chris Cannam |
---|---|
date | Tue, 21 Jun 2011 15:40:50 +0100 |
parents | 5940dd0a399f |
children | 8ffb8985ae8f |
comparison
equal
deleted
inserted
replaced
316:c10fb3b3d029 | 317:5cb298435765 |
---|---|
52 * PluginInputDomainAdapter is a Vamp plugin adapter that converts | 52 * PluginInputDomainAdapter is a Vamp plugin adapter that converts |
53 * time-domain input into frequency-domain input for plugins that need | 53 * time-domain input into frequency-domain input for plugins that need |
54 * it. This permits a host to use time- and frequency-domain plugins | 54 * it. This permits a host to use time- and frequency-domain plugins |
55 * interchangeably without needing to handle the conversion itself. | 55 * interchangeably without needing to handle the conversion itself. |
56 * | 56 * |
57 * This adapter uses a basic Hanning windowed FFT that supports | 57 * This adapter uses a basic windowed FFT (using Hann window by |
58 * power-of-two block sizes only. If a frequency domain plugin | 58 * default) that supports power-of-two block sizes only. If a |
59 * requests a non-power-of-two blocksize, the adapter will adjust it | 59 * frequency domain plugin requests a non-power-of-two blocksize, the |
60 * to a nearby power of two instead. Thus, getPreferredBlockSize() | 60 * adapter will adjust it to a nearby power of two instead. Thus, |
61 * will always return a power of two if the wrapped plugin is a | 61 * getPreferredBlockSize() will always return a power of two if the |
62 * frequency domain one. If the plugin doesn't accept the adjusted | 62 * wrapped plugin is a frequency domain one. If the plugin doesn't |
63 * power of two block size, initialise() will fail. | 63 * accept the adjusted power of two block size, initialise() will |
64 * fail. | |
64 * | 65 * |
65 * The adapter provides no way for the host to discover whether the | 66 * The adapter provides no way for the host to discover whether the |
66 * underlying plugin is actually a time or frequency domain plugin | 67 * underlying plugin is actually a time or frequency domain plugin |
67 * (except that if the preferred block size is not a power of two, it | 68 * (except that if the preferred block size is not a power of two, it |
68 * must be a time domain plugin). | 69 * must be a time domain plugin). |
69 * | 70 * |
70 * The FFT implementation is simple and self-contained, but unlikely | 71 * The FFT implementation is simple and self-contained, but unlikely |
71 * to be the fastest available: a host can usually do better if it | 72 * to be the fastest available: a host can usually do better if it |
72 * cares enough. | 73 * cares enough. |
74 * | |
75 * The window shape for the FFT frame can be set using setWindowType | |
76 * and the current shape retrieved using getWindowType. (This was | |
77 * added in v2.3 of the SDK.) | |
73 * | 78 * |
74 * In every respect other than its input domain handling, the | 79 * In every respect other than its input domain handling, the |
75 * PluginInputDomainAdapter behaves identically to the plugin that it | 80 * PluginInputDomainAdapter behaves identically to the plugin that it |
76 * wraps. The wrapped plugin will be deleted when the wrapper is | 81 * wraps. The wrapped plugin will be deleted when the wrapper is |
77 * deleted. | 82 * deleted. |
182 * The result of calling this function before initialise() has | 187 * The result of calling this function before initialise() has |
183 * been called is undefined. | 188 * been called is undefined. |
184 */ | 189 */ |
185 RealTime getTimestampAdjustment() const; | 190 RealTime getTimestampAdjustment() const; |
186 | 191 |
192 /** | |
193 * The set of supported window shapes. | |
194 */ | |
195 enum WindowType { | |
196 | |
197 RectangularWindow = 0, | |
198 | |
199 BartlettWindow = 1, /// synonym for RectangularWindow | |
200 TriangularWindow = 1, /// synonym for BartlettWindow | |
201 | |
202 HammingWindow = 2, | |
203 | |
204 HanningWindow = 3, /// synonym for HannWindow | |
205 HannWindow = 3, /// synonym for HanningWindow | |
206 | |
207 BlackmanWindow = 4, | |
208 | |
209 NuttallWindow = 7, | |
210 | |
211 BlackmanHarrisWindow = 8 | |
212 }; | |
213 | |
214 /** | |
215 * Return the current window shape. The default is HanningWindow. | |
216 */ | |
217 WindowType getWindowType() const; | |
218 | |
219 /** | |
220 * Set the current window shape. | |
221 */ | |
222 void setWindowType(WindowType type); | |
223 | |
224 | |
187 protected: | 225 protected: |
188 class Impl; | 226 class Impl; |
189 Impl *m_impl; | 227 Impl *m_impl; |
190 }; | 228 }; |
191 | 229 |