CLAM-Development  1.4.0
SynthSineSpectrum.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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 _SynthSineSpectrum_
23 #define _SynthSineSpectrum_
24 #include <typeinfo>
25 
26 #define MAINLOBE_TABLE_SIZE 4096 // Tablesize of the mainlobe of a BH92 Window
27 
28 #include "Err.hxx"
29 #include "WindowGenerator.hxx"
30 #include "AudioMultiplier.hxx"
31 #include "Spectrum.hxx"
32 #include "SpectralPeakArray.hxx"
33 #include "Complex.hxx"
34 #include "Processing.hxx"
36 #include "InPort.hxx"
37 #include "OutPort.hxx"
38 
39 namespace CLAM{
40 
44  /* SynthSineSpectrumConfig moved to SynthSineSpectrumConfig.hxx */
45 
46 
47 
58 {
59 
61  OutPort<Spectrum> mOutput;
62 
63 public:
64  /* constructor/destructor */
68  const char * GetClassName() const {return "SynthSineSpectrum";}
69 
70  /* public member functions */
71  bool Do(const SpectralPeakArray& peakArray,Spectrum& residualSpectrumOut, double gain=1.0);
72  bool Do(void);
73 
76 
77  const ProcessingConfig &GetConfig() const {return mConfig;}
78 
79 private:
80  /* private member functions */
81  void InitSynthSpec(TSize size);
82 
83  void FillSynthSineSpectrum(const SpectralPeakArray& peakArray,double gain = 1.0);
84 
85  /* private configuration*/
87 
88  /* window table generation */
89  WindowGenerator mWndGen;
90  //Spectrum mBlackHarris92TransMainLobe;
91  static double mBlackHarris92TransMainLobe[];
92 
93  /* internal buffer for synthesized sinusoidal spectrum */
94  Array< Complex > mSynthSineSpectrum;
95 };
96 };// CLAM namespace
97 #endif
98