SDIFOut.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 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 #ifndef _SDIFOut_
00023 #define _SDIFOut_
00024 
00025 #include "IndexArray.hxx"
00026 #include "Processing.hxx"
00027 #include "Err.hxx"
00028 #include "Segment.hxx"
00029 #include "Filename.hxx"
00030 #include "InPort.hxx"
00031 #include "Fundamental.hxx"
00032 #include "Spectrum.hxx"
00033 #include "SpectralPeakArray.hxx"
00034 
00035 
00036 namespace SDIF {class File;};//forward declaration
00037 
00038 namespace CLAM{
00039 
00040 class SDIFOutConfig:public ProcessingConfig
00041 {
00042 public:
00043 
00044         DYNAMIC_TYPE_USING_INTERFACE (SDIFOutConfig, 9, ProcessingConfig);
00045         DYN_ATTRIBUTE(0,public, TData, SpectralRange);
00046         DYN_ATTRIBUTE(1,public, TIndex, MaxNumPeaks);
00047         DYN_ATTRIBUTE(2,public, bool,EnableResidual);
00048         DYN_ATTRIBUTE(3,public, bool,EnablePeakArray);
00049         DYN_ATTRIBUTE(4,public, bool,EnableFundFreq);
00050         DYN_ATTRIBUTE(5,public, Filename,FileName);
00051         DYN_ATTRIBUTE(6,public, TData, SamplingRate);
00052         DYN_ATTRIBUTE(7,public, TData, FrameSize);
00053         DYN_ATTRIBUTE(8,public, TData, SpectrumSize);
00054 
00055         void DefaultInit();
00056 };
00057 
00058 class SDIFOut: public Processing
00059 {
00060 public:
00061 
00062         SDIFOut(const SDIFOutConfig& c);
00063         SDIFOut();
00064         
00065         virtual ~SDIFOut();
00066         const char * GetClassName() const {return "SDIFOut";}
00067         
00068         bool GetEnableResidual()        {return mConfig.GetEnableResidual();}
00069         bool GetEnablePeakArray()       {return mConfig.GetEnablePeakArray();}
00070         bool GetEnableFundFreq()        {return mConfig.GetEnableFundFreq();}
00071         
00072         bool Do(void);
00073 
00074         bool Do(const Frame& frame);
00075 
00076         const ProcessingConfig &GetConfig() const;
00077 
00078         SDIF::File* mpFile;
00079         
00080 protected:
00081 
00082         bool ConcreteStart();
00083 
00084         bool ConcreteStop();
00085 
00086         InPort<Fundamental>             mInputFundamental;
00087     InPort<SpectralPeakArray>     mInputSinSpectralPeaks;
00088         InPort<Spectrum>     mInputResSpectrum;
00089 
00090 private:
00091         
00092         bool ConcreteConfigure(const ProcessingConfig& c);
00093     void ConnectAndPublishPorts();
00094         
00095         SDIFOutConfig mConfig;
00096 
00097 // member variables
00098         IndexArray mPrevIndexArray;
00099     Frame singletonFrame;
00100                 
00101 };
00102 
00103 
00104 
00105 };//CLAM
00106 #endif
00107 
Generated by  doxygen 1.6.3