SpectralPeakArrayInterpolator.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 _SpectralPeakArray_Interpolator_
00023 #define _SpectralPeakArray_Interpolator_
00024 
00025 #include "Processing.hxx"
00026 #include "DynamicType.hxx"
00027 #include "InPort.hxx"
00028 #include "OutPort.hxx"
00029 #include "SpectralPeakArray.hxx"
00030 #include "InControl.hxx"
00031 #include "Spectrum.hxx"
00032 
00033 namespace CLAM {
00034 
00035 
00036         class PeaksInterpConfig: public ProcessingConfig
00037         {
00038         public:
00039                 DYNAMIC_TYPE_USING_INTERFACE (PeaksInterpConfig, 5,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, bool, Harmonic);
00044                 DYN_ATTRIBUTE(4,public, bool, UseSpectralShape);
00045         protected:
00046                 void DefaultInit();
00047                 void DefaultValues();
00048 
00049         };
00050 
00054         class SpectralPeakArrayInterpolator: public Processing
00055         {
00056                 typedef PeaksInterpConfig Config;
00057                 Config mConfig;
00058 
00059                 const char *GetClassName() const {return "SpectralPeakArrayInterpolator";}
00060 
00064                 bool ConcreteConfigure(const ProcessingConfig&);
00065 
00066         public:
00067                 SpectralPeakArrayInterpolator(const PeaksInterpConfig &c = Config());
00068 
00069                 ~SpectralPeakArrayInterpolator() {};
00070 
00071                 const ProcessingConfig &GetConfig() const { return mConfig;}
00072 
00073                 bool Do(void);
00074 
00075                 bool Do(const SpectralPeakArray& in1, const SpectralPeakArray& in2, SpectralPeakArray& out);
00076                 bool Do(const SpectralPeakArray& in1, const SpectralPeakArray& in2,const Spectrum& spectralShape, SpectralPeakArray& out);
00077         
00079                 FloatInControl  mMagInterpolationFactorCtl;
00080                 FloatInControl  mFreqInterpolationFactorCtl;
00081                 FloatInControl  mPitchInterpolationFactorCtl;
00082 
00085                 FloatInControl  mPitch1Ctl;
00086                 FloatInControl  mPitch2Ctl;
00087 
00089                 FloatInControl mIsHarmonicCtl;
00090 
00092                 InPort<SpectralPeakArray> mIn1;
00093                 InPort<SpectralPeakArray> mIn2;
00094                 OutPort<SpectralPeakArray> mOut;
00095 
00096                 Spectrum* mpSpectralShape;
00097                 void AttachSpectralShape( Spectrum& spec ) { mpSpectralShape = &spec; }
00098         private:
00099                 bool FindHarmonic(const IndexArray& indexArray,int index,int& lastPosition);
00100 
00101         
00102         };
00103 
00104 }
00105 
00106 #endif // _SpectralPeakArray_Interpolator_
00107 
Generated by  doxygen 1.6.3