SMSSpectralShapeShift.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 
00023 #ifndef _SMSSpectralShapeShift_
00024 #define _SMSSpectralShapeShift_
00025 
00026 #include "SpectralEnvelopeExtract.hxx"
00027 #include "SpectralEnvelopeApply.hxx"
00028 #include "Frame.hxx"
00029 #include "FDCombFilter.hxx"
00030 #include "InPort.hxx"
00031 #include "OutPort.hxx"
00032 #include "SegmentTransformationConfig.hxx"
00033 #include "InControl.hxx"
00034 #include "FrameTransformation.hxx"
00035 #include "FrameTransformationConfig.hxx"
00036 
00037 namespace CLAM{
00038 
00039 
00044         class SMSSpectralShapeShift: public FrameTransformation
00045         {
00046                 
00047                 const char *GetClassName() const {return "SMSSpectralShapeShift";}
00048 
00049                 InPort<SpectralPeakArray> mIn;
00050                 OutPort<SpectralPeakArray> mOut;
00051 
00052                 FloatInControl mSteps;
00053         public:
00054 
00055                 SMSSpectralShapeShift() 
00056                         : 
00057                         mIn( "In SpectralPeaks", this),
00058                         mOut( "Out SpectralPeaks", this),
00059                         mSteps( "Shift Steps", this)
00060                 {
00061                         Configure( SegmentTransformationConfig() );
00062                         mSpectralRange=22050;   //default
00063                 }
00064 
00065                 ~SMSSpectralShapeShift() {}
00066 
00067                 bool Do(const Frame& in, Frame& out)
00068                 {
00069                         return Do(in.GetSpectralPeakArray(), 
00070                                 out.GetSpectralPeakArray());
00071                 }
00072         
00073                 bool Do(const SpectralPeakArray& inpeaks,SpectralPeakArray& out);
00074 
00075                 bool Do()
00076                 {
00077                         bool result = Do(mIn.GetData(), mOut.GetData());
00078                         mIn.Consume();
00079                         mOut.Produce();
00080                         return result;  
00081                 }
00082 
00083         private:
00084                 SpectralEnvelopeExtract mSpectralEnvelopeExtract;
00085                 SpectralEnvelopeApply mSpectralEnvelopeApply;
00086                 Spectrum mSpectralEnvelope;
00087                 TSize mSpectralRange;
00088         };              
00089 }       //namespace CLAM
00090 
00091 #endif // _SMSSpectralShapeShift_
00092 
Generated by  doxygen 1.6.3