FrameInterpolator.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 _Frame_Interpolator_
00023 #define _Frame_Interpolator_
00024 
00025 #include "ProcessingComposite.hxx"
00026 #include "DynamicType.hxx"
00027 #include "Frame.hxx"
00028 #include "InPort.hxx"
00029 #include "OutPort.hxx"
00030 #include "SpectrumInterpolator.hxx"
00031 #include "SpectralPeakArrayInterpolator.hxx"
00032 
00033 namespace CLAM {
00034 
00035 
00036         class FrameInterpConfig: public ProcessingConfig
00037         {
00038         public:
00039                 DYNAMIC_TYPE_USING_INTERFACE (FrameInterpConfig, 6,ProcessingConfig);
00040                 DYN_ATTRIBUTE(0, public, TData, MagInterpolationFactor);
00041                 DYN_ATTRIBUTE(1, public, TData, FreqInterpolationFactor);
00042                 DYN_ATTRIBUTE(2, public, TData, PitchInterpolationFactor);
00043                 DYN_ATTRIBUTE(3, public, TData, ResidualInterpolationFactor);
00044                 DYN_ATTRIBUTE(4, public, bool, Harmonic);
00045                 DYN_ATTRIBUTE(5, public, bool, UseSpectralShape);
00046         protected:
00047                 void DefaultInit();
00048                 void DefaultValues();
00049 
00050         };
00051 
00060         class FrameInterpolator: public ProcessingComposite {
00061                 typedef FrameInterpConfig Config;
00062                 Config mConfig;
00063 
00064 
00065                 const char *GetClassName() const {return "FrameInterpolator";}
00066 
00067 
00071                 bool ConcreteConfigure(const ProcessingConfig&);
00072 
00073                 void AttachChildren();
00074 
00075         public:
00076                 FrameInterpolator(const FrameInterpConfig &c=Config());
00077 
00078                 ~FrameInterpolator() {};
00079 
00080                 const ProcessingConfig &GetConfig() const { return mConfig;}
00081 
00082                 bool Do(void);
00083 
00084                 bool Do(const Frame& in1, const Frame& in2, Frame& out);
00085 
00086         
00088                 FloatInControl mFrameInterpolationFactorCtl;
00089                 
00090                 FloatInControl  mMagInterpolationFactorCtl;
00091                 FloatInControl  mFreqInterpolationFactorCtl;
00092                 FloatInControl  mPitchInterpolationFactorCtl;
00093                 FloatInControl  mResidualInterpolationFactorCtl;
00094 
00097                 FloatInControl  mPitch1Ctl;
00098                 FloatInControl  mPitch2Ctl;
00099 
00101                 FloatInControl mIsHarmonicCtl;
00102 
00104                 InPort<Frame> mIn1;
00105                 InPort<Frame> mIn2;
00106                 OutPort<Frame> mOut;
00107 
00108                 void AttachSpectralShape(Spectrum& spec) { mpSpectralShape = &spec; }
00109                 
00110                 Spectrum* mpSpectralShape;
00111         private:
00113                 SpectrumInterpolator mPO_SpectrumInterpolator;
00114                 SpectralPeakArrayInterpolator mPO_PeaksInterpolator;
00115 
00117                 void DoFrameFactorControl(TControlData value);
00118 
00119                 void DoMagFactorControl(TControlData value);
00120                 void DoFreqFactorControl(TControlData value);
00121                 void DoPitchFactorControl(TControlData value);
00122                 void DoResidualFactorControl(TControlData value);
00123 
00124                 void DoPitch1Control(TControlData value);
00125                 void DoPitch2Control(TControlData value);
00126 
00127                 void DoHarmonicControl(TControlData value);
00128         
00129         };
00130 
00131 }
00132 
00133 #endif // _Frame_Interpolator_
00134 
Generated by  doxygen 1.6.3