CLAM-Development
1.1
|
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 _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 } //namespace CLAM 00099 00100 #endif // _SMSPitchDiscretization_ 00101