SMSSynthesis.hxx

Go to the documentation of this file.
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 _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                 // Configuration data
00061                 typedef SMSSynthesisConfig Config;
00062                 Config mConfig;
00063 
00064                 int mCurrentFrame;
00065 
00066                 //internal Processing Objects
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                 // Internal convenience methods.
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                 // Processing Object compliance methods.
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                 //Controls
00168                 FloatInControl mCurrentTimeControl;
00169                 FloatInControl mCurrentPitch;
00170 
00171 
00172         };
00173 
00174 }; //end of namespace
00175 
00176 #endif //_SMSSynthesis_
00177 
Generated by  doxygen 1.6.3