CLAM-Development  1.4.0
SpectralAnalysis.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3  * UNIVERSITAT POMPEU FABRA
4  *
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 #ifndef __SpectralAnalysis__
23 #define __SpectralAnalysis__
24 
25 //Uncomment this line if you want to use Ooura fft instead of fftw
26 //#define CLAM_OOURA
27 
28 #include "WindowGenerator.hxx"
29 #include "CircularShift.hxx"
31 #include "Audio.hxx"
32 #include "AudioMultiplier.hxx"
33 #include "ProcessingComposite.hxx"
34 
35 #include "FFT.hxx"
36 
37 #include "Spectrum.hxx"
38 #include "AudioInPort.hxx"
39 #include "OutPort.hxx"
40 
41 namespace CLAM {
42 
43 class Frame;
44 class Segment;
45 class ProcessingConfig;
46 
52 {
53 
54 public:
55 
56 // Processing Object compliance methods.
57 
58  const char *GetClassName() const {return "SpectralAnalysis";}
59 
60 
64 
65 
66  const ProcessingConfig &GetConfig() const {return mConfig;}
67 
69  bool Do(void);
70 
72  bool Do(const Audio& in,Spectrum& outSp);
73 
77  bool Do(Frame& in);
78 
83  bool Do(Segment& in);
84 private:
85 
87  SpectralAnalysisConfig mConfig;
88 
89 // The internal Processing Objects
90 
94  WindowGenerator mPO_WinGen;
95 
99  AudioMultiplier mPO_AProduct;
100 
104  CircularShift mPO_CShift;
105 
109  FFT mPO_FFT;
112 // AudioCircularBuffer mCircularBuffer;
113 
114 //Internal DataObjects
115 
117  Audio mAudioFrame;
119  Audio mWindow;
121  Spectrum mSpec;
122 
123  // Internal convenience methods.
124 
125  void AttachChildren();
126  bool ConfigureChildren();
127  void ConfigureData();
128 
129 
131  bool ConcreteConfigure(const ProcessingConfig&);
132 
134  AudioInPort mInput;
135  OutPort<Spectrum> mOutput;
136 
137 };
138 
139 } //namespace
140 
141 #endif
142