SMSPitchDiscretization.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 
00023 #ifndef _SMSPitchDiscretization_
00024 #define _SMSPitchDiscretization_
00025 
00026 #include "InPort.hxx"
00027 #include "OutPort.hxx"
00028 #include "SMSPitchShift.hxx"
00029 #include "SpectrumAdder2.hxx"
00030 #include "FrameTransformation.hxx"
00031 #include "FrameTransformationConfig.hxx"
00032 
00033 
00034 namespace CLAM{
00035 
00036 
00037         class SMSPitchDiscretization: public FrameTransformation
00038         {
00039                 InPort<SpectralPeakArray> mInPeaks;
00040                 InPort<Fundamental> mInFund;
00041                 InPort<Spectrum> mInSpectrum;
00042                 OutPort<SpectralPeakArray> mOutPeaks;
00043                 OutPort<Fundamental> mOutFund;
00044                 OutPort<Spectrum> mOutSpectrum;
00045 
00046                 SMSPitchShift mPitchShift;
00047                 
00048         public:
00049 
00050                 SMSPitchDiscretization()
00051                 :
00052                 mInPeaks("In SpectralPeaks", this),
00053                 mInFund("In Fundamental", this),
00054                 mInSpectrum("In Spectrum", this),
00055                 mOutPeaks("Out SpectralPeaks", this),
00056                 mOutFund("Out Fundamental", this),
00057                 mOutSpectrum("Out Spectrum", this)
00058                 {
00059                         Configure( FrameTransformationConfig() );
00060                 }
00061 
00062                 ~SMSPitchDiscretization() {}
00063 
00064                 bool Do()
00065                 {       
00066                         bool result = Do(mInPeaks.GetData(),
00067                                          mInFund.GetData(),
00068                                          mInSpectrum.GetData(),
00069                                          mOutPeaks.GetData(),
00070                                          mOutFund.GetData(),
00071                                          mOutSpectrum.GetData()
00072                                          );
00073 
00074                         mInPeaks.Consume();
00075                         mOutPeaks.Produce();
00076                         mInFund.Consume();
00077                         mOutFund.Produce();
00078                         mInSpectrum.Consume();
00079                         mOutSpectrum.Produce();
00080 
00081                         return result;
00082                 }
00083 
00084                 bool Do(const Frame& in, Frame& out);
00085 
00086                 bool Do(const SpectralPeakArray& inPeaks,
00087                         const Fundamental& inFund,
00088                         const Spectrum& inSpectrum,
00089                         SpectralPeakArray& outPeaks,
00090                         Fundamental& outFund,
00091                         Spectrum& outSpectrum
00092                         );
00093 
00094         private:
00095                 const char *GetClassName() const {return "SMSPitchDiscretization";}
00096                 
00097         };
00098 } 
00099 
00100 #endif // _SMSPitchDiscretization_
00101