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                 
00062                 typedef InControlTmpl<FrameInterpolator> FrameInterpolatorCtl;  
00063                 
00064                 FrameInterpConfig mConfig;
00065 
00066 
00067                 const char *GetClassName() const {return "FrameInterpolator";}
00068 
00069 
00073                 bool ConcreteConfigure(const ProcessingConfig&);
00074 
00075                 void AttachChildren();
00076 
00077         public:
00078                 FrameInterpolator();
00079 
00080                 FrameInterpolator(const FrameInterpConfig &c);
00081 
00082                 ~FrameInterpolator() {};
00083 
00084                 const ProcessingConfig &GetConfig() const { return mConfig;}
00085 
00086                 bool Do(void);
00087 
00088                 bool Do(const Frame& in1, const Frame& in2, Frame& out);
00089 
00090         
00092                 FrameInterpolatorCtl mFrameInterpolationFactorCtl;
00093                 
00094                 FrameInterpolatorCtl  mMagInterpolationFactorCtl;
00095                 FrameInterpolatorCtl  mFreqInterpolationFactorCtl;
00096                 FrameInterpolatorCtl  mPitchInterpolationFactorCtl;
00097                 FrameInterpolatorCtl  mResidualInterpolationFactorCtl;
00098 
00101                 FrameInterpolatorCtl  mPitch1Ctl;
00102                 FrameInterpolatorCtl  mPitch2Ctl;
00103 
00105                 FrameInterpolatorCtl mIsHarmonicCtl;
00106 
00108                 InPort<Frame> mIn1;
00109                 InPort<Frame> mIn2;
00110                 OutPort<Frame> mOut;
00111 
00112                 void AttachSpectralShape(Spectrum& spec) { mpSpectralShape = &spec; }
00113                 
00114                 Spectrum* mpSpectralShape;
00115         private:
00117                 SpectrumInterpolator mPO_SpectrumInterpolator;
00118                 SpectralPeakArrayInterpolator mPO_PeaksInterpolator;
00119 
00121                 int DoFrameFactorControl(TControlData value);
00122 
00123                 int DoMagFactorControl(TControlData value);
00124                 int DoFreqFactorControl(TControlData value);
00125                 int DoPitchFactorControl(TControlData value);
00126                 int DoResidualFactorControl(TControlData value);
00127 
00128                 int DoPitch1Control(TControlData value);
00129                 int DoPitch2Control(TControlData value);
00130 
00131                 int DoHarmonicControl(TControlData value);
00132         
00133         };
00134 
00135 }
00136 
00137 #endif // _Frame_Interpolator_
00138 

Generated on Tue Aug 12 22:33:42 2008 for CLAM by  doxygen 1.5.5