SpectralPeakArrayInterpolator.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 _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