3BandFilter.hxx

Go to the documentation of this file.
00001 
00002 /*
00003  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
00004  *                         UNIVERSITAT POMPEU FABRA
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 
00024 #ifndef _ThreeBandFilter_
00025 #define _ThreeBandFilter_
00026 
00027 #include "InPort.hxx"
00028 #include "OutPort.hxx"
00029 #include "InControl.hxx"
00030 #include "Frame.hxx"
00031 #include "FrameTransformation.hxx"
00032 #include "FrameTransformationConfig.hxx"
00033 
00034 namespace CLAM{
00035 
00050         class ThreeBandFilter: public FrameTransformationTmpl<Spectrum>
00051         {
00052                 InPort<Spectrum> mIn;
00053                 OutPort<Spectrum> mOut;
00054 
00055                 FloatInControl mLowCutoffFreqCtl;
00056                 FloatInControl mHighCutoffFreqCtl;
00057                 FloatInControl mLowGainCtl;
00058                 FloatInControl mMidGainCtl;
00059                 FloatInControl mHighGainCtl;
00060         public:
00061                 const char* GetClassName() const
00062                 {
00063                         return "ThreeBandFilter";
00064                 }
00065 
00066                 ThreeBandFilter() 
00067                         : mIn("In Spectrum", this)
00068                         , mOut("Out Spectrum", this)
00069                         , mLowCutoffFreqCtl("LowCutoff", this)
00070                         , mHighCutoffFreqCtl("HighCutoff", this)
00071                         , mLowGainCtl("LowGain", this)
00072                         , mMidGainCtl("MidGain", this)
00073                         , mHighGainCtl("HighGain", this)
00074                 {
00075                         Configure( FrameTransformationConfig() );
00076                 }
00077 
00078                 ~ThreeBandFilter() {}   
00079                 
00080                 bool ConcreteConfigure( const ProcessingConfig& config )
00081                 {
00082                         mLowCutoffFreqCtl.SetBounds(0.,1000000.);
00083                         mLowCutoffFreqCtl.DoControl(1000.);
00084                         
00085                         mHighCutoffFreqCtl.SetBounds(0.,1000000.);
00086                         mHighCutoffFreqCtl.DoControl(5000.);
00087                         
00088                         mLowGainCtl.SetBounds(0,100);
00089                         mLowGainCtl.DoControl(0);
00090                         
00091                         mMidGainCtl.SetBounds(0,100);
00092                         mMidGainCtl.DoControl(0);
00093 
00094                         mHighGainCtl.SetBounds(0,100);
00095                         mHighGainCtl.DoControl(0);
00096                         return true;
00097                 }
00098                 
00099                 bool Do(const Frame& in, Frame& out)
00100                 {
00101                         return Do(in.GetSpectrum(), 
00102                                   out.GetSpectrum());
00103                 }
00104 
00105                 bool Do(const Spectrum& in, Spectrum& out);
00106 
00107                 bool Do()
00108                 {
00109                         bool result = Do(mIn.GetData(), mOut.GetData()); 
00110                         mIn.Consume();
00111                         mOut.Produce();
00112                         return result;
00113                 }
00114         };              
00115 };//namespace CLAM
00116 
00117 #endif // _ThreeBandFilter_
Generated by  doxygen 1.6.3