00001 #ifndef INCLUDE_FOURIERTRANSFORM_H 00002 #define INCLUDE_FOURIERTRANSFORM_H 00003 /* 00004 * This is the Loris C++ Class Library, implementing analysis, 00005 * manipulation, and synthesis of digitized sounds using the Reassigned 00006 * Bandwidth-Enhanced Additive Sound Model. 00007 * 00008 * Loris is Copyright (c) 1999-2010 by Kelly Fitz and Lippold Haken 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY, without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * 00025 * FourierTransform.h 00026 * 00027 * Definition of class Loris::FourierTransform, providing a simplified 00028 * uniform interface to the FFTW library (www.fftw.org), version 2.1.3 00029 * or newer (including version 3), or to the General Purpose FFT package 00030 * by Takuya OOURA, http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html if 00031 * FFTW is unavailable. 00032 * 00033 * Kelly Fitz, 2 Jun 2006 00034 * loris@cerlsoundgroup.org 00035 * 00036 * http://www.cerlsoundgroup.org/Loris/ 00037 * 00038 */ 00039 #include <complex> 00040 #include <vector> 00041 00042 // begin namespace 00043 namespace Loris { 00044 00045 // insulating implementation class, defined in FourierTransform.C 00046 class FTimpl; 00047 00048 // --------------------------------------------------------------------------- 00049 // class FourierTransform 00050 // 00070 // 00071 class FourierTransform 00072 { 00073 // -- public interface -- 00074 public: 00075 00078 typedef std::vector< std::complex< double > >::size_type size_type; 00079 00081 typedef std::vector< std::complex< double > >::iterator iterator; 00082 00084 typedef std::vector< std::complex< double > >::const_iterator const_iterator; 00085 00086 // --- lifecycle --- 00087 00094 FourierTransform( size_type len ); 00095 00102 FourierTransform( const FourierTransform & rhs ); 00103 00105 ~FourierTransform( void ); 00106 00107 // --- operators --- 00108 00116 FourierTransform & operator= ( const FourierTransform & rhs ); 00117 00118 00119 // --- access/mutation --- 00120 00131 std::complex< double > & operator[] ( size_type index ) 00132 { 00133 return _buffer[ index ]; 00134 } 00135 00146 const std::complex< double > & operator[] ( size_type index ) const 00147 { 00148 return _buffer[ index ]; 00149 } 00150 00156 iterator begin( void ) 00157 { 00158 return _buffer.begin(); 00159 } 00160 00166 iterator end( void ) 00167 { 00168 return _buffer.end(); 00169 } 00170 00176 const_iterator begin( void ) const 00177 { 00178 return _buffer.begin(); 00179 } 00180 00186 const_iterator end( void ) const 00187 { 00188 return _buffer.end(); 00189 } 00190 00191 // --- operations --- 00192 00197 void transform( void ); 00198 00199 // --- inquiry --- 00200 00204 size_type size( void ) const ; 00205 00206 // -- instance variables -- 00207 private: 00208 00212 std::vector< std::complex< double > > _buffer; 00213 00214 // insulating implementation instance (defined in 00215 // FourierTransform.C), conceals interface to FFTW 00216 FTimpl * _impl; 00217 00218 }; // end of class FourierTransform 00219 00220 00221 } // end of namespace Loris 00222 00223 #endif /* ndef INCLUDE_FOURIERTRANSFORM_H */