CLAM-Development  1.4.0
SinusoidalSynthesis.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 _SinusoidalSynthesis_
23 #define _SinusoidalSynthesis_
24 
25 #include "SMSSynthesisConfig.hxx"
26 #include "ProcessingComposite.hxx"
27 
28 #include "Array.hxx"
29 #include "Audio.hxx"
30 #include "DataTypes.hxx"
31 #include "DynamicType.hxx"
32 #include "Err.hxx"
33 #include "Frame.hxx"
34 #include "Segment.hxx"
35 #include "InControl.hxx"
36 #include "Spectrum.hxx"
37 #include "ProcessingData.hxx"
38 #include "ProcessingDataConfig.hxx"
39 #include "Processing.hxx"
40 #include "SynthSineSpectrum.hxx"
41 #include "PhaseManagement.hxx"
42 #include "SpectralSynthesis.hxx"
43 #include "SpectrumAdder2.hxx"
44 #include "SMSAnalysis.hxx"
45 
46 #include "InPort.hxx"
47 #include "OutPort.hxx"
48 #include "AudioOutPort.hxx"
49 
50 #include <stdlib.h>
51 
52 namespace CLAM {
53 
64 
65  private:
66  // Configuration data
67  typedef SMSSynthesisConfig Config;
68  Config mConfig;
69 
70  int mCurrentFrame;
71 
72  //internal Processing Objects
73  SpectralSynthesis mSinSpectralSynthesis;
74  SynthSineSpectrum mSynthSineSpectrum;
75  PhaseManagement mPhaseMan;
76  SpectrumAdder2 mSpectrumAdder;
77 
78  OverlapAdd mOverlapAddSin;
79 
80 
81 
83  Audio mAudioFrame;
84 
85  // Internal convenience methods.
86 
87  void AttachChildren();
88  bool ConfigureChildren();
89  void ConfigureData();
90 
91 
93  bool ConcreteConfigure(const ProcessingConfig&);
94 
95  TInt32 CalculatePowerOfTwo(TInt32 size);
96 
97  public:
98  SinusoidalSynthesis(const Config& cfg = Config());
100 
101  // Processing Object compliance methods.
102 
103  const char *GetClassName() const {return "SinusoidalSynthesis";}
104 
105 
106  const ProcessingConfig &GetConfig() const {return mConfig;}
107 
109  bool Do(void);
110 
114  bool Do(SpectralPeakArray& inputSinusoidalPeaks,
115  Spectrum& outputSpectrum,
116  Audio& outputAudio);
117 
118 
123  bool Do(SpectralPeakArray& inputSinusoidal, Audio& outputAudio);
125  bool Do(Frame& in);
128  bool Do(Segment& in);
129  protected:
130 
131  void InitFrame(Frame& in);
132 
138 
139  public:
140  //Controls
143 
144 
145  };
146 
147 }; //end of namespace
148 
149 #endif //_SinusoidalSynthesis_
150