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