Chris@337: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@337: Chris@337: /* Chris@337: Vamp Chris@337: Chris@337: An API for audio analysis and feature extraction plugins. Chris@337: Chris@337: Centre for Digital Music, Queen Mary, University of London. Chris@337: Copyright 2006-2012 Chris Cannam and QMUL. Chris@337: Chris@337: Permission is hereby granted, free of charge, to any person Chris@337: obtaining a copy of this software and associated documentation Chris@337: files (the "Software"), to deal in the Software without Chris@337: restriction, including without limitation the rights to use, copy, Chris@337: modify, merge, publish, distribute, sublicense, and/or sell copies Chris@337: of the Software, and to permit persons to whom the Software is Chris@337: furnished to do so, subject to the following conditions: Chris@337: Chris@337: The above copyright notice and this permission notice shall be Chris@337: included in all copies or substantial portions of the Software. Chris@337: Chris@337: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Chris@337: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Chris@337: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND Chris@337: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR Chris@337: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF Chris@337: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION Chris@337: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Chris@337: Chris@337: Except as contained in this notice, the names of the Centre for Chris@337: Digital Music; Queen Mary, University of London; and Chris Cannam Chris@337: shall not be used in advertising or otherwise to promote the sale, Chris@337: use or other dealings in this Software without prior written Chris@337: authorization. Chris@337: */ Chris@337: Chris@337: #ifndef _VAMP_FFT_H_ Chris@337: #define _VAMP_FFT_H_ Chris@337: Chris@337: #include "plugguard.h" Chris@337: _VAMP_SDK_PLUGSPACE_BEGIN(FFT.h) Chris@337: Chris@337: namespace Vamp { Chris@337: Chris@337: /** Chris@337: * A simple FFT implementation provided for convenience of plugin Chris@337: * authors. Chris@337: * Chris@337: * This class provides double-precision FFTs in power-of-two sizes Chris@337: * only. It is slower than more sophisticated library Chris@337: * implementations. If these requirements aren't suitable, make other Chris@337: * arrangements. Chris@337: * Chris@337: * The inverse transform is scaled by 1/n. Chris@337: * Chris@337: * The implementation is from Don Cross's public domain FFT code. Chris@337: */ Chris@337: class FFT Chris@337: { Chris@337: public: Chris@337: /** Chris@337: * Calculate a forward transform of size n. Chris@337: * Chris@337: * ri and ii must point to the real and imaginary component arrays Chris@337: * of the input. For real input, ii may be NULL. Chris@337: * Chris@337: * ro and io must point to enough space to receive the real and Chris@337: * imaginary component arrays of the output. Chris@337: * Chris@337: * All input and output arrays are of size n. Chris@337: */ Chris@337: void forward(unsigned int n, Chris@337: const double *ri, const double *ii, Chris@337: double *ro, double *io); Chris@337: Chris@337: /** Chris@337: * Calculate an inverse transform of size n. Chris@337: * Chris@337: * ri and ii must point to the real and imaginary component arrays Chris@337: * of the input. For real input, ii may be NULL. Chris@337: * Chris@337: * ro and io must point to enough space to receive the real and Chris@337: * imaginary component arrays of the output. The output is scaled Chris@337: * by 1/n. The output pointers may not be NULL, even if the output Chris@337: * is expected to be real. Chris@337: * Chris@337: * All input and output arrays are of size n. Chris@337: */ Chris@337: void inverse(unsigned int n, Chris@337: const double *ri, const double *ii, Chris@337: double *ro, double *io); Chris@337: }; Chris@337: Chris@337: } Chris@337: Chris@337: _VAMP_SDK_PLUGSPACE_END(FFT.h) Chris@337: Chris@337: #endif