Spectral.h

Go to the documentation of this file.
00001 //
00002 // Spectral.h -- UnitGenerator for going to/from the spectral domain
00003 // These classes use the CSL 5 FFT wrapper for FFTs.
00004 //
00005 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT
00006 //
00007 
00008 #ifndef CSL_Spectral_H
00009 #define CSL_Spectral_H
00010 
00011 #include "CSL_Core.h"
00012 #include "FFT_Wrapper.h"
00013 
00014 namespace csl {
00015 
00020 
00021 class FFT : public Effect {
00022 
00023 public:
00025     FFT(UnitGenerator & in, int size = CGestalt::blockSize(), CSL_FFTType type = CSL_FFT_COMPLEX);
00026     ~FFT();
00028     void nextBuffer(Buffer & outputBuffer) throw (CException);  
00029 
00030     int fftSize() { return mFFTSize; }  
00031 
00032     bool mOverwriteOutput;              
00033 
00034 protected:  
00035     int mFFTSize;                       
00036     FFTWrapper mWrapper;                
00037     Buffer mInBuf;                      
00038     SampleBuffer mWindowBuffer;             
00039 };
00040 
00044 
00045 class IFFT : public UnitGenerator {
00046 
00047 public:
00049     IFFT(int size = CGestalt::blockSize(), CSL_FFTType type = CSL_FFT_COMPLEX);
00050     ~IFFT();
00052     int fftSize() { return mFFTSize; }
00054     void binValue(int binNumber, float * outRealPart, float * outComplexPart);
00055     void binValueMagPhase(int binNumber, float * outMag, float * outPhase);
00056         
00057                                         // set the values in the specified bin
00058     void setBin(int binNumber, float realPart, float imagPart);
00059     void setBins(float * real, float * imag);
00060     void setBins(SampleComplexVector cmplxSpectrum);
00061     void setBins(SampleBuffer cmplxSpectrum);
00062     void setBins(int lower, int upper, float* real, float* imag);
00063     void setBinMagPhase(int binNumber, float mag, float phase);
00064     void setBinsMagPhase(float* mags, float* phases);
00065     
00066     void nextBuffer(Buffer & outputBuffer) throw (CException);
00067 
00068 protected:  
00069     int mFFTSize;                       
00070     FFTWrapper mWrapper;                
00071     Buffer mInBuf;                      
00072     SampleComplexPtr mSpectrum;         
00073 };
00074 
00075 }
00076 
00077 #endif

Generated on Thu Sep 17 23:14:16 2009 for CSL by  doxygen 1.5.8