00001 /* 00002 * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG) 00003 * UNIVERSITAT POMPEU FABRA 00004 * 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 #ifndef __SpectralAnalysis__ 00023 #define __SpectralAnalysis__ 00024 00025 //Uncomment this line if you want to use Ooura fft instead of fftw 00026 //#define CLAM_OOURA 00027 00028 #include "WindowGenerator.hxx" 00029 #include "CircularShift.hxx" 00030 #include "SpectralAnalysisConfig.hxx" 00031 #include "Audio.hxx" 00032 #include "AudioMultiplier.hxx" 00033 #include "ProcessingComposite.hxx" 00034 00035 #include "FFT.hxx" 00036 00037 #include "Spectrum.hxx" 00038 #include "AudioInPort.hxx" 00039 #include "OutPort.hxx" 00040 00041 namespace CLAM { 00042 00043 class Frame; 00044 class Segment; 00045 class ProcessingConfig; 00046 00051 class SpectralAnalysis:public ProcessingComposite 00052 { 00053 00054 public: 00055 00056 // Processing Object compliance methods. 00057 00058 const char *GetClassName() const {return "SpectralAnalysis";} 00059 00060 00061 SpectralAnalysis(SpectralAnalysisConfig& config); 00062 SpectralAnalysis(); 00063 ~SpectralAnalysis(); 00064 00065 00066 const ProcessingConfig &GetConfig() const {return mConfig;} 00067 00069 bool Do(void); 00070 00072 bool Do(const Audio& in,Spectrum& outSp); 00073 00077 bool Do(Frame& in); 00078 00083 bool Do(Segment& in); 00084 private: 00085 00087 SpectralAnalysisConfig mConfig; 00088 00089 // The internal Processing Objects 00090 00094 WindowGenerator mPO_WinGen; 00095 00099 AudioMultiplier mPO_AProduct; 00100 00104 CircularShift mPO_CShift; 00105 00109 FFT mPO_FFT; 00112 // AudioCircularBuffer mCircularBuffer; 00113 00114 //Internal DataObjects 00115 00117 Audio mAudioFrame; 00119 Audio mWindow; 00121 Spectrum mSpec; 00122 00123 // Internal convenience methods. 00124 00125 void AttachChildren(); 00126 bool ConfigureChildren(); 00127 void ConfigureData(); 00128 00129 00131 bool ConcreteConfigure(const ProcessingConfig&); 00132 00134 AudioInPort mInput; 00135 OutPort<Spectrum> mOutput; 00136 00137 }; 00138 00139 } //namespace 00140 00141 #endif 00142