SMSSynthesis.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _SMSSynthesis_
00023 #define _SMSSynthesis_
00024
00025 #include "SMSSynthesisConfig.hxx"
00026 #include "ProcessingComposite.hxx"
00027
00028 #include "Array.hxx"
00029 #include "Audio.hxx"
00030 #include "DataTypes.hxx"
00031 #include "DynamicType.hxx"
00032 #include "Err.hxx"
00033 #include "Frame.hxx"
00034 #include "Segment.hxx"
00035 #include "InControl.hxx"
00036 #include "Spectrum.hxx"
00037 #include "ProcessingData.hxx"
00038 #include "ProcessingDataConfig.hxx"
00039 #include "Processing.hxx"
00040 #include "SynthSineSpectrum.hxx"
00041 #include "PhaseManagement.hxx"
00042 #include "SpectralSynthesis.hxx"
00043 #include "SpectrumAdder2.hxx"
00044 #include "SMSAnalysis.hxx"
00045
00046 #include "InPort.hxx"
00047 #include "OutPort.hxx"
00048 #include "AudioOutPort.hxx"
00049
00050 #include <stdlib.h>
00051
00052 namespace CLAM {
00053
00057 class SMSSynthesis : public ProcessingComposite {
00058
00059 private:
00060
00061 typedef SMSSynthesisConfig Config;
00062 Config mConfig;
00063
00064 int mCurrentFrame;
00065
00066
00071 SpectralSynthesis mSinSpectralSynthesis;
00072 SpectralSynthesis mResSpectralSynthesis;
00073 SpectralSynthesis mSpectralSynthesis;
00074 SynthSineSpectrum mSynthSineSpectrum;
00075 PhaseManagement mPhaseMan;
00076 SpectrumAdder2 mSpectrumAdder;
00077
00078 OverlapAdd mOverlapAddSin;
00079 OverlapAdd mOverlapAddRes;
00080 OverlapAdd mOverlapAddGlobal;
00081
00082
00083
00085 Audio mAudioFrame;
00086
00087
00088
00089 void AttachChildren();
00090 bool ConfigureChildren();
00091 void ConfigureData();
00092
00093
00095 bool ConcreteConfigure(const ProcessingConfig&);
00096
00097 TInt32 CalculatePowerOfTwo(TInt32 size);
00098
00099 public:
00100 SMSSynthesis(const Config& cfg = Config());
00101 ~SMSSynthesis();
00102
00103
00104
00105 const char *GetClassName() const {return "SMSSynthesis";}
00106
00107
00108 const ProcessingConfig &GetConfig() const {return mConfig;}
00109
00111 bool Do(void);
00112
00114 bool SinusoidalSynthesis(const SpectralPeakArray& in,Spectrum& outSpec,Audio& outAudio);
00116 bool SinusoidalSynthesis(const SpectralPeakArray& in,Audio& out);
00117
00121 bool Do(SpectralPeakArray& inputSinusoidalPeaks, Spectrum& inputResidualSpectrum,
00122 Spectrum& outputSinusoidalSpectrum, Spectrum& outputSpectrum,
00123 Audio& outputAudio, Audio& outputSinusoidalAudio, Audio& outputResidualAudio);
00124
00128 bool Do(SpectralPeakArray& inputSinusoidalPeaks, Spectrum& inputResidualSpectrum,
00129 Spectrum& outputSinusoidalSpectrum, Spectrum& outputSpectrum,
00130 Audio& outputAudio);
00131
00136 bool Do(SpectralPeakArray& inputSinusoidal, Spectrum& inputSpectrum,
00137 Audio& outputAudio, Audio& outputSinusoidal, Audio& outputResidual);
00139 bool Do(Frame& in);
00149 bool Do(Frame& in, bool isSynthesizeSinusoidsAndResidual);
00152 bool Do(Segment& in);
00153 protected:
00154
00155 void InitFrame(Frame& in);
00156
00158 InPort<SpectralPeakArray> mInputSinSpectralPeaks;
00159 InPort<Spectrum> mInputResSpectrum;
00160 OutPort<Spectrum> mOutputSinSpectrum;
00161 OutPort<Spectrum> mOutputSpectrum;
00162 AudioOutPort mOutputAudio;
00163 AudioOutPort mOutputResAudio;
00164 AudioOutPort mOutputSinAudio;
00165
00166 public:
00167
00168 FloatInControl mCurrentTimeControl;
00169 FloatInControl mCurrentPitch;
00170
00171
00172 };
00173
00174 };
00175
00176 #endif //_SMSSynthesis_
00177